diff options
author | hselasky <hselasky@FreeBSD.org> | 2012-09-30 19:31:20 +0000 |
---|---|---|
committer | hselasky <hselasky@FreeBSD.org> | 2012-09-30 19:31:20 +0000 |
commit | 5685c823b4b32560623055be41f10ae72cdd7286 (patch) | |
tree | e2505aad4ae2fb67680f3251d6124c62651ce545 /sys/netgraph/bluetooth | |
parent | 762446dfda7606d33eb082ae1014d69d432255a3 (diff) | |
download | FreeBSD-src-5685c823b4b32560623055be41f10ae72cdd7286.zip FreeBSD-src-5685c823b4b32560623055be41f10ae72cdd7286.tar.gz |
The USB Bluetooth driver should only grab its own interfaces. This allows the
USB bluetooth driver to co-exist with other USB device classes and drivers.
Reported by: Geoffrey Levand
MFC after: 1 week
Diffstat (limited to 'sys/netgraph/bluetooth')
-rw-r--r-- | sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c b/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c index a7fa2af..44654d2 100644 --- a/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c +++ b/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c @@ -439,6 +439,7 @@ ubt_attach(device_t dev) struct ubt_softc *sc = device_get_softc(dev); struct usb_endpoint_descriptor *ed; struct usb_interface_descriptor *id; + struct usb_interface *iface; uint16_t wMaxPacketSize; uint8_t alt_index, i, j; uint8_t iface_index[2] = { 0, 1 }; @@ -554,10 +555,21 @@ ubt_attach(device_t dev) goto detach; } - /* Claim all interfaces on the device */ - for (i = 1; usbd_get_iface(uaa->device, i) != NULL; i ++) - usbd_set_parent_iface(uaa->device, i, uaa->info.bIfaceIndex); - + /* Claim all interfaces belonging to the Bluetooth part */ + for (i = 1;; i++) { + iface = usbd_get_iface(uaa->device, i); + if (iface == NULL) + break; + id = usbd_get_interface_descriptor(iface); + + if ((id != NULL) && + (id->bInterfaceClass == UICLASS_WIRELESS) && + (id->bInterfaceSubClass == UISUBCLASS_RF) && + (id->bInterfaceProtocol == UIPROTO_BLUETOOTH)) { + usbd_set_parent_iface(uaa->device, i, + uaa->info.bIfaceIndex); + } + } return (0); /* success */ detach: |