diff options
author | 2003-07-08 13:19:08 +0000 | |
---|---|---|
committer | 2003-07-08 13:19:08 +0000 | |
commit | 72a1125168988cf1eb2d7671325a4507a24a1d24 (patch) | |
tree | 296962f93d7ea3f169ef1e502b32e548a227b960 /sys/dev/usb/uhub.c | |
parent | - fix some lists and displays (diff) | |
download | wireguard-openbsd-72a1125168988cf1eb2d7671325a4507a24a1d24.tar.xz wireguard-openbsd-72a1125168988cf1eb2d7671325a4507a24a1d24.zip |
Sync USB code with NetBSD.
This includes numerous fixes and paves the way for usb 2.0 support.
Diffstat (limited to 'sys/dev/usb/uhub.c')
-rw-r--r-- | sys/dev/usb/uhub.c | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/sys/dev/usb/uhub.c b/sys/dev/usb/uhub.c index 293831e59a1..626bd0d62f7 100644 --- a/sys/dev/usb/uhub.c +++ b/sys/dev/usb/uhub.c @@ -1,5 +1,5 @@ -/* $OpenBSD: uhub.c,v 1.20 2003/05/19 04:17:53 nate Exp $ */ -/* $NetBSD: uhub.c,v 1.52 2001/10/26 17:53:59 augustss Exp $ */ +/* $OpenBSD: uhub.c,v 1.21 2003/07/08 13:19:09 nate 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 $ */ /* @@ -68,7 +68,7 @@ #ifdef UHUB_DEBUG #define DPRINTF(x) if (uhubdebug) logprintf x #define DPRINTFN(n,x) if (uhubdebug>(n)) logprintf x -int uhubdebug; +int uhubdebug = 0; #else #define DPRINTF(x) #define DPRINTFN(n,x) @@ -99,11 +99,16 @@ Static bus_child_detached_t uhub_child_detached; #if defined(__NetBSD__) || defined(__OpenBSD__) USB_DECLARE_DRIVER(uhub); +#if defined(__NetBSD__) /* Create the driver instance for the hub connected to hub case */ +CFATTACH_DECL(uhub_uhub, sizeof(struct uhub_softc), + uhub_match, uhub_attach, uhub_detach, uhub_activate); +#else struct cfattach uhub_uhub_ca = { sizeof(struct uhub_softc), uhub_match, uhub_attach, uhub_detach, uhub_activate }; +#endif #elif defined(__FreeBSD__) USB_DECLARE_DRIVER_INIT(uhub, DEVMETHOD(bus_child_detached, uhub_child_detached)); @@ -324,6 +329,7 @@ uhub_explore(usbd_device_handle dev) struct uhub_softc *sc = dev->hub->hubsoftc; struct usbd_port *up; usbd_status err; + int speed; int port; int change, status; @@ -446,10 +452,16 @@ uhub_explore(usbd_device_handle dev) continue; } + /* Figure out device speed */ + if (status & UPS_HIGH_SPEED) + speed = USB_SPEED_HIGH; + else if (status & UPS_LOW_SPEED) + speed = USB_SPEED_LOW; + else + speed = USB_SPEED_FULL; /* Get device info and set its address. */ err = usbd_new_device(USBDEV(sc->sc_dev), dev->bus, - dev->depth + 1, status & UPS_LOW_SPEED, - port, up); + dev->depth + 1, speed, port, up); /* XXX retry a few times? */ if (err) { DPRINTFN(-1,("uhub_explore: usb_new_device failed, " @@ -488,7 +500,6 @@ uhub_activate(device_ptr_t self, enum devact act) switch (act) { case DVACT_ACTIVATE: return (EOPNOTSUPP); - break; case DVACT_DEACTIVATE: if (hub == NULL) /* malfunctioning hub */ |