diff options
Diffstat (limited to 'sys/dev/usb')
-rw-r--r-- | sys/dev/usb/uhub.c | 9 | ||||
-rw-r--r-- | sys/dev/usb/usb.c | 11 | ||||
-rw-r--r-- | sys/dev/usb/usbdivar.h | 4 |
3 files changed, 19 insertions, 5 deletions
diff --git a/sys/dev/usb/uhub.c b/sys/dev/usb/uhub.c index 56033142051..0aa3c6129eb 100644 --- a/sys/dev/usb/uhub.c +++ b/sys/dev/usb/uhub.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uhub.c,v 1.27 2004/12/09 11:49:55 dlg Exp $ */ +/* $OpenBSD: uhub.c,v 1.28 2004/12/12 05:17:40 dlg 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 $ */ @@ -295,6 +295,7 @@ USB_ATTACH(uhub) else up->power = USB_MIN_POWER; up->restartcnt = 0; + up->reattach = 0; } /* XXX should check for none, individual, or ganged power? */ @@ -412,7 +413,7 @@ uhub_explore(usbd_device_handle dev) usbd_status err; int speed; int port; - int change, status; + int change, status, reconnect; DPRINTFN(10, ("uhub_explore dev=%p addr=%d\n", dev, dev->address)); @@ -425,6 +426,8 @@ uhub_explore(usbd_device_handle dev) for(port = 1; port <= hd->bNbrPorts; port++) { up = &dev->hub->ports[port-1]; + reconnect = up->reattach; + up->reattach = 0; err = usbd_get_port_status(dev, port, &up->status); if (err) { DPRINTF(("uhub_explore: get port status failed, " @@ -459,7 +462,7 @@ uhub_explore(usbd_device_handle dev) USBDEVNAME(sc->sc_dev), port); } } - if (!(change & UPS_C_CONNECT_STATUS)) { + if (!reconnect && !(change & UPS_C_CONNECT_STATUS)) { DPRINTFN(3,("uhub_explore: port=%d !C_CONNECT_" "STATUS\n", port)); /* No status change, just do recursive explore. */ diff --git a/sys/dev/usb/usb.c b/sys/dev/usb/usb.c index 6d7f6d242b9..b5aa2161c6b 100644 --- a/sys/dev/usb/usb.c +++ b/sys/dev/usb/usb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: usb.c,v 1.29 2004/07/08 22:18:44 deraadt Exp $ */ +/* $OpenBSD: usb.c,v 1.30 2004/12/12 05:17:40 dlg Exp $ */ /* $NetBSD: usb.c,v 1.77 2003/01/01 00:10:26 thorpej Exp $ */ /* @@ -672,6 +672,15 @@ usb_needs_explore(usbd_device_handle dev) wakeup(&dev->bus->needs_explore); } +void +usb_needs_reattach(usbd_device_handle dev) +{ + DPRINTFN(2,("usb_needs_reattach\n")); + dev->powersrc->reattach = 1; + dev->bus->needs_explore = 1; + wakeup(&dev->bus->needs_explore); +} + /* Called at splusb() */ int usb_get_next_event(struct usb_event *ue) diff --git a/sys/dev/usb/usbdivar.h b/sys/dev/usb/usbdivar.h index be9534447f7..70537942206 100644 --- a/sys/dev/usb/usbdivar.h +++ b/sys/dev/usb/usbdivar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: usbdivar.h,v 1.20 2004/12/09 11:49:55 dlg Exp $ */ +/* $OpenBSD: usbdivar.h,v 1.21 2004/12/12 05:17:40 dlg Exp $ */ /* $NetBSD: usbdivar.h,v 1.70 2002/07/11 21:14:36 augustss Exp $ */ /* $FreeBSD: src/sys/dev/usb/usbdivar.h,v 1.11 1999/11/17 22:33:51 n_hibma Exp $ */ @@ -80,6 +80,7 @@ struct usbd_port { u_int8_t portno; u_int8_t restartcnt; #define USBD_RESTART_MAX 5 + u_int8_t reattach; struct usbd_device *device; /* Connected device */ struct usbd_device *parent; /* The ports hub */ }; @@ -260,6 +261,7 @@ void usb_disconnect_port(struct usbd_port *up, device_ptr_t); /* Routines from usb.c */ void usb_needs_explore(usbd_device_handle); +void usb_needs_reattach(usbd_device_handle); void usb_schedsoftintr(struct usbd_bus *); /* |