Subject: Re: Belkin Bluetooth vs aue vs ubt
To: Stephen Borrill <netbsd@precedence.co.uk>
From: Jason Thorpe <thorpej@shagadelic.org>
List: tech-kern
Date: 03/07/2007 12:46:42
On Mar 7, 2007, at 11:28 AM, Stephen Borrill wrote:
> On Wed, 7 Mar 2007, Greg Troxel wrote:
> [aue attaches to a ubt device]
>> > Shall I look at adding a quirk for this device in if_aue.c that
>> will
>> > check the product class before attaching?
>>
>> That sounds sensible. It seems highly buggy of belkin to reuse the
>> product id.
>
> How about this patch?
Should be the other way around! ubt should avoid matching non-
UDPROTO_BLUETOOTH devices!
>
>
> Index: dev/usb/if_aue.c
> ===================================================================
> RCS file: /cvsroot/src/sys/dev/usb/if_aue.c,v
> retrieving revision 1.100
> diff -u -r1.100 if_aue.c
> --- dev/usb/if_aue.c 4 Mar 2007 06:02:47 -0000 1.100
> +++ dev/usb/if_aue.c 7 Mar 2007 19:20:04 -0000
> @@ -165,6 +165,7 @@
> #define LSYS 0x0001 /* use Linksys reset */
> #define PNA 0x0002 /* has Home PNA */
> #define PII 0x0004 /* Pegasus II chip */
> +#define UBT 0x0008 /* May be a Bluetooth ubt(4) device */
> };
>
> Static const struct aue_type aue_devs[] = {
> @@ -187,7 +188,7 @@
> {{ USB_VENDOR_ADMTEK, USB_PRODUCT_ADMTEK_PEGASUSII_2}, PII },
> {{ USB_VENDOR_ADMTEK, USB_PRODUCT_ADMTEK_PEGASUSII_3}, PII },
> {{ USB_VENDOR_AEI, USB_PRODUCT_AEI_USBTOLAN}, PII },
> - {{ USB_VENDOR_BELKIN, USB_PRODUCT_BELKIN_USB2LAN},
> PII },
> + {{ USB_VENDOR_BELKIN, USB_PRODUCT_BELKIN_USB2LAN}, PII|
> UBT },
> {{ USB_VENDOR_BILLIONTON, USB_PRODUCT_BILLIONTON_USB100},
> 0 },
> {{ USB_VENDOR_BILLIONTON, USB_PRODUCT_BILLIONTON_USBLP100}, PNA },
> {{ USB_VENDOR_BILLIONTON, USB_PRODUCT_BILLIONTON_USBEL100}, 0 },
> @@ -712,12 +713,25 @@
> USB_MATCH(aue)
> {
> USB_MATCH_START(aue, uaa);
> + const struct aue_type *type;
>
> if (uaa->iface != NULL)
> return (UMATCH_NONE);
>
> - return (aue_lookup(uaa->vendor, uaa->product) != NULL ?
> - UMATCH_VENDOR_PRODUCT : UMATCH_NONE);
> + type = aue_lookup(uaa->vendor, uaa->product);
> + if (type == NULL)
> + return (UMATCH_NONE);
> + + if (type->aue_flags & UBT) {
> + usb_device_descriptor_t *dd;
> + dd = usbd_get_device_descriptor(uaa->device);
> + if (dd != NULL
> + && dd->bDeviceClass == UDCLASS_WIRELESS
> + && dd->bDeviceSubClass == UDSUBCLASS_RF
> + && dd->bDeviceProtocol == UDPROTO_BLUETOOTH)
> + return (UMATCH_NONE);
> + }
> + return (UMATCH_VENDOR_PRODUCT);
> }
>
> /*
>
> --
> Stephen
-- thorpej