On Thursday 13 January 2005 10:04 am, Alan Stern wrote: > > Okay, here's a patch that looks pretty good to me. The only thing I'm not > sure about is that it may retry _too_ aggressively. If you like it I'll > submit it to Greg.
Looks OK to me too, except that if all the first three tries fail it still goes ahead and uses a bogus ep0 maxpacket size. (Maybe it should just go right to the other scheme?) Also, the changelog should highlight the switch to a more accommodating scheme for enumeration. (Probably worth doing that in a separate patch.) - Dave > Alan Stern > > > ===== drivers/usb/core/hub.c 1.223 vs edited ===== > --- 1.223/drivers/usb/core/hub.c 2005-01-11 12:14:56 -05:00 > +++ edited/drivers/usb/core/hub.c 2005-01-13 11:51:32 -05:00 > @@ -75,7 +75,7 @@ > MODULE_PARM_DESC(old_scheme_first, > "start with the old device initialization scheme"); > > -static int use_both_schemes = 0; > +static int use_both_schemes = 1; > module_param(use_both_schemes, bool, S_IRUGO | S_IWUSR); > MODULE_PARM_DESC(use_both_schemes, > "try the other device initialization scheme if the " > @@ -2180,24 +2180,35 @@ > retval = -ENOMEM; > continue; > } > - buf->bMaxPacketSize0 = 0; > > /* Use a short timeout the first time through, > * so that recalcitrant full-speed devices with > * 8- or 16-byte ep0-maxpackets won't slow things > * down tremendously by NAKing the unexpectedly > - * early status stage. Also, retry on length 0 > - * or stall; some devices are flakey. > + * early status stage. Also, retry on all errors; > + * some devices are flakey. > */ > for (j = 0; j < 3; ++j) { > + buf->bMaxPacketSize0 = 0; > r = usb_control_msg(udev, usb_rcvaddr0pipe(), > USB_REQ_GET_DESCRIPTOR, USB_DIR_IN, > USB_DT_DEVICE << 8, 0, > buf, GET_DESCRIPTOR_BUFSIZE, > (i ? HZ * USB_CTRL_GET_TIMEOUT : HZ)); > - if (r == 0 || r == -EPIPE) > - continue; > - if (r < 0) > + switch (buf->bMaxPacketSize0) { > + case 8: case 16: case 32: case 64: > + if (buf->bDescriptorType == > + USB_DT_DEVICE) { > + r = 0; > + break; > + } > + /* FALL THROUGH */ > + default: > + if (r == 0) > + r = -EPROTO; > + break; > + } > + if (r == 0) > break; > } > udev->descriptor.bMaxPacketSize0 = > @@ -2213,10 +2224,7 @@ > retval = -ENODEV; > goto fail; > } > - switch (udev->descriptor.bMaxPacketSize0) { > - case 64: case 32: case 16: case 8: > - break; > - default: > + if (r) { > dev_err(&udev->dev, "device descriptor " > "read/%s, error %d\n", > "64", r); > > ------------------------------------------------------- The SF.Net email is sponsored by: Beat the post-holiday blues Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt _______________________________________________ linux-usb-devel@lists.sourceforge.net To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel