tech-kern archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: USB Bluetooth (ubt) detection on MacBook Air 11 inch (mid 2012)
Hi,
From: Iain Hibbert <plunky%rya-online.net@localhost>, Date: Tue, 2 Oct 2012
11:34:41 +0100 (BST)
> On Tue, 2 Oct 2012, Ryo ONODERA wrote:
>
>> Hi,
>>
>> As mentioned in PR kern/46992, USB Bluetooth device on MacBook Air 5,1
>> reports wrong uaa->class value in ubt_match function,
>> so 0xff (UDCLASS_VENDOR) instead of correct 0xe0 (UDCLASS_WIRELESS).
>>
>> To identify it as ubt(4) device, I want to introduce the following
>> mechanism.
>>
>> Any opinion and suggestion?
>
>> +/*
>> + * Some device returns wrong class (UDCLASS_VENDOR).
>> + * To force to detect, Add
>> + * { VendorID, ProductID }
>> + * to the ubt_force_detect list.
>> + */
>> +static const struct usb_devno ubt_force_detect[] = {
>
> this structure is traditionally named like "ubt_devs"
>
>> + if (usb_lookup(ubt_force_detect, uaa->vendor, uaa->product))
>> + return UMATCH_DEVCLASS_DEVSUBCLASS_DEVPROTO;
>
> and should be UMATCH_VENDOR_PRODUCT for this
>
> however, it might be worth just merging this with ubt_ignore structure, eg
> something like
>
> const struct ubt_devno {
> struct usb_devno devno;
> int match;
> } usb_dev[] = {
> { { USB_VENDOR_BROADCOM, USB_PRODUCT_BROADCOM_BCM2033NF },
> UMATCH_NONE },
> { { USB_VENDOR_APPLE, USB_PRODUCT_APPLE_BLUETOOTH_HOST_C },
> UMATCH_VENDOR_PRODUCT },
> };
>
> #define ubt_lookup(vendor, product) ((const struct ubt_devno
> *)usb_lookup(ubt_dev, vendor, product))
>
> strucdt ubt_devno *dev;
>
> if ((dev = ubt_lookup(uaa->vendor, uaa->product)) != NULL)
> return dev->match;
Thanks for your review.
How about these?
Index: usbdevs
===================================================================
RCS file: /cvsroot/src/sys/dev/usb/usbdevs,v
retrieving revision 1.627
diff -u -r1.627 usbdevs
--- usbdevs 23 Sep 2012 01:06:31 -0000 1.627
+++ usbdevs 2 Oct 2012 11:48:51 -0000
@@ -843,6 +843,7 @@
product APPLE IPAD 0x129a Apple iPad
product APPLE ETHERNET 0x1402 Apple USB to Ethernet
product APPLE BLUETOOTH2 0x8205 Bluetooth
+product APPLE BLUETOOTH_HOST_C 0x821f Bluetooth USB Host Controller
product APPLE BLUETOOTH 0x8300 Bluetooth
/* ArkMicroChips products */
Index: ubt.c
===================================================================
RCS file: /cvsroot/src/sys/dev/usb/ubt.c,v
retrieving revision 1.48
diff -u -r1.48 ubt.c
--- ubt.c 2 Jun 2012 21:36:45 -0000 1.48
+++ ubt.c 2 Oct 2012 11:48:51 -0000
@@ -305,26 +305,34 @@
static void ubt_abortdealloc(struct ubt_softc *);
/*
- * Match against the whole device, since we want to take
- * both interfaces. If a device should be ignored then add
+ * To match or ignore forcibly, add
*
- * { VendorID, ProductID }
+ * { { VendorID, ProductID } , UMATCH_VENDOR_PRODUCT|UMATCH_NONE }
*
- * to the ubt_ignore list.
+ * to the ubt_dev list.
*/
-static const struct usb_devno ubt_ignore[] = {
- { USB_VENDOR_BROADCOM, USB_PRODUCT_BROADCOM_BCM2033NF },
+const struct ubt_devno {
+ struct usb_devno devno;
+ int match;
+} ubt_dev[] = {
+ { { USB_VENDOR_BROADCOM, USB_PRODUCT_BROADCOM_BCM2033NF },
+ UMATCH_NONE },
+ { { USB_VENDOR_APPLE, USB_PRODUCT_APPLE_BLUETOOTH_HOST_C },
+ UMATCH_VENDOR_PRODUCT },
};
+#define ubt_lookup(vendor, product) \
+ ((const struct ubt_devno *)usb_lookup(ubt_dev, vendor, product))
int
ubt_match(device_t parent, cfdata_t match, void *aux)
{
struct usb_attach_arg *uaa = aux;
+ const struct ubt_devno *dev;
DPRINTFN(50, "ubt_match\n");
- if (usb_lookup(ubt_ignore, uaa->vendor, uaa->product))
- return UMATCH_NONE;
+ if ((dev = ubt_lookup(uaa->vendor, uaa->product)) != NULL)
+ return dev->match;
if (uaa->class == UDCLASS_WIRELESS
&& uaa->subclass == UDSUBCLASS_RF
--
Ryo ONODERA // ryo_on%yk.rim.or.jp@localhost
PGP fingerprint = 82A2 DC91 76E0 A10A 8ABB FD1B F404 27FA C7D1 15F3
Home |
Main Index |
Thread Index |
Old Index