summaryrefslogtreecommitdiffstats
path: root/sys/dev/usb/uhub.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/usb/uhub.c')
-rw-r--r--sys/dev/usb/uhub.c34
1 files changed, 21 insertions, 13 deletions
diff --git a/sys/dev/usb/uhub.c b/sys/dev/usb/uhub.c
index 015dce9..f8d9c2a 100644
--- a/sys/dev/usb/uhub.c
+++ b/sys/dev/usb/uhub.c
@@ -1,4 +1,4 @@
-/* $NetBSD: uhub.c,v 1.32 1999/10/13 08:10:56 augustss Exp $ */
+/* $NetBSD: uhub.c,v 1.34 1999/11/18 23:32:29 augustss Exp $ */
/* $FreeBSD$ */
/*
@@ -63,9 +63,9 @@
#include <dev/usb/usbdivar.h>
#ifdef UHUB_DEBUG
-#define DPRINTF(x) if (usbdebug) logprintf x
-#define DPRINTFN(n,x) if (usbdebug>(n)) logprintf x
-extern int usbdebug;
+#define DPRINTF(x) if (uhubdebug) logprintf x
+#define DPRINTFN(n,x) if (uhubdebug>(n)) logprintf x
+int uhubdebug;
#else
#define DPRINTF(x)
#define DPRINTFN(n,x)
@@ -81,7 +81,7 @@ struct uhub_softc {
static usbd_status uhub_init_port __P((struct usbd_port *));
static usbd_status uhub_explore __P((usbd_device_handle hub));
-static void uhub_intr __P((usbd_xfer_handle, usbd_private_handle, usbd_status));
+static void uhub_intr __P((usbd_xfer_handle, usbd_private_handle,usbd_status));
#if defined(__FreeBSD__)
static bus_child_detached_t uhub_child_detached;
@@ -95,7 +95,7 @@ static bus_child_detached_t uhub_child_detached;
*/
#if defined(__NetBSD__) || defined(__OpenBSD__)
-USB_DECLARE_DRIVER(uhub)
+USB_DECLARE_DRIVER(uhub);
/* Create the driver instance for the hub connected to hub case */
struct cfattach uhub_uhub_ca = {
@@ -236,7 +236,7 @@ USB_ATTACH(uhub)
}
err = usbd_open_pipe_intr(iface, ed->bEndpointAddress,
- USBD_SHORT_XFER_OK, &sc->sc_ipipe, sc, sc->sc_status,
+ USBD_SHORT_XFER_OK, &sc->sc_ipipe, sc, sc->sc_status,
sizeof(sc->sc_status), uhub_intr);
if (err) {
printf("%s: cannot open interrupt pipe\n",
@@ -364,9 +364,10 @@ uhub_explore(dev)
}
status = UGETW(up->status.wPortStatus);
change = UGETW(up->status.wPortChange);
- DPRINTFN(5, ("uhub_explore: port %d status 0x%04x 0x%04x\n",
- port, status, change));
+ DPRINTFN(3,("uhub_explore: port %d status 0x%04x 0x%04x\n",
+ port, status, change));
if (change & UPS_C_PORT_ENABLED) {
+ DPRINTF(("uhub_explore: C_PORT_ENABLED\n"));
usbd_clear_port_feature(dev, port, UHF_C_PORT_ENABLE);
if (status & UPS_PORT_ENABLED) {
printf("%s: illegal enable change, port %d\n",
@@ -386,6 +387,8 @@ uhub_explore(dev)
}
}
if (!(change & UPS_C_CONNECT_STATUS)) {
+ DPRINTFN(3,("uhub_explore: port=%d !C_CONNECT_"
+ "STATUS\n", port));
/* No status change, just do recursive explore. */
if (up->device && up->device->hub)
up->device->hub->explore(up->device);
@@ -405,14 +408,17 @@ uhub_explore(dev)
disco:
if (up->device != NULL) {
/* Disconnected */
- DPRINTF(("uhub_explore: device %d disappeared "
+ DPRINTF(("uhub_explore: device addr=%d disappeared "
"on port %d\n", up->device->address, port));
usb_disconnect_port(up, USBDEV(sc->sc_dev));
usbd_clear_port_feature(dev, port,
UHF_C_PORT_CONNECTION);
}
- if (!(status & UPS_CURRENT_CONNECT_STATUS))
+ if (!(status & UPS_CURRENT_CONNECT_STATUS)) {
+ DPRINTFN(3,("uhub_explore: port=%d !CURRENT_CONNECT"
+ "_STATUS\n", port));
continue;
+ }
/* Connected */
up->restartcnt = 0;
@@ -421,9 +427,11 @@ uhub_explore(dev)
usbd_delay_ms(dev, USB_PORT_POWERUP_DELAY);
/* Reset port, which implies enabling it. */
- if (usbd_reset_port(dev, port, &up->status) !=
- USBD_NORMAL_COMPLETION)
+ if (usbd_reset_port(dev, port, &up->status)) {
+ DPRINTF(("uhub_explore: port=%d reset failed\n",
+ port));
continue;
+ }
/* Get device info and set its address. */
err = usbd_new_device(USBDEV(sc->sc_dev), dev->bus,
OpenPOWER on IntegriCloud