From 7cdc2658bbdfb5ce3df58ccbef8752b2db786208 Mon Sep 17 00:00:00 2001 From: augustss Date: Mon, 5 Jan 2004 13:32:23 +0000 Subject: [PATCH] Try harder to get initial descriptor. Do a port reset now and then in the retry loop. --- sys/dev/usb/usb_subr.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sys/dev/usb/usb_subr.c b/sys/dev/usb/usb_subr.c index fb705eb21e2b..01fc5dbaa6ea 100644 --- a/sys/dev/usb/usb_subr.c +++ b/sys/dev/usb/usb_subr.c @@ -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 -__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 "