On 6 Jun 2004, Stephen Evanchik wrote:

> Linux 2.6.7-rc2
> 
> Plug in device:
> 
> uhci_hcd 0000:00:1d.1: wakeup_hc
> uhci_hcd 0000:00:1d.1: port 2 portsc 0082
> hub 2-0:1.0: port 2, status 0100, change 0001, 12 Mb/s
> uhci_hcd 0000:00:1d.1: port 2 portsc 0093
> hub 2-0:1.0: port 2, status 0101, change 0001, 12 Mb/s
> hub 2-0:1.0: debounce: port 2: delay 100ms stable 4 status 0x101
> usb 2-2: new full speed USB device using address 2
> usb 2-2: device descriptor read/all, error 0
> usb 2-2: new full speed USB device using address 3
> usb 2-2: device descriptor read/all, error 0

This looks like a logic error in the usb_get_descriptor routine.  I'm not
sure when that routine was last changed; it might have been during the
transitions for 2.6.5 to 2.6.6.  Does this patch help?

Alan Stern



--- usb-2.6/drivers/usb/core/message.c  Fri Jun  4 09:59:16 2004
+++ usb-2.6/drivers/usb/core/message.c  Sun Jun  6 16:43:22 2004
@@ -566,18 +566,18 @@
  */
 int usb_get_descriptor(struct usb_device *dev, unsigned char type, unsigned char 
index, void *buf, int size)
 {
-       int i = 3;
+       int i;
        int result;
        
        memset(buf,0,size);     // Make sure we parse really received data
 
-       while (i--) {
+       for (i = 0; i < 3; ++i) {
                /* retry on length 0 or stall; some devices are flakey */
-               if ((result = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0),
-                                   USB_REQ_GET_DESCRIPTOR, USB_DIR_IN,
-                                   (type << 8) + index, 0, buf, size,
-                                   HZ * USB_CTRL_GET_TIMEOUT)) > 0
-                               || result != -EPIPE)
+               result = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0),
+                               USB_REQ_GET_DESCRIPTOR, USB_DIR_IN,
+                               (type << 8) + index, 0, buf, size,
+                               HZ * USB_CTRL_GET_TIMEOUT);
+               if (!(result == 0 || result == -EPIPE))
                        break;
        }
        return result;



-------------------------------------------------------
This SF.Net email is sponsored by the new InstallShield X.
>From Windows to Linux, servers to mobile, InstallShield X is the one
installation-authoring solution that does it all. Learn more and
evaluate today! http://www.installshield.com/Dev2Dev/0504
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to