Hi,
If you have a USB device that, when plugged before booting, shows a
"device problem, disabling port" message, please test the diff below.
If you don't have such device, please test the diff below too.
Report any errors or changes to me.
Thanks,
f.-
Index: sys/dev/usb/usb_subr.c
===================================================================
RCS file: /cvs/src/sys/dev/usb/usb_subr.c,v
retrieving revision 1.64
diff -u -p -r1.64 usb_subr.c
--- sys/dev/usb/usb_subr.c 4 Nov 2007 05:52:36 -0000 1.64
+++ sys/dev/usb/usb_subr.c 15 May 2008 00:59:24 -0000
@@ -979,6 +979,7 @@ usbd_new_device(struct device *parent, u
usbd_device_handle dev, adev;
struct usbd_device *hub;
usb_device_descriptor_t *dd;
+ usb_port_status_t ps;
usbd_status err;
int addr;
int i;
@@ -1049,15 +1050,40 @@ usbd_new_device(struct device *parent, u
return (err);
}
+ /* Set the address. Do this early; some devices need that. */
+ /* Try a few times in case the device is slow (i.e. outside specs.) */
+ DPRINTFN(5,("usbd_new_device: setting device address=%d\n", addr));
+ for (i = 0; i < 15; i++) {
+ err = usbd_set_address(dev, addr);
+ if (!err)
+ break;
+ if ((i % 4) == 0)
+ usbd_reset_port(up->parent, port, &ps);
+ else
+ usbd_delay_ms(dev, 200);
+ }
+ if (err) {
+ DPRINTFN(-1,("usbd_new_device: set address %d failed\n", addr));
+ err = USBD_SET_ADDR_FAILED;
+ usbd_remove_device(dev, up);
+ return (err);
+ }
+ /* Allow device time to set new address */
+ usbd_delay_ms(dev, USB_SET_ADDRESS_SETTLE);
+ dev->address = addr; /* New device address now */
+ bus->devices[addr] = dev;
+
dd = &dev->ddesc;
/* Try a few times in case the device is slow (i.e. outside specs.) */
- for (i = 0; i < 5; i++) {
+ for (i = 0; i < 15; i++) {
/* Get the first 8 bytes of the device descriptor. */
err = usbd_get_desc(dev, UDESC_DEVICE, 0, USB_MAX_IPACKET, dd);
if (!err)
break;
- /* progressively increase the delay */
- usbd_delay_ms(dev, 200 * (i + 1));
+ if ((i % 4) == 0)
+ usbd_reset_port(up->parent, port, &ps);
+ else
+ usbd_delay_ms(dev, 200);
}
if (err) {
DPRINTFN(-1, ("usbd_new_device: addr=%d, getting first desc "
@@ -1106,21 +1132,6 @@ usbd_new_device(struct device *parent, u
usbd_remove_device(dev, up);
return (err);
}
-
- /* Set the address */
- DPRINTFN(5,("usbd_new_device: setting device address=%d\n", addr));
- err = usbd_set_address(dev, addr);
- if (err) {
- DPRINTFN(-1,("usbd_new_device: set address %d failed\n", addr));
- err = USBD_SET_ADDR_FAILED;
- usbd_remove_device(dev, up);
- return (err);
- }
- /* Allow device time to set new address */
- usbd_delay_ms(dev, USB_SET_ADDRESS_SETTLE);
-
- dev->address = addr; /* New device address now */
- bus->devices[addr] = dev;
/* Assume 100mA bus powered for now. Changed when configured. */
dev->power = USB_MIN_POWER;
| Bart Van Assche | Integration of SCST in the mainstream Linux kernel |
| Greg Kroah-Hartman | [PATCH 005/196] Chinese: add translation of SubmittingDrivers |
| David Miller | Re: 2.6.24-rc6-mm1: some section mismatches on sparc64 |
| S.Çağlar | Rescheduling interrupts |
git: | |
| Ken Pratt | pack operation is thrashing my server |
| Aaron Bentley | Re: VCS comparison table |
| Imran M Yousuf | Re: [kernel.org users] [RFD] On deprecating "git-foo" for builtins |
| しらいしななこ | Re: [ANNOUNCE] GIT 1.5.4 |
| Marco Peereboom | Re: Real men don't attack straw men |
| Marcos Laufer | dmesg IBM x3650 OpenBSD 4.3 |
| Kevin Neff | Patching a SSH 'Weakness' |
| Steve B | Intel Atom and D945GCLF2 |
| Jeff Garzik | Re: [bug?] tg3: Failed to load firmware "tigon/tg3_tso.bin" |
| David Miller | Re: [BUG] New Kernel Bugs |
| Arjan van de Ven | Re: [GIT]: Networking |
| David Miller | Re: [PATCH] pkt_sched: Destroy gen estimators under rtnl_lock(). |
