Messages in this thread Patch in this message | | | Date | Tue, 15 Jun 1999 11:30:58 +0200 | From | Pavel Machek <> | Subject | making usb printer work |
| |
Hi!
USB printer currently does not work for me: There's compile problem in there, detection does not detect my printer cable and if I make it work, it loops printing the same text all over. Here's patch which fixes it. (It also moves printer out into experimental range, which is much better than using MAJOR=0).
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; } --- clean/drivers/usb/usb-core.c Tue Jun 15 11:25:37 1999 +++ linux/drivers/usb/usb-core.c Tue Jun 15 10:02:22 1999 @@ -53,7 +53,7 @@ usb_acm_init(); # endif # ifdef CONFIG_USB_PRINTER - usb_print_init(); + usb_printer_init(); # endif # ifdef CONFIG_USB_CPIA usb_cpia_init();
-- I'm really pavel@ucw.cz. Look at http://www.suse.cz/development. 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/
| |