Try harder to get initial descriptor. Do a port reset now and then
in the retry loop.
This commit is contained in:
parent
4d6e985752
commit
7cdc2658bb
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: usb_subr.c,v 1.106 2003/09/23 21:44:42 mycroft Exp $ */
|
||||
/* $NetBSD: usb_subr.c,v 1.107 2004/01/05 13:32:23 augustss Exp $ */
|
||||
/* $FreeBSD: src/sys/dev/usb/usb_subr.c,v 1.18 1999/11/17 22:33:47 n_hibma Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -39,7 +39,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.106 2003/09/23 21:44:42 mycroft Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.107 2004/01/05 13:32:23 augustss Exp $");
|
||||
|
||||
#include "opt_usbverbose.h"
|
||||
|
||||
|
@ -980,6 +980,7 @@ usbd_new_device(device_ptr_t parent, usbd_bus_handle bus, int depth,
|
|||
usbd_device_handle dev;
|
||||
struct usbd_device *hub;
|
||||
usb_device_descriptor_t *dd;
|
||||
usb_port_status_t ps;
|
||||
usbd_status err;
|
||||
int addr;
|
||||
int i;
|
||||
|
@ -1036,12 +1037,14 @@ usbd_new_device(device_ptr_t parent, usbd_bus_handle bus, int depth,
|
|||
up->device = dev;
|
||||
dd = &dev->ddesc;
|
||||
/* Try a few times in case the device is slow (i.e. outside specs.) */
|
||||
for (i = 0; i < 3; i++) {
|
||||
for (i = 0; i < 10; 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;
|
||||
usbd_delay_ms(dev, 200);
|
||||
if ((i & 3) == 3)
|
||||
usbd_reset_port(up->parent, port, &ps);
|
||||
}
|
||||
if (err) {
|
||||
DPRINTFN(-1, ("usbd_new_device: addr=%d, getting first desc "
|
||||
|
|
Loading…
Reference in New Issue