summaryrefslogtreecommitdiffstats
path: root/sys/dev/usb/uhub.c
diff options
context:
space:
mode:
authormpi <mpi@openbsd.org>2014-10-01 08:29:01 +0000
committermpi <mpi@openbsd.org>2014-10-01 08:29:01 +0000
commita7a5b35d1c2f22f27ddb3f51993f3aa9eef7ef80 (patch)
treef2042c1120c1c779d22a7dd1dfc3dd45e02a5e43 /sys/dev/usb/uhub.c
parentAdd the QLogic SCSI/FC drivers. (diff)
downloadwireguard-openbsd-a7a5b35d1c2f22f27ddb3f51993f3aa9eef7ef80.tar.xz
wireguard-openbsd-a7a5b35d1c2f22f27ddb3f51993f3aa9eef7ef80.zip
Check that the speed of a new device does not exceed its parent's speed
prior to calling usbd_new_device(). This will let us set the specified default Max Packet Size before opening the control pipe and reduces spaghetti! ok stsp@
Diffstat (limited to 'sys/dev/usb/uhub.c')
-rw-r--r--sys/dev/usb/uhub.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/sys/dev/usb/uhub.c b/sys/dev/usb/uhub.c
index f2176ff4413..7e54c5bb811 100644
--- a/sys/dev/usb/uhub.c
+++ b/sys/dev/usb/uhub.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uhub.c,v 1.73 2014/08/10 13:32:14 mpi Exp $ */
+/* $OpenBSD: uhub.c,v 1.74 2014/10/01 08:29:01 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 $ */
@@ -471,6 +471,13 @@ uhub_explore(struct usbd_device *dev)
speed = sc->sc_hub->speed;
}
+ /*
+ * Reduce the speed, otherwise we won't setup the proper
+ * transfer methods.
+ */
+ if (speed > sc->sc_hub->speed)
+ speed = sc->sc_hub->speed;
+
/* Get device info and set its address. */
err = usbd_new_device(&sc->sc_dev, dev->bus,
dev->depth + 1, speed, port, up);