Make USB printer work

Pavel Machek (pavel@bug.ucw.cz)
Mon, 21 Jun 1999 18:27:59 +0200


Hi!

Please apply this trivial patch -- it makes printer actually work. No
more repeating of first characters of text all over and over and over
and ov...

Pavel

--- clean/drivers/usb/printer.c Tue Jun 15 11:25:37 1999
+++ linux/drivers/usb/printer.c Tue Jun 15 11:19:33 1999
@@ -2,6 +2,7 @@
/* Driver for USB Printers
*
* (C) Michael Gee (michael@linuxspecific.com) 1999
+ * Copyright 1999 Pavel Machek <pavel@ucw.cz>, sponsored by SuSE
*
*/

@@ -25,7 +26,7 @@
#define MAX_RETRY_COUNT ((60*60*HZ)/NAK_TIMEOUT) /* should not take 1 minute a page! */

#ifndef USB_PRINTER_MAJOR
-#define USB_PRINTER_MAJOR 0
+#define USB_PRINTER_MAJOR 63
#endif

static int mymajor = USB_PRINTER_MAJOR;
@@ -179,16 +180,19 @@
}
result = p->pusb_dev->bus->op->bulk_msg(p->pusb_dev,
usb_sndbulkpipe(p->pusb_dev, 1), obuf, thistime, &partial);
+ if (partial) {
+ obuf += partial;
+ thistime -= partial;
+ maxretry = MAX_RETRY_COUNT;
+ }
if (result == USB_ST_TIMEOUT) { /* NAK - so hold for a while */
if(!maxretry--)
return -ETIME;
interruptible_sleep_on_timeout(&p->wait_q, NAK_TIMEOUT);
continue;
- } else if (!result & partial) {
- obuf += partial;
- thistime -= partial;
- } else
+ } else if (!result && !partial) {
break;
+ }
};
if (result) {
/* whoops - let's reset and fail the request */
@@ -255,9 +259,10 @@
/*
* FIXME - this will not cope with combined printer/scanners
*/
- if (dev->descriptor.bDeviceClass != 7 ||
+ if ((dev->descriptor.bDeviceClass != 7 &&
+ dev->descriptor.bDeviceClass != 0) ||
dev->descriptor.bNumConfigurations != 1 ||
dev->config[0].bNumInterfaces != 1) {
return -1;
}

-- 
I'm really pavel@ucw.cz. Look at http://195.113.31.123/~pavel.  Pavel
Hi! I'm a .signature virus! Copy me into your ~/.signature, please!

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/