aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/core/message.c
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2007-08-20 10:45:28 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2007-08-22 17:27:58 -0400
commitc39772d82ad453647ea4bf9d793010d86ef5e597 (patch)
treebfdaa9b8685672794204c32bc77197b4f5d54db9 /drivers/usb/core/message.c
parent3b79cc26708bcc476d4e4bf3846032fa3a1eeb85 (diff)
USB: allow retry on descriptor fetch errors
This patch (as964) was suggested by Steffen Koepf. It makes usb_get_descriptor() retry on all errors other than ETIMEDOUT, instead of only on EPIPE. This helps with some devices. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> CC: stable <stable@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/core/message.c')
-rw-r--r--drivers/usb/core/message.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c
index b6bd05e3d43..5498506e9c5 100644
--- a/drivers/usb/core/message.c
+++ b/drivers/usb/core/message.c
@@ -637,12 +637,12 @@ int usb_get_descriptor(struct usb_device *dev, unsigned char type, unsigned char
637 memset(buf,0,size); // Make sure we parse really received data 637 memset(buf,0,size); // Make sure we parse really received data
638 638
639 for (i = 0; i < 3; ++i) { 639 for (i = 0; i < 3; ++i) {
640 /* retry on length 0 or stall; some devices are flakey */ 640 /* retry on length 0 or error; some devices are flakey */
641 result = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), 641 result = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0),
642 USB_REQ_GET_DESCRIPTOR, USB_DIR_IN, 642 USB_REQ_GET_DESCRIPTOR, USB_DIR_IN,
643 (type << 8) + index, 0, buf, size, 643 (type << 8) + index, 0, buf, size,
644 USB_CTRL_GET_TIMEOUT); 644 USB_CTRL_GET_TIMEOUT);
645 if (result == 0 || result == -EPIPE) 645 if (result <= 0 && result != -ETIMEDOUT)
646 continue; 646 continue;
647 if (result > 1 && ((u8 *)buf)[1] != type) { 647 if (result > 1 && ((u8 *)buf)[1] != type) {
648 result = -EPROTO; 648 result = -EPROTO;