ChangeSet 1.2000.6.16, 2004/10/20 16:14:05-07:00, [EMAIL PROTECTED]

[PATCH] USB: usb hub descriptor fetch needs retries

Some of the recent changes to change how descriptors are read have managed
to confuse one USB keyboard.  It recovers OK with a few retries though.

Signed-off-by: David Brownell <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>


 drivers/usb/core/hub.c |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)


diff -Nru a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
--- a/drivers/usb/core/hub.c    2004-10-22 16:14:26 -07:00
+++ b/drivers/usb/core/hub.c    2004-10-22 16:14:26 -07:00
@@ -78,9 +78,17 @@
 /* USB 2.0 spec Section 11.24.4.5 */
 static int get_hub_descriptor(struct usb_device *hdev, void *data, int size)
 {
-       return usb_control_msg(hdev, usb_rcvctrlpipe(hdev, 0),
-               USB_REQ_GET_DESCRIPTOR, USB_DIR_IN | USB_RT_HUB,
-               USB_DT_HUB << 8, 0, data, size, HZ * USB_CTRL_GET_TIMEOUT);
+       int i, ret;
+
+       for (i = 0; i < 3; i++) {
+               ret = usb_control_msg(hdev, usb_rcvctrlpipe(hdev, 0),
+                       USB_REQ_GET_DESCRIPTOR, USB_DIR_IN | USB_RT_HUB,
+                       USB_DT_HUB << 8, 0, data, size,
+                       HZ * USB_CTRL_GET_TIMEOUT);
+               if (ret >= (USB_DT_HUB_NONVAR_SIZE + 2))
+                       return ret;
+       }
+       return -EINVAL;
 }
 
 /*



-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to