summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFederico G. Schwindt <fgsch@cvs.openbsd.org>2009-01-14 21:02:58 +0000
committerFederico G. Schwindt <fgsch@cvs.openbsd.org>2009-01-14 21:02:58 +0000
commit3c4ab45c714e36d77860d1e108ee5a4cad30b6f9 (patch)
treefc3cd6ec9bbbb5b5ce58ccaf4662bc80a6df2f03
parent56e2b9637e2479d9b0ca2750ddd8e02ca4672072 (diff)
cap device's speed to the parent's one if higher. from FreeBSD.
krw@ miod@ ok.
-rw-r--r--sys/dev/usb/usb_subr.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/sys/dev/usb/usb_subr.c b/sys/dev/usb/usb_subr.c
index 61f452bc2a0..e7db9d9ac54 100644
--- a/sys/dev/usb/usb_subr.c
+++ b/sys/dev/usb/usb_subr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: usb_subr.c,v 1.72 2008/11/24 15:12:00 yuo Exp $ */
+/* $OpenBSD: usb_subr.c,v 1.73 2009/01/14 21:02:57 fgsch Exp $ */
/* $NetBSD: usb_subr.c,v 1.103 2003/01/10 11:19:13 augustss Exp $ */
/* $FreeBSD: src/sys/dev/usb/usb_subr.c,v 1.18 1999/11/17 22:33:47 n_hibma Exp $ */
@@ -1049,6 +1049,17 @@ usbd_new_device(struct device *parent, usbd_bus_handle bus, int depth,
dev->myhub = up->parent;
up->device = dev;
+
+ if (up->parent && speed > up->parent->speed) {
+ DPRINTF(("%s: maximum speed of attached device, "
+ "%d, is higher than speed of parent hub, %d\n",
+ __func__, speed, up->parent->speed));
+ /*
+ * Reduce the speed, otherwise we won't setup the
+ * proper transfer methods.
+ */
+ speed = up->parent->speed;
+ }
/* Locate port on upstream high speed hub */
for (adev = dev, hub = up->parent;