Author: hselasky
Date: Sun Sep 30 19:31:20 2012
New Revision: 241078
URL: http://svn.freebsd.org/changeset/base/241078

Log:
  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

Modified:
  head/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c

Modified: head/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c
==============================================================================
--- head/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c    Sun Sep 30 17:33:30 
2012        (r241077)
+++ head/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c    Sun Sep 30 19:31:20 
2012        (r241078)
@@ -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:
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to