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)



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;

regards,
iain


Home | Main Index | Thread Index | Old Index