summaryrefslogtreecommitdiff
path: root/sys/dev/usb
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/usb')
-rw-r--r--sys/dev/usb/uhub.c17
-rw-r--r--sys/dev/usb/usb.h3
-rw-r--r--sys/dev/usb/usbdi_util.c15
-rw-r--r--sys/dev/usb/usbdi_util.h3
4 files changed, 34 insertions, 4 deletions
diff --git a/sys/dev/usb/uhub.c b/sys/dev/usb/uhub.c
index 7bb3c30a0cb..fa4d5d710d1 100644
--- a/sys/dev/usb/uhub.c
+++ b/sys/dev/usb/uhub.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uhub.c,v 1.75 2014/11/01 14:44:08 mpi Exp $ */
+/* $OpenBSD: uhub.c,v 1.76 2014/11/07 13:56:29 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 $ */
@@ -140,6 +140,21 @@ uhub_attach(struct device *parent, struct device *self, void *aux)
return;
}
+ /*
+ * Super-Speed hubs need to know their depth to be able to
+ * parse the bits of the route-string that correspond to
+ * their downstream port number.
+ *
+ * This does no apply to root hubs.
+ */
+ if (dev->depth != 0 && dev->speed == USB_SPEED_SUPER) {
+ if (usbd_set_hub_depth(dev, dev->depth - 1)) {
+ printf("%s: unable to set HUB depth\n",
+ sc->sc_dev.dv_xname);
+ return;
+ }
+ }
+
/* Get hub descriptor. */
if (dev->speed == USB_SPEED_SUPER) {
err = usbd_get_hub_ss_descriptor(dev, &hd.ss, 1);
diff --git a/sys/dev/usb/usb.h b/sys/dev/usb/usb.h
index a3808e6ef03..71a17b29996 100644
--- a/sys/dev/usb/usb.h
+++ b/sys/dev/usb/usb.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: usb.h,v 1.48 2014/11/01 14:04:27 mpi Exp $ */
+/* $OpenBSD: usb.h,v 1.49 2014/11/07 13:56:29 mpi Exp $ */
/* $NetBSD: usb.h,v 1.69 2002/09/22 23:20:50 augustss Exp $ */
/* $FreeBSD: src/sys/dev/usb/usb.h,v 1.14 1999/11/17 22:33:46 n_hibma Exp $ */
@@ -282,6 +282,7 @@ typedef struct {
#define UR_RESET_TT 0x09
#define UR_GET_TT_STATE 0x0a
#define UR_STOP_TT 0x0b
+#define UR_SET_DEPTH 0x0c
/* Hub features */
#define UHF_C_HUB_LOCAL_POWER 0
diff --git a/sys/dev/usb/usbdi_util.c b/sys/dev/usb/usbdi_util.c
index ba5d8e5bad2..bc8c8d29c84 100644
--- a/sys/dev/usb/usbdi_util.c
+++ b/sys/dev/usb/usbdi_util.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: usbdi_util.c,v 1.38 2014/08/08 14:20:05 mpi Exp $ */
+/* $OpenBSD: usbdi_util.c,v 1.39 2014/11/07 13:56:29 mpi Exp $ */
/* $NetBSD: usbdi_util.c,v 1.40 2002/07/11 21:14:36 augustss Exp $ */
/* $FreeBSD: src/sys/dev/usb/usbdi_util.c,v 1.14 1999/11/17 22:33:50 n_hibma Exp $ */
@@ -168,6 +168,19 @@ usbd_set_hub_feature(struct usbd_device *dev, int sel)
}
usbd_status
+usbd_set_hub_depth(struct usbd_device *dev, int depth)
+{
+ usb_device_request_t req;
+
+ req.bmRequestType = UT_WRITE_CLASS_DEVICE;
+ req.bRequest = UR_SET_DEPTH;
+ USETW(req.wValue, depth);
+ USETW(req.wIndex, 0);
+ USETW(req.wLength, 0);
+ return usbd_do_request(dev, &req, 0);
+}
+
+usbd_status
usbd_clear_port_feature(struct usbd_device *dev, int port, int sel)
{
usb_device_request_t req;
diff --git a/sys/dev/usb/usbdi_util.h b/sys/dev/usb/usbdi_util.h
index 85d8d884045..9b0c4c3d1b9 100644
--- a/sys/dev/usb/usbdi_util.h
+++ b/sys/dev/usb/usbdi_util.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: usbdi_util.h,v 1.27 2014/08/08 14:20:05 mpi Exp $ */
+/* $OpenBSD: usbdi_util.h,v 1.28 2014/11/07 13:56:29 mpi Exp $ */
/* $NetBSD: usbdi_util.h,v 1.28 2002/07/11 21:14:36 augustss Exp $ */
/* $FreeBSD: src/sys/dev/usb/usbdi_util.h,v 1.9 1999/11/17 22:33:50 n_hibma Exp $ */
@@ -36,6 +36,7 @@ usbd_status usbd_get_desc(struct usbd_device *dev, int type,
int index, int len, void *desc);
usbd_status usbd_get_port_status(struct usbd_device *,
int, usb_port_status_t *);
+usbd_status usbd_set_hub_depth(struct usbd_device *, int);
usbd_status usbd_set_hub_feature(struct usbd_device *dev, int);
usbd_status usbd_clear_hub_feature(struct usbd_device *, int);
usbd_status usbd_set_port_feature(struct usbd_device *dev, int, int);