On Thu, 7 Jun 2007, Steinar H. Gunderson wrote:

> On Thu, Jun 07, 2007 at 01:14:45PM +0200, Clemens Ladisch wrote:
> > Try the attached patch.
> 
> It seems to work well, at least in my limited tests. I've been using it
> together with this patch to make usbaudio.c understand low-speed devices:

> Is this reasonably sane, or is a more thorough fix (differentiating better
> between low- and full-speed devices) needed for a final patch?


You'll need more than this.  For the device to work at all, usbcore has 
to be told that the endpoint is interrupt rather than bulk.  There are 
enough buggy low-speed devices out there that we might want to add 
this patch.

Alan Stern


Index: usb-2.6/drivers/usb/core/config.c
===================================================================
--- usb-2.6.orig/drivers/usb/core/config.c
+++ usb-2.6/drivers/usb/core/config.c
@@ -124,6 +124,21 @@ static int usb_parse_endpoint(struct dev
                endpoint->desc.bInterval = n;
        }
 
+       /* Some buggy low-speed devices have Bulk endpoints, which is
+        * explicitly forbidden by the USB spec.  In an attempt to make
+        * them usable, we will try treating them as Interrupt endpoints.
+        */
+       if (to_usb_device(ddev)->speed == USB_SPEED_LOW &&
+                       usb_endpoint_xfer_bulk(d)) {
+               dev_warn(ddev, "config %d interface %d altsetting %d "
+                   "endpoint 0x%X is Bulk; changing to Interrupt\n",
+                   cfgno, inum, asnum, d->bEndpointAddress);
+               endpoint->desc.bmAttributes = USB_ENDPOINT_XFER_INT;
+               endpoint->desc.bInterval = 1;
+               if (le16_to_cpu(endpoint->desc.wMaxPacketSize) > 8)
+                       endpoint->desc.wMaxPacketSize = cpu_to_le16(8);
+       }
+
        /* Skip over any Class Specific or Vendor Specific descriptors;
         * find the next endpoint or interface descriptor */
        endpoint->extra = buffer;


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to