Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 29 Sep 2012 13:25:21 +0400
From:      =?UTF-8?B?Z2VvZmZyZXkgbGV2YW5k?= <geoffrey.levand@mail.ru>
To:        =?UTF-8?B?SGFucyBQZXR0ZXIgU2VsYXNreQ==?= <hselasky@c2i.net>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re[2]: How to claim only some of USB interfaces of a composite USB device
Message-ID:  <1348910721.385146900@f89.mail.ru>
In-Reply-To: <201209241820.07558.hselasky@c2i.net>
References:  <1348410653.373800982@f180.mail.ru> <201209241820.07558.hselasky@c2i.net>

index | next in thread | previous in thread | raw e-mail

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@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@freebsd.org mailing list
>
>http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
>
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"
>
>			
		
		
	

	
>


help

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