summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjoe <joe@FreeBSD.org>2002-04-07 10:57:42 +0000
committerjoe <joe@FreeBSD.org>2002-04-07 10:57:42 +0000
commit9d6a2093f55450413fd69735d99d0305a57178c6 (patch)
tree44a882861d82317c9f791fb37e223432f3789aa3
parent8823e26b953e91a0ca9a92f9f4834d9a3d1e1d7e (diff)
downloadFreeBSD-src-9d6a2093f55450413fd69735d99d0305a57178c6.zip
FreeBSD-src-9d6a2093f55450413fd69735d99d0305a57178c6.tar.gz
MFNetBSD: uhub.c (1.54), usb_subr.c (1.92)
date: 2001/11/16 01:57:47; author: augustss; Handle devices that disappear during reset gracefully.
-rw-r--r--sys/dev/usb/uhub.c19
-rw-r--r--sys/dev/usb/usb_subr.c5
2 files changed, 22 insertions, 2 deletions
diff --git a/sys/dev/usb/uhub.c b/sys/dev/usb/uhub.c
index 8234ba1..5f7d510 100644
--- a/sys/dev/usb/uhub.c
+++ b/sys/dev/usb/uhub.c
@@ -1,4 +1,4 @@
-/* $NetBSD: uhub.c,v 1.52 2001/10/26 17:53:59 augustss Exp $ */
+/* $NetBSD: uhub.c,v 1.54 2001/11/16 01:57:47 augustss Exp $ */
/* $FreeBSD$ */
/*
@@ -443,6 +443,23 @@ uhub_explore(usbd_device_handle 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: device disappeared on port %d\n",
+ USBDEVNAME(sc->sc_dev), port);
+#endif
+ continue;
+ }
/* Figure out device speed */
if (status & UPS_HIGH_SPEED)
diff --git a/sys/dev/usb/usb_subr.c b/sys/dev/usb/usb_subr.c
index e962a7d..a151027 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.90 2001/11/10 17:11:38 augustss Exp $ */
+/* $NetBSD: usb_subr.c,v 1.92 2001/11/16 01:57:47 augustss Exp $ */
/* $FreeBSD$ */
/*
@@ -351,6 +351,9 @@ usbd_reset_port(usbd_device_handle dev, int port, usb_port_status_t *ps)
err));
return (err);
}
+ /* If the device disappeared, just give up. */
+ if (!(UGETW(ps->wPortStatus) & UPS_CURRENT_CONNECT_STATUS))
+ return (USBD_NORMAL_COMPLETION);
} while ((UGETW(ps->wPortChange) & UPS_C_PORT_RESET) == 0 && --n > 0);
if (n == 0)
return (USBD_TIMEOUT);
OpenPOWER on IntegriCloud