summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--backend_common.c5
-rw-r--r--backend_common.h5
-rw-r--r--backend_dnpds40.c3
-rw-r--r--backend_hiti.c4
-rw-r--r--backend_kodak6800.c4
-rw-r--r--backend_mitsu70x.c3
-rw-r--r--backend_mitsu9550.c4
-rw-r--r--backend_shinkos1245.c3
-rw-r--r--backend_shinkos2145.c3
-rw-r--r--backend_sinfonia.c3
-rw-r--r--backend_sinfonia.h2
11 files changed, 26 insertions, 13 deletions
diff --git a/backend_common.c b/backend_common.c
index 42a74b5..42bfe82 100644
--- a/backend_common.c
+++ b/backend_common.c
@@ -594,14 +594,15 @@ candidate:
serial = url_encode(serial);
} else if ((serial = dict_find("SERN", dlen, dict))) {
serial = url_encode(serial);
- } else if (desc->iSerialNumber) { /* Get from USB descriptor */
+ } else if (!(backend->flags & BACKEND_FLAG_BADISERIAL) &&
+ desc->iSerialNumber) { /* Get from USB descriptor, if we can trust it.. */
libusb_get_string_descriptor_ascii(dev, desc->iSerialNumber, (unsigned char*)buf, STR_LEN_MAX);
sanitize_string(buf);
serial = url_encode(buf);
} else if (backend->query_serno) { /* Get from backend hook */
buf[0] = 0;
/* Ignore result since a failure isn't critical here */
- backend->query_serno(dev, endp_up, endp_down, buf, STR_LEN_MAX);
+ backend->query_serno(dev, endp_up, endp_down, iface, buf, STR_LEN_MAX);
serial = url_encode(buf);
}
diff --git a/backend_common.h b/backend_common.h
index 9567a7a..e980bd9 100644
--- a/backend_common.h
+++ b/backend_common.h
@@ -198,7 +198,8 @@ struct marker {
int numtype; /* Numerical type, (-1 for unknown) */
};
-#define BACKEND_FLAG_JOBLIST 0x00000001
+#define BACKEND_FLAG_JOBLIST 0x00000001
+#define BACKEND_FLAG_BADISERIAL 0x00000002
/* Backend Functions */
struct dyesub_backend {
@@ -215,7 +216,7 @@ struct dyesub_backend {
int (*read_parse)(void *ctx, const void **job, int data_fd, int copies);
void (*cleanup_job)(const void *job);
int (*main_loop)(void *ctx, const void *job);
- int (*query_serno)(struct libusb_device_handle *dev, uint8_t endp_up, uint8_t endp_down, char *buf, int buf_len); /* Optional */
+ int (*query_serno)(struct libusb_device_handle *dev, uint8_t endp_up, uint8_t endp_down, int iface, char *buf, int buf_len); /* Optional */
int (*query_markers)(void *ctx, struct marker **markers, int *count);
const struct device_id devices[];
};
diff --git a/backend_dnpds40.c b/backend_dnpds40.c
index 307d732..fe8b577 100644
--- a/backend_dnpds40.c
+++ b/backend_dnpds40.c
@@ -667,7 +667,7 @@ static uint8_t *dnpds40_resp_cmd2(struct dnpds40_ctx *ctx,
#define dnpds40_resp_cmd(__ctx, __cmd, __len) dnpds40_resp_cmd2(__ctx, __cmd, __len, NULL, 0)
-static int dnpds40_query_serno(struct libusb_device_handle *dev, uint8_t endp_up, uint8_t endp_down, char *buf, int buf_len)
+static int dnpds40_query_serno(struct libusb_device_handle *dev, uint8_t endp_up, uint8_t endp_down, int iface, char *buf, int buf_len)
{
struct dnpds40_cmd cmd;
uint8_t *resp;
@@ -677,6 +677,7 @@ static int dnpds40_query_serno(struct libusb_device_handle *dev, uint8_t endp_up
.dev = dev,
.endp_up = endp_up,
.endp_down = endp_down,
+ .iface = iface,
};
/* Get Serial Number */
diff --git a/backend_hiti.c b/backend_hiti.c
index aa1b905..cdbb6ef 100644
--- a/backend_hiti.c
+++ b/backend_hiti.c
@@ -2059,12 +2059,14 @@ static int hiti_query_counter(struct hiti_ctx *ctx, uint8_t arg, uint32_t *resp)
return CUPS_BACKEND_OK;
}
-static int hiti_query_serno(struct libusb_device_handle *dev, uint8_t endp_up, uint8_t endp_down, char *buf, int buf_len)
+static int hiti_query_serno(struct libusb_device_handle *dev, uint8_t endp_up, uint8_t endp_down, int iface, char *buf, int buf_len)
{
int ret;
uint16_t rsplen = 18;
uint8_t rspbuf[18];
+ UNUSED(iface);
+
struct hiti_ctx ctx = {
.dev = dev,
.endp_up = endp_up,
diff --git a/backend_kodak6800.c b/backend_kodak6800.c
index b262e9f..740e4bc 100644
--- a/backend_kodak6800.c
+++ b/backend_kodak6800.c
@@ -540,7 +540,7 @@ done:
return ret;
}
-static int kodak6800_query_serno(struct libusb_device_handle *dev, uint8_t endp_up, uint8_t endp_down, char *buf, int buf_len)
+static int kodak6800_query_serno(struct libusb_device_handle *dev, uint8_t endp_up, uint8_t endp_down, int iface, char *buf, int buf_len)
{
struct kodak6800_ctx ctx = {
.dev = dev,
@@ -554,6 +554,8 @@ static int kodak6800_query_serno(struct libusb_device_handle *dev, uint8_t endp_
uint8_t resp[33];
uint8_t req[16];
+ UNUSED(iface);
+
memset(req, 0, sizeof(req));
memset(resp, 0, sizeof(resp));
diff --git a/backend_mitsu70x.c b/backend_mitsu70x.c
index 801d72b..796846c 100644
--- a/backend_mitsu70x.c
+++ b/backend_mitsu70x.c
@@ -2361,7 +2361,7 @@ static int mitsu70x_query_status(struct mitsu70x_ctx *ctx)
return ret;
}
-static int mitsu70x_query_serno(struct libusb_device_handle *dev, uint8_t endp_up, uint8_t endp_down, char *buf, int buf_len)
+static int mitsu70x_query_serno(struct libusb_device_handle *dev, uint8_t endp_up, uint8_t endp_down, int iface, char *buf, int buf_len)
{
int ret, i;
struct mitsu70x_printerstatus_resp resp = { .hdr = { 0 } };
@@ -2371,6 +2371,7 @@ static int mitsu70x_query_serno(struct libusb_device_handle *dev, uint8_t endp_u
.endp_up = endp_up,
.endp_down = endp_down,
};
+ UNUSED(iface);
ret = mitsu70x_get_printerstatus(&ctx, &resp);
diff --git a/backend_mitsu9550.c b/backend_mitsu9550.c
index e178167..4586a69 100644
--- a/backend_mitsu9550.c
+++ b/backend_mitsu9550.c
@@ -1566,13 +1566,15 @@ static int mitsu9550_query_status2(struct mitsu9550_ctx *ctx)
return ret;
}
-static int mitsu9550_query_serno(struct libusb_device_handle *dev, uint8_t endp_up, uint8_t endp_down, char *buf, int buf_len)
+static int mitsu9550_query_serno(struct libusb_device_handle *dev, uint8_t endp_up, uint8_t endp_down, int iface, char *buf, int buf_len)
{
struct mitsu9550_cmd cmd;
uint8_t rdbuf[READBACK_LEN];
uint8_t *ptr;
int ret, num, i;
+ UNUSED(iface);
+
cmd.cmd[0] = 0x1b;
cmd.cmd[1] = 0x72;
cmd.cmd[2] = 0x6e;
diff --git a/backend_shinkos1245.c b/backend_shinkos1245.c
index cee40c4..52cc2e2 100644
--- a/backend_shinkos1245.c
+++ b/backend_shinkos1245.c
@@ -1205,7 +1205,7 @@ printer_error2:
return CUPS_BACKEND_FAILED;
}
-static int shinkos1245_query_serno(struct libusb_device_handle *dev, uint8_t endp_up, uint8_t endp_down, char *buf, int buf_len)
+static int shinkos1245_query_serno(struct libusb_device_handle *dev, uint8_t endp_up, uint8_t endp_down, int iface, char *buf, int buf_len)
{
struct shinkos1245_resp_getid resp;
int i;
@@ -1215,6 +1215,7 @@ static int shinkos1245_query_serno(struct libusb_device_handle *dev, uint8_t end
.endp_up = endp_up,
.endp_down = endp_down,
};
+ UNUSED(iface);
i = shinkos1245_get_printerid(&ctx, &resp);
if (i < 0)
diff --git a/backend_shinkos2145.c b/backend_shinkos2145.c
index 367e350..e1762c6 100644
--- a/backend_shinkos2145.c
+++ b/backend_shinkos2145.c
@@ -1101,7 +1101,7 @@ printer_error:
return CUPS_BACKEND_FAILED;
}
-static int shinkos2145_query_serno(struct libusb_device_handle *dev, uint8_t endp_up, uint8_t endp_down, char *buf, int buf_len)
+static int shinkos2145_query_serno(struct libusb_device_handle *dev, uint8_t endp_up, uint8_t endp_down, int iface, char *buf, int buf_len)
{
struct sinfonia_cmd_hdr cmd;
struct s2145_getunique_resp resp;
@@ -1111,6 +1111,7 @@ static int shinkos2145_query_serno(struct libusb_device_handle *dev, uint8_t end
.dev = dev,
.endp_up = endp_up,
.endp_down = endp_down,
+ .iface = iface,
};
cmd.cmd = cpu_to_le16(SINFONIA_CMD_GETUNIQUE);
diff --git a/backend_sinfonia.c b/backend_sinfonia.c
index 7a1348b..093f4ec 100644
--- a/backend_sinfonia.c
+++ b/backend_sinfonia.c
@@ -779,7 +779,7 @@ const char *dummy_error_codes(uint8_t major, uint8_t minor)
return "Unknown";
}
-int sinfonia_query_serno(struct libusb_device_handle *dev, uint8_t endp_up, uint8_t endp_down, char *buf, int buf_len)
+int sinfonia_query_serno(struct libusb_device_handle *dev, uint8_t endp_up, uint8_t endp_down, int iface, char *buf, int buf_len)
{
struct sinfonia_cmd_hdr cmd;
struct sinfonia_getserial_resp resp;
@@ -787,6 +787,7 @@ int sinfonia_query_serno(struct libusb_device_handle *dev, uint8_t endp_up, uint
struct sinfonia_usbdev sdev = {
.dev = dev,
+ .iface = iface,
.endp_up = endp_up,
.endp_down = endp_down,
.error_codes = dummy_error_codes,
diff --git a/backend_sinfonia.h b/backend_sinfonia.h
index 2726054..0a7529a 100644
--- a/backend_sinfonia.h
+++ b/backend_sinfonia.h
@@ -105,7 +105,7 @@ int sinfonia_gettonecurve(struct sinfonia_usbdev *usbh, int type, char *fname);
int sinfonia_settonecurve(struct sinfonia_usbdev *usbh, int target, char *fname);
int sinfonia_button_set(struct sinfonia_usbdev *dev, int enable);
-int sinfonia_query_serno(struct libusb_device_handle *dev, uint8_t endp_up, uint8_t endp_down, char *buf, int buf_len);
+int sinfonia_query_serno(struct libusb_device_handle *dev, uint8_t endp_up, uint8_t endp_down, int iface, char *buf, int buf_len);
int sinfonia_dumpallparams(struct sinfonia_usbdev *usbh, int known);
const char *sinfonia_paramname(struct sinfonia_usbdev *usbh, int id);