Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 30 Sep 2012 19:31:20 +0000 (UTC)
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r241078 - head/sys/netgraph/bluetooth/drivers/ubt
Message-ID:  <201209301931.q8UJVKfD099403@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201209301931.q8UJVKfD099403>