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.
This commit is contained in:
Josef Karthauser 2002-04-07 10:57:42 +00:00
parent 6b0ff5f596
commit bcfc7cc136
2 changed files with 22 additions and 2 deletions

View file

@ -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)

View file

@ -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);