From: "P. Christeas" <p_christ@hol.gr>
To: Oliver Neukum <oliver@neukum.org>
Cc: Pete Zaitcev <zaitcev@redhat.com>, lkml <linux-kernel@vger.kernel.org>
Subject: Patch: usblp quirk for zebra printers
Date: Wed, 21 May 2008 20:57:49 +0300 [thread overview]
Message-ID: <200805212057.52050.p_christ@hol.gr> (raw)
[-- Attachment #1: Type: text/plain, Size: 173 bytes --]
Hi,
I guess such a quirk may be a little odd, but it has been a blocking point in
my system not being able to support more than one printer.
Please comment. (and cc. me)
[-- Attachment #2: 0001-USB-Quirk-for-Zebra-printers-not-reporting-their-S.patch --]
[-- Type: text/x-diff, Size: 2668 bytes --]
From 2c87e2cbc8d33b49b6e7a20b9b85570840bb0e12 Mon Sep 17 00:00:00 2001
From: P.Christeas <p_christ@hol.gr>
Date: Wed, 21 May 2008 20:47:52 +0300
Subject: [PATCH] USB: Quirk for Zebra printers not reporting their S/N.
Those printers (and maybe others) don't report their Serial
Number as a part of their IEEE1284 device id string. Thus,
printing backends like CUPS cannot select among multiple
devices at the same host.
Workaround this situation by appending the SN in usblp.c .
---
drivers/usb/class/usblp.c | 19 +++++++++++++++++++
1 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/drivers/usb/class/usblp.c b/drivers/usb/class/usblp.c
index 0647164..a4d324b 100644
--- a/drivers/usb/class/usblp.c
+++ b/drivers/usb/class/usblp.c
@@ -210,6 +210,7 @@ struct quirk_printer_struct {
#define USBLP_QUIRK_BIDIR 0x1 /* reports bidir but requires unidirectional mode (no INs/reads) */
#define USBLP_QUIRK_USB_INIT 0x2 /* needs vendor USB init string */
#define USBLP_QUIRK_BAD_CLASS 0x4 /* descriptor uses vendor-specific Class or SubClass */
+#define USBLP_QUIRK_ID_NO_SERIAL 0x8 /* Printer does not report its serial no. in GET_ID request */
static const struct quirk_printer_struct quirk_printers[] = {
{ 0x03f0, 0x0004, USBLP_QUIRK_BIDIR }, /* HP DeskJet 895C */
@@ -227,6 +228,7 @@ static const struct quirk_printer_struct quirk_printers[] = {
{ 0x0409, 0xf1be, USBLP_QUIRK_BIDIR }, /* NEC Picty800 (HP OEM) */
{ 0x0482, 0x0010, USBLP_QUIRK_BIDIR }, /* Kyocera Mita FS 820, by zut <kernel@zut.de> */
{ 0x04b8, 0x0202, USBLP_QUIRK_BAD_CLASS }, /* Seiko Epson Receipt Printer M129C */
+ { 0x0a5f, 0x000a, USBLP_QUIRK_ID_NO_SERIAL }, /* Zebra printers don't report their serial */
{ 0, 0 }
};
@@ -1330,6 +1332,23 @@ static int usblp_cache_device_id_string(struct usblp *usblp)
length = 2;
else if (length >= USBLP_DEVICE_ID_SIZE)
length = USBLP_DEVICE_ID_SIZE - 1;
+
+ /* If printer doesn't report its serial, we append it */
+ if ((usblp->quirks & USBLP_QUIRK_ID_NO_SERIAL) && (usblp->dev->serial) &&
+ (length + strlen(usblp->dev->serial) + 5 <USBLP_DEVICE_ID_SIZE) ) {
+
+ if (usblp->device_id_string[length-1] != ';')
+ usblp->device_id_string[length++]= ';';
+
+ strcpy(&usblp->device_id_string[length],"SN:");
+ length+=3;
+ strcat(&usblp->device_id_string[length],usblp->dev->serial);
+ length += strlen(usblp->dev->serial);
+ usblp->device_id_string[length++]= ';';
+
+ *((__be16 *)usblp->device_id_string) = cpu_to_be16(length);
+ }
+
usblp->device_id_string[length] = '\0';
dbg("usblp%d Device ID string [len=%d]=\"%s\"",
--
1.5.4.3
next reply other threads:[~2008-05-21 18:07 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-21 17:57 P. Christeas [this message]
2008-05-21 22:37 ` Patch: usblp quirk for zebra printers Pete Zaitcev
2008-05-25 9:03 ` P. Christeas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200805212057.52050.p_christ@hol.gr \
--to=p_christ@hol.gr \
--cc=linux-kernel@vger.kernel.org \
--cc=oliver@neukum.org \
--cc=zaitcev@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.