How to claim only some of USB interfaces of a composite USB
device
geoffrey levand
geoffrey.levand at mail.ru
Sat Sep 29 09:25:38 UTC 2012
Hi,
thanks for the info, it helped me to find a solution but not sure if it's a proper one.
Here is the patch i used to fix the problem on FreeBSD 9.1.
Index: sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c
===================================================================
--- sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c (revision 240846)
+++ sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c (working copy)
@@ -439,6 +439,7 @@
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 };
@@ -555,9 +556,16 @@
}
/* 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);
+ for (i = 1; (iface = usbd_get_iface(uaa->device, i)) != NULL; i ++) {
+ id = usbd_get_interface_descriptor(iface);
+ if (id && (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:
============================= EOF =======================================
regards
Mon, 24 Sep 2012 18:20:07 +0200 от Hans Petter Selasky <hselasky at c2i.net>:
>
>
>
>
>On Sunday 23 September 2012 16:30:53 geoffrey levand wrote:
>
> Hi,
>
>
>
> i have the following problem.
>
> I have a composite USB device with multiple USB interfaces. Some of
>
> interfaces belong to the Bluetooth device and other to the WLAN device.
>
> The problem is i want my WLAN driver to claim only the interfaces which
>
> belong to the WLAN device. But ng_ubt kernel driver claims all interfaces
>
> for itself beginning with the interface 0. Therefore, my WLAN driver
>
> doesn't work if ng_ubt is loaded first.
>
>
>
> The second question is, why FreeBSD USB stack calls the match callback of
>
> my WLAN driver only once with USB interface index 0. Shouldn't it call the
>
> match callback for each interface on a USB device ? Linux kernel e.g. does
>
> it per USB interface.
>
>
>
> regards
>
>
Hi,
>
>
If the interfaces are parented to another interface, they are not probed.
>
>
Read the UBT specification at usb.org and provide a patch that will only grab
>
bluetooth interfaces.
>
>
--HPS
>
_______________________________________________
>
>freebsd-hackers at freebsd.org mailing list
>
>http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
>
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe at freebsd.org"
>
>
>
More information about the freebsd-hackers
mailing list