Bluetooth Over Uart Using Hciattach

Bluetooth over uart using hciattach?

I have solved this problem few years back. I was using Linux version 4.4.14 and Bluez stack 5.38. Looks like QN9021 had some bugs. The problem wasn't with Read Class of Device but with the response given by QN9021 for the command: Read Local Supported Features. Since, it's the BLE controller chip, it shouldn't be sending Features: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 as the response to the above command.

The issue is kernel detects it as Classic Bluetooth controller chip and then sends non-supported HCI commands to the chip. The chip should have set the 5th and 6th bits (LMP_NO_BREDR and LMP_LE bits) of the 4th byte in the Features to the command Read Local Supported Features and then kernel detects it as a BLE controller mode chip and won't send any unsupported commands to a ble controller mode chip.

Since, I can't change the firmware of the chip, I had to patch the kernel.

Here are my patches:

*** hci_event.c 2017-02-10 00:05:13.149974000 +0530
--- bluetooth/hci_event.c 2016-06-24 22:48:38.000000000 +0530
***************
*** 588,597 ****
if (rp->status)
return;

-
memcpy(hdev->features, rp->features, 8);
- hdev->features[0][4] |= LMP_NO_BREDR;
- hdev->features[0][4] |= LMP_LE;

/* Adjust default settings according to features
* supported by device. */
--- 588,594 ----

I have also tired the following command but it didn't helped:

hciattach -r /dev/ttyS0 bcsp 115200

bluetooth device over USB using hciattach

I found for USB BT device case, i don't need to attach the device, as i used to do it in UART devices case (./hciattach /dev/ttyS1 any 115200).
hciconfig identifies, device without hciattach. we just need to do "./hciconfig up" to make BT device run.
Thanks.



Related Topics



Leave a reply



Submit