diff options
author | 2014-11-23 12:19:08 +0000 | |
---|---|---|
committer | 2014-11-23 12:19:08 +0000 | |
commit | 791f0ea81adfc1ae97a9c40c782cd1ace0fbd31f (patch) | |
tree | 27bfda604f042eb7aeb578a57a445dd8aefd3e24 /sys/dev/usb/uhub.c | |
parent | Be less verbose when opening a pipe and print the endpoint & slot (diff) | |
download | wireguard-openbsd-791f0ea81adfc1ae97a9c40c782cd1ace0fbd31f.tar.xz wireguard-openbsd-791f0ea81adfc1ae97a9c40c782cd1ace0fbd31f.zip |
Revert the logic to skip ports which status hasn't changed, it introduces
a regression reported by ajacoutot@.
Diffstat (limited to 'sys/dev/usb/uhub.c')
-rw-r--r-- | sys/dev/usb/uhub.c | 47 |
1 files changed, 14 insertions, 33 deletions
diff --git a/sys/dev/usb/uhub.c b/sys/dev/usb/uhub.c index 46dc395f5f4..abec212b8a8 100644 --- a/sys/dev/usb/uhub.c +++ b/sys/dev/usb/uhub.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uhub.c,v 1.79 2014/11/20 10:24:09 mpi Exp $ */ +/* $OpenBSD: uhub.c,v 1.80 2014/11/23 12:19:08 mpi Exp $ */ /* $NetBSD: uhub.c,v 1.64 2003/02/08 03:32:51 ichiro Exp $ */ /* $FreeBSD: src/sys/dev/usb/uhub.c,v 1.18 1999/11/17 22:33:43 n_hibma Exp $ */ @@ -57,11 +57,8 @@ struct uhub_softc { struct device sc_dev; /* base device */ struct usbd_device *sc_hub; /* USB device */ struct usbd_pipe *sc_ipipe; /* interrupt pipe */ - - uint32_t sc_status; /* status from last interrupt */ - uint8_t *sc_statusbuf; /* per port status buffer */ - size_t sc_statuslen; /* status bufferlen */ - + u_int8_t *sc_statusbuf; /* per port status buffer */ + size_t sc_statuslen; /* status bufferlen */ u_char sc_running; }; #define UHUB_PROTO(sc) ((sc)->sc_hub->ddesc.bDeviceProtocol) @@ -324,8 +321,6 @@ uhub_attach(struct device *parent, struct device *self, void *aux) printf("%s: port %d power on failed, %s\n", sc->sc_dev.dv_xname, port, usbd_errstr(err)); - /* Make sure we check the port status at least once. */ - sc->sc_status |= (1 << port); } /* Wait for stable power. */ @@ -371,24 +366,18 @@ uhub_explore(struct usbd_device *dev) for (port = 1; port <= dev->hub->nports; port++) { up = &dev->hub->ports[port-1]; - + err = usbd_get_port_status(dev, port, &up->status); + if (err) { + DPRINTF("%s: get port %d status failed, error=%s\n", + sc->sc_dev.dv_xname, port, usbd_errstr(err)); + continue; + } + status = UGETW(up->status.wPortStatus); + change = UGETW(up->status.wPortChange); reconnect = up->reattach; up->reattach = 0; - change = 0; - status = 0; - - if ((sc->sc_status & (1 << port)) || reconnect) { - sc->sc_status &= ~(1 << port); - - if (usbd_get_port_status(dev, port, &up->status)) - continue; - - status = UGETW(up->status.wPortStatus); - change = UGETW(up->status.wPortChange); - DPRINTF("%s: port %d status=0x%04x change=0x%04x\n", - sc->sc_dev.dv_xname, port, status, change); - } - + DPRINTF("%s: port %d status=0x%04x change=0x%04x\n", + sc->sc_dev.dv_xname, port, status, change); if (change & UPS_C_PORT_ENABLED) { usbd_clear_port_feature(dev, port, UHF_C_PORT_ENABLE); if (change & UPS_C_CONNECT_STATUS) { @@ -421,7 +410,6 @@ uhub_explore(struct usbd_device *dev) /* We have a connect status change, handle it. */ usbd_clear_port_feature(dev, port, UHF_C_PORT_CONNECTION); - /* * If there is already a device on the port the change status * must mean that is has disconnected. Looking at the @@ -583,8 +571,6 @@ void uhub_intr(struct usbd_xfer *xfer, void *addr, usbd_status status) { struct uhub_softc *sc = addr; - uint32_t stats = 0; - int i; if (usbd_is_dying(sc->sc_hub)) return; @@ -593,11 +579,6 @@ uhub_intr(struct usbd_xfer *xfer, void *addr, usbd_status status) if (status == USBD_STALLED) usbd_clear_endpoint_stall_async(sc->sc_ipipe); - else if (status == USBD_NORMAL_COMPLETION) { - for (i = 0; i < xfer->actlen; i++) - stats |= (uint32_t)(xfer->buffer[i]) << (i * 8); - sc->sc_status |= stats; - + else if (status == USBD_NORMAL_COMPLETION) usb_needs_explore(sc->sc_hub, 0); - } } |