diff options
author | Nathan Binkert <nate@cvs.openbsd.org> | 2002-07-10 13:15:59 +0000 |
---|---|---|
committer | Nathan Binkert <nate@cvs.openbsd.org> | 2002-07-10 13:15:59 +0000 |
commit | c36b94b8cbe8fb1e3c00db87c7a491d9dbbf0835 (patch) | |
tree | fe9e0d2f09a0dc185c8d300b2649e0aa9044f97a | |
parent | 97628122cef1b1530e4cec8aaea117c653243e6c (diff) |
Handle resetting port better.
From NetBSD
-rw-r--r-- | sys/dev/usb/uhub.c | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/sys/dev/usb/uhub.c b/sys/dev/usb/uhub.c index 19c6acc0b10..c8422aa8a50 100644 --- a/sys/dev/usb/uhub.c +++ b/sys/dev/usb/uhub.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uhub.c,v 1.16 2002/05/07 18:29:18 nate Exp $ */ +/* $OpenBSD: uhub.c,v 1.17 2002/07/10 13:15:58 nate Exp $ */ /* $NetBSD: uhub.c,v 1.52 2001/10/26 17:53:59 augustss Exp $ */ /* $FreeBSD: src/sys/dev/usb/uhub.c,v 1.18 1999/11/17 22:33:43 n_hibma Exp $ */ @@ -268,6 +268,7 @@ USB_ATTACH(uhub) * For all ports * get port status * if device connected + * wait 100 ms * turn on reset * wait * clear C_PORT_RESET @@ -423,8 +424,25 @@ uhub_explore(usbd_device_handle dev) /* Reset port, which implies enabling it. */ if (usbd_reset_port(dev, port, &up->status)) { - printf("uhub_explore: port=%d reset failed\n", - port); + printf("%s: port %d reset failed\n", + USBDEVNAME(sc->sc_dev), port); + continue; + } + /* Get port status again, it might have changed during reset */ + err = usbd_get_port_status(dev, port, &up->status); + if (err) { + DPRINTF(("uhub_explore: get port status failed, " + "error=%s\n", usbd_errstr(err))); + continue; + } + status = UGETW(up->status.wPortStatus); + change = UGETW(up->status.wPortChange); + if (!(status & UPS_CURRENT_CONNECT_STATUS)) { + /* Nothing connected, just ignore it. */ +#ifdef DIAGNOSTIC + printf("%s: port %d, device disappeared after reset\n", + USBDEVNAME(sc->sc_dev), port); +#endif continue; } |