Commit 5cbab4cd authored by David Brownell's avatar David Brownell Committed by Greg Kroah-Hartman

[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: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
parent bbb09330
...@@ -78,9 +78,17 @@ static inline struct device *hubdev (struct usb_device *hdev) ...@@ -78,9 +78,17 @@ static inline struct device *hubdev (struct usb_device *hdev)
/* USB 2.0 spec Section 11.24.4.5 */ /* USB 2.0 spec Section 11.24.4.5 */
static int get_hub_descriptor(struct usb_device *hdev, void *data, int size) static int get_hub_descriptor(struct usb_device *hdev, void *data, int size)
{ {
return usb_control_msg(hdev, usb_rcvctrlpipe(hdev, 0), 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_REQ_GET_DESCRIPTOR, USB_DIR_IN | USB_RT_HUB,
USB_DT_HUB << 8, 0, data, size, HZ * USB_CTRL_GET_TIMEOUT); USB_DT_HUB << 8, 0, data, size,
HZ * USB_CTRL_GET_TIMEOUT);
if (ret >= (USB_DT_HUB_NONVAR_SIZE + 2))
return ret;
}
return -EINVAL;
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment