Trying to get the printer driver to work I ran across a small problem when
I forced it to probe for the uni-directional interface.  The probe
function assumed that the out endpoint was the first end point.  This
should be sensible but my HP doesn't make sense and has an in endpoint
first.  The attached patch fixes this assumption.

I still get extra random characters with the bidi interface unless I
comment out the submit read urb "usb_submit_urb(&usblp->readurb);" in
usblp_open().  It also works if I force the uni-directional interface.  

It looks to me that the read is just totally broken.  Not being very
familiar with this I'm not sure how to fix it.

T:  Bus=01 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#=  1 Spd=12  MxCh= 2
B:  Alloc=  0/900 us ( 0%), #Int=  0, #Iso=  0
D:  Ver= 1.00 Cls=09(hub  ) Sub=00 Prot=00 MxPS= 8 #Cfgs=  1
P:  Vendor=0000 ProdID=0000 Rev= 0.00
S:  Product=USB UHCI Root Hub
S:  SerialNumber=c800
C:* #Ifs= 1 Cfg#= 1 Atr=40 MxPwr=  0mA
I:  If#= 0 Alt= 0 #EPs= 1 Cls=09(hub  ) Sub=00 Prot=00 Driver=hub
E:  Ad=81(I) Atr=03(Int.) MxPS=   8 Ivl=255ms
T:  Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  2 Spd=12  MxCh= 0
D:  Ver= 1.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs=  1
P:  Vendor=03f0 ProdID=0304 Rev= 1.00
S:  Manufacturer=Hewlett-Packard 
S:  Product=DeskJet 810C
S:  SerialNumber=MY941110C6GI
C:* #Ifs= 1 Cfg#= 1 Atr=40 MxPwr=  2mA
I:  If#= 0 Alt= 0 #EPs= 2 Cls=07(print) Sub=01 Prot=01 Driver=(none)
E:  Ad=81(I) Atr=02(Bulk) MxPS=  64 Ivl=  0ms
E:  Ad=02(O) Atr=02(Bulk) MxPS=  64 Ivl=  0ms
I:  If#= 0 Alt= 1 #EPs= 2 Cls=07(print) Sub=01 Prot=02 Driver=(none)
E:  Ad=01(O) Atr=02(Bulk) MxPS=  64 Ivl=  0ms
E:  Ad=82(I) Atr=02(Bulk) MxPS=  64 Ivl=  0ms
T:  Bus=01 Lev=01 Prnt=01 Port=01 Cnt=02 Dev#=  3 Spd=1.5 MxCh= 0
D:  Ver= 1.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs=  1
P:  Vendor=04f2 ProdID=0002 Rev= 0.01
S:  Manufacturer=CHICONY
S:  Product=Keyboard NT68P81
C:* #Ifs= 1 Cfg#= 1 Atr=a0 MxPwr=100mA
I:  If#= 0 Alt= 0 #EPs= 1 Cls=03(HID  ) Sub=01 Prot=01 Driver=hid
E:  Ad=81(I) Atr=03(Int.) MxPS=   8 Ivl= 10ms


-- 
Brian F. Hensch
[EMAIL PROTECTED]
http://deskmedia.com/~bhensch
Home: (651)460-6696
Work: (651)687-7034
Fax:  (651)460-6286

--- linux/drivers/usb/printer.c.orig    Sat May 13 22:42:40 2000
+++ linux/drivers/usb/printer.c Sun May 14 22:22:38 2000
@@ -341,22 +341,25 @@
        if (usb_set_interface(dev, ifnum, alts))
                err("can't set desired altsetting %d on interface %d", alts, ifnum);
 
-       epwrite = interface->endpoint + 0;
-       epread = NULL;
+       for (i=0; i < interface->bNumEndpoints; i++) {
+               epwrite = interface->endpoint + i;
+               if ((epwrite->bEndpointAddress & 0x80) == 0)
+                       break;
+       }
 
-       if (bidir) {
-               epread  = interface->endpoint + 1;
-               if ((epread->bEndpointAddress & 0x80) != 0x80) {
-                       epwrite = interface->endpoint + 1;
-                       epread  = interface->endpoint + 0;
+       if ((epwrite->bEndpointAddress & 0x80) != 0)
+               return NULL;
 
-                       if ((epread->bEndpointAddress & 0x80) != 0x80)
-                               return NULL;
+       epread = NULL;
+       if (bidir) {
+               for (i=0; i < interface->bNumEndpoints; i++) {
+                       epread  = interface->endpoint + i;
+                       if ((epread->bEndpointAddress & 0x80) == 0x80)
+                               break;
                }
+               if ((epread->bEndpointAddress & 0x80) != 0x80)
+                       return NULL;
        }
-
-       if ((epwrite->bEndpointAddress & 0x80) == 0x80)
-               return NULL;
 
        for (minor = 0; minor < USBLP_MINORS && usblp_table[minor]; minor++);
        if (usblp_table[minor]) {
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to