summaryrefslogtreecommitdiff
path: root/sys/dev/usb/ehci.c
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2014-03-25 20:27:38 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2014-03-25 20:27:38 +0000
commit3392fd3119db5e6a9c63c934fed6faa4a1970f69 (patch)
tree331c9e0cad371dd7b79eb5d5920f8c497729a959 /sys/dev/usb/ehci.c
parenta3554f2ddd62572187d3fc11b3418c6377b332c4 (diff)
Instead of matching root hubs with a custom address, that only works
because USB_START_ADDR is defined to 0 and the softc is M_ZERO'd, assume that root hubs are the only devices with a depth of 0. Root hubs can now happily be detached and reattached.
Diffstat (limited to 'sys/dev/usb/ehci.c')
-rw-r--r--sys/dev/usb/ehci.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/sys/dev/usb/ehci.c b/sys/dev/usb/ehci.c
index 5f232d43654..195e0caef31 100644
--- a/sys/dev/usb/ehci.c
+++ b/sys/dev/usb/ehci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ehci.c,v 1.145 2014/03/15 09:49:28 mpi Exp $ */
+/* $OpenBSD: ehci.c,v 1.146 2014/03/25 20:27:37 mpi Exp $ */
/* $NetBSD: ehci.c,v 1.66 2004/06/30 03:11:56 mycroft Exp $ */
/*
@@ -1460,8 +1460,8 @@ ehci_open(struct usbd_pipe *pipe)
int ival, speed, naks;
int hshubaddr, hshubport;
- DPRINTFN(1, ("ehci_open: pipe=%p, addr=%d, endpt=%d (%d)\n",
- pipe, addr, ed->bEndpointAddress, sc->sc_addr));
+ DPRINTFN(1, ("ehci_open: pipe=%p, addr=%d, endpt=%d\n",
+ pipe, addr, ed->bEndpointAddress));
if (sc->sc_bus.dying)
return (USBD_IOERROR);
@@ -1474,7 +1474,8 @@ ehci_open(struct usbd_pipe *pipe)
hshubport = 0;
}
- if (addr == sc->sc_addr) {
+ /* Root Hub */
+ if (pipe->device->depth == 0) {
switch (ed->bEndpointAddress) {
case USB_CONTROL_ENDPOINT:
pipe->methods = &ehci_root_ctrl_methods;
@@ -2025,7 +2026,6 @@ ehci_root_ctrl_start(struct usbd_xfer *xfer)
err = USBD_IOERROR;
goto ret;
}
- sc->sc_addr = value;
break;
case C(UR_SET_CONFIG, UT_WRITE_DEVICE):
if (value != 0 && value != 1) {