2017-05-08 11:08:48

by Graham Gower

[permalink] [raw]
Subject: [PATCH] Bluetooth: btusb: set HCI_QUIRK_BROKEN_LOCAL_COMMANDS for 0x0a5c:0x21f3

Card labelled BCM943228HMB found in Lenovo X131e laptop.

$ usb-devices
...
T: Bus=02 Lev=02 Prnt=02 Port=04 Cnt=01 Dev#= 3 Spd=12 MxCh= 0
D: Ver= 2.00 Cls=ff(vend.) Sub=01 Prot=01 MxPS=64 #Cfgs= 1
P: Vendor=0a5c ProdID=21f3 Rev=01.12
S: Manufacturer=Broadcom Corp
S: Product=BCM20702A0
S: SerialNumber=B00594EAFD30
C: #Ifs= 4 Cfg#= 1 Atr=e0 MxPwr=0mA
I: If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=01 Prot=01 Driver=btusb
I: If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=btusb
I: If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=btusb
I: If#= 3 Alt= 0 #EPs= 0 Cls=fe(app. ) Sub=01 Prot=01 Driver=(none)
...

$ hcidump &hciconfig hci0 up
...
commands
< HCI Command: Set Event Mask Page 2 (0x03|0x0063) plen 8
Mask: 0x0000000000000000
> HCI Event: Command Complete (0x0e) plen 4
Set Event Mask Page 2 (0x03|0x0063) ncmd 1
status 0x01
Error: Unknown HCI Command
---
drivers/bluetooth/btusb.c | 8 ++++++++
1 file changed, 8 insertions(+)

diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index 7fa373b..7be8cf1 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -66,6 +66,7 @@ static struct usb_driver btusb_driver;
#define BTUSB_BCM2045 0x40000
#define BTUSB_IFNUM_2 0x80000
#define BTUSB_CW6622 0x100000
+#define BTUSB_BCM21F3 0x200000

static const struct usb_device_id btusb_table[] = {
/* Generic Bluetooth USB device */
@@ -127,6 +128,10 @@ static const struct usb_device_id btusb_table[] = {
/* Broadcom BCM20702A0 */
{ USB_DEVICE(0x413c, 0x8197) },

+ /* Broadcom BCM20702A0 */
+ { USB_DEVICE(0x0a5c, 0x21f3),
+ .driver_info = BTUSB_BCM21F3 | BTUSB_BCM_PATCHRAM },
+
/* Broadcom BCM20702B0 (Dynex/Insignia) */
{ USB_DEVICE(0x19ff, 0x0239), .driver_info = BTUSB_BCM_PATCHRAM },

@@ -2994,6 +2999,9 @@ static int btusb_probe(struct usb_interface *intf,
if (id->driver_info & BTUSB_BCM2045)
set_bit(HCI_QUIRK_BROKEN_STORED_LINK_KEY, &hdev->quirks);

+ if (id->driver_info & BTUSB_BCM21F3)
+ set_bit(HCI_QUIRK_BROKEN_LOCAL_COMMANDS, &hdev->quirks);
+
if (id->driver_info & BTUSB_BCM92035)
hdev->setup = btusb_setup_bcm92035;

--
2.9.0



2017-05-20 01:09:43

by Graham Gower

[permalink] [raw]
Subject: Re: [PATCH] Bluetooth: btusb: set HCI_QUIRK_BROKEN_LOCAL_COMMANDS for 0x0a5c:0x21f3

Hi Marcel,

I reverted my patch, then captured the btmon output while running
'hciconfig hci0 up'. I'm running kernel version 4.4.38. Please see
attached.

-Graham

On 18 May 2017 at 21:28, Marcel Holtmann <[email protected]> wrote:
> Hi Graham,
>
>> On May 8, 2017, at 13:08, Graham Gower <[email protected]> wrote:
>>
>> Card labelled BCM943228HMB found in Lenovo X131e laptop.
>>
>> $ usb-devices
>> ...
>> T: Bus=02 Lev=02 Prnt=02 Port=04 Cnt=01 Dev#= 3 Spd=12 MxCh= 0
>> D: Ver= 2.00 Cls=ff(vend.) Sub=01 Prot=01 MxPS=64 #Cfgs= 1
>> P: Vendor=0a5c ProdID=21f3 Rev=01.12
>> S: Manufacturer=Broadcom Corp
>> S: Product=BCM20702A0
>> S: SerialNumber=B00594EAFD30
>> C: #Ifs= 4 Cfg#= 1 Atr=e0 MxPwr=0mA
>> I: If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=01 Prot=01 Driver=btusb
>> I: If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=btusb
>> I: If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=btusb
>> I: If#= 3 Alt= 0 #EPs= 0 Cls=fe(app. ) Sub=01 Prot=01 Driver=(none)
>> ...
>>
>> $ hcidump &hciconfig hci0 up
>> ...
>> commands
>> < HCI Command: Set Event Mask Page 2 (0x03|0x0063) plen 8
>> Mask: 0x0000000000000000
>>> HCI Event: Command Complete (0x0e) plen 4
>> Set Event Mask Page 2 (0x03|0x0063) ncmd 1
>> status 0x01
>> Error: Unknown HCI Command
>
> can also capture the HCI Read Version Information, HCI Local Features and HCI Local Commands traces with btmon. I would prefer that we include them here.
>
> I want to check if this is the best fix or if we can do it in a more generic way.
>
> Regards
>
> Marcel
>


Attachments:
btmon-BCM20702A0-21f3.gz (65.98 kB)

2017-05-18 11:58:33

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [PATCH] Bluetooth: btusb: set HCI_QUIRK_BROKEN_LOCAL_COMMANDS for 0x0a5c:0x21f3

Hi Graham,

> On May 8, 2017, at 13:08, Graham Gower <[email protected]> wrote:
>
> Card labelled BCM943228HMB found in Lenovo X131e laptop.
>
> $ usb-devices
> ...
> T: Bus=02 Lev=02 Prnt=02 Port=04 Cnt=01 Dev#= 3 Spd=12 MxCh= 0
> D: Ver= 2.00 Cls=ff(vend.) Sub=01 Prot=01 MxPS=64 #Cfgs= 1
> P: Vendor=0a5c ProdID=21f3 Rev=01.12
> S: Manufacturer=Broadcom Corp
> S: Product=BCM20702A0
> S: SerialNumber=B00594EAFD30
> C: #Ifs= 4 Cfg#= 1 Atr=e0 MxPwr=0mA
> I: If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=01 Prot=01 Driver=btusb
> I: If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=btusb
> I: If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=btusb
> I: If#= 3 Alt= 0 #EPs= 0 Cls=fe(app. ) Sub=01 Prot=01 Driver=(none)
> ...
>
> $ hcidump &hciconfig hci0 up
> ...
> commands
> < HCI Command: Set Event Mask Page 2 (0x03|0x0063) plen 8
> Mask: 0x0000000000000000
>> HCI Event: Command Complete (0x0e) plen 4
> Set Event Mask Page 2 (0x03|0x0063) ncmd 1
> status 0x01
> Error: Unknown HCI Command

can also capture the HCI Read Version Information, HCI Local Features and HCI Local Commands traces with btmon. I would prefer that we include them here.

I want to check if this is the best fix or if we can do it in a more generic way.

Regards

Marcel


2017-06-10 07:49:03

by Graham Gower

[permalink] [raw]
Subject: Re: [PATCH] Bluetooth: btusb: set HCI_QUIRK_BROKEN_LOCAL_COMMANDS for 0x0a5c:0x21f3

Thanks Marcel,

It seems to do the correct things with your patch. See attached btmon
output.

-G



On 10 June 2017 at 02:20, Marcel Holtmann <[email protected]> wrote:

> Hi Graham,
>
> > I reverted my patch, then captured the btmon output while running
> > 'hciconfig hci0 up'. I'm running kernel version 4.4.38. Please see
> > attached.
>
> I just posted a patch that will skip the Set Event Mask Page 2 command in
> case nothing has to be modified. Maybe that will help you as well. Can you
> give a try.
>
> Regards
>
> Marcel
>
>


Attachments:
btmon-BCM20702A0-21f3-patched.gz (67.38 kB)

2017-06-09 16:50:35

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [PATCH] Bluetooth: btusb: set HCI_QUIRK_BROKEN_LOCAL_COMMANDS for 0x0a5c:0x21f3

Hi Graham,

> I reverted my patch, then captured the btmon output while running
> 'hciconfig hci0 up'. I'm running kernel version 4.4.38. Please see
> attached.

I just posted a patch that will skip the Set Event Mask Page 2 command in case nothing has to be modified. Maybe that will help you as well. Can you give a try.

Regards

Marcel