On Sun, 27 Feb 2005, Gerd v. Egidy wrote:

> I'll report what happens when I play around with the hardware but maybe
> you have another good patch for me to try out...

I take back what I said earlier -- seeing why the port resets sometimes 
failed might indeed be useful.  Can you duplicate the failure, but this 
time with CONFIG_USB_DEBUG set?

Also, I do have a patch that's been sitting around for a while, intended
to fix a problem that would occasionally cause a port reset to fail (what
a coincidence!).  It may need a little adjusting on your part like the
other patches did.  Go try it out, and if you still get a reset failure
please send the kernel log.  But regardless of how this patch works, do 
send the kernel log showing what happens without it.

Alan Stern



diff -u a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
--- a/drivers/usb/core/hub.c    Sun Feb 27 13:23:15 2005
+++ b/drivers/usb/core/hub.c    Sun Feb 27 13:30:15 2005
@@ -2643,6 +2643,8 @@
 
                /* deal with port status changes */
                for (i = 1; i <= hub->descriptor->bNbrPorts; i++) {
+                       if (test_bit(i, hub->busy_bits))
+                               continue;
                        connect_change = test_bit(i, hub->change_bits);
                        if (!test_and_clear_bit(i, hub->event_bits) &&
                                        !connect_change && !hub->activating)
@@ -2948,6 +2950,7 @@
                hub_pre_reset(hub);
        }
 
+       set_bit(port1, parent_hub->busy_bits);
        for (i = 0; i < SET_CONFIG_TRIES; ++i) {
 
                /* ep0 maxpacket size may change; let the HCD know about it.
@@ -2957,6 +2960,7 @@
                if (ret >= 0)
                        break;
        }
+       clear_bit(port1, parent_hub->busy_bits);
        if (ret < 0)
                goto re_enumerate;
  
diff -u a/drivers/usb/core/hub.h b/drivers/usb/core/hub.h
--- a/drivers/usb/core/hub.h    Sun Feb 27 13:23:15 2005
+++ b/drivers/usb/core/hub.h    Sun Feb 27 13:30:15 2005
@@ -205,6 +205,7 @@
        unsigned long           event_bits[1];  /* status change bitmask */
        unsigned long           change_bits[1]; /* ports with logical connect
                                                        status change */
+       unsigned long           busy_bits[1];   /* ports being reset */
 #if USB_MAXCHILDREN > 31 /* 8*sizeof(unsigned long) - 1 */
 #error event_bits[] is too short!
 #endif



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to