From c081610de9c447caf8b6eb3137c7529f871ba3cb Mon Sep 17 00:00:00 2001 From: hselasky Date: Mon, 1 Oct 2012 05:42:43 +0000 Subject: Inherit USB mode from RootHUB port where the USB device is connected. Only RootHUB ports can be dual mode. Disallow OTG ports on external HUBs. This simplifies some checks in the USB controller drivers. MFC after: 1 week --- sys/dev/usb/usb_hub.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'sys/dev/usb/usb_hub.c') diff --git a/sys/dev/usb/usb_hub.c b/sys/dev/usb/usb_hub.c index 2f3dbe5..0686bdf 100644 --- a/sys/dev/usb/usb_hub.c +++ b/sys/dev/usb/usb_hub.c @@ -518,7 +518,10 @@ repeat: * * NOTE: This part is currently FreeBSD specific. */ - if (sc->sc_st.port_status & UPS_PORT_MODE_DEVICE) + if (udev->parent_hub != NULL) { + /* inherit mode from the parent HUB */ + mode = udev->parent_hub->flags.usb_mode; + } else if (sc->sc_st.port_status & UPS_PORT_MODE_DEVICE) mode = USB_MODE_DEVICE; else mode = USB_MODE_HOST; -- cgit v1.1