Bluetooth via uart with hciattach?

I am using QN9021 SoC working in controller mode (BLE Bluetooth v4.0 kernel specification). It supports some standard HCI commands, as well as some vendor-specific commands. I am trying to connect it to an ubuntu laptop.

The hciattach command I hciattach .

 hciattach -s 9600 /dev/ttyUSBx any 9600 noflow nosleep 

While hcidump displayed while executing sudo hciconfig hci1 up .

 HCI sniffer - Bluetooth packet analyzer ver 5.37 device: hci1 snap_len: 1500 filter: 0xffffffffffffffff > HCI Event: Command Complete (0x0e) plen 12 Read Local Supported Features (0x04|0x0003) ncmd 11 status 0x00 Features: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 > HCI Event: Command Complete (0x0e) plen 12 Read Local Version Information (0x04|0x0001) ncmd 11 status 0x00 HCI Version: 4.0 (0x6) HCI Revision: 0x400 LMP Version: 4.0 (0x6) LMP Subversion: 0x400 Manufacturer: Quintic Corp. (142) > HCI Event: Command Complete (0x0e) plen 10 Read BD ADDR (0x04|0x0009) ncmd 11 status 0x00 bdaddr 08:7C:BE:3E:34:BB > HCI Event: Command Complete (0x0e) plen 11 Read Buffer Size (0x04|0x0005) ncmd 11 status 0x00 ACL MTU 0:0 SCO MTU 0:0 > HCI Event: Command Complete (0x0e) plen 4 Read Class of Device (0x03|0x0023) ncmd 11 status 0x01 class 0x000000 Error: Unknown HCI Command 

The hciconfig command shows:

 hci1: Type: BR/EDR Bus: UART BD Address: 08:7C:BE:3E:34:BB ACL MTU: 0:0 SCO MTU: 0:0 DOWN RX bytes:192 acl:0 sco:0 events:15 errors:0 TX bytes:60 acl:0 sco:0 commands:15 errors:0 hci0: Type: BR/EDR Bus: USB BD Address: C4:8E:8F:66:3B:0E ACL MTU: 820:8 SCO MTU: 255:16 UP RUNNING PSCAN RX bytes:2457 acl:0 sco:0 events:196 errors:0 TX bytes:24646 acl:0 sco:0 commands:196 errors:0 

I would like to know how to prevent the kernel or some bluetooth kernel module from sending unsupported HCI commands. Do I need to fix the source code of the Linux kernel or write a module for my SoC.

Note. - Changing this SoC or writing firmware to support all the necessary commands for this project is impossible.


EDIT:

I know the list of HCI commands supported by my SoC. I am thinking of creating a module to report that the kernel and daemons work to send only supported commands to the SoC. I am looking at the source of the Linux kernel (in particular, hci_core.c ). I think that changing it can solve the problem after going through this link . In this link, some developers have provided a patch for bluetooth dongle support. The patch prevents the hci_core.c file from sending a specific HCI command to a key of a specific manufacturer.

All I want is a proposal to solve this problem. Do I need to modify the Linux kernel or write a module for my SoC?

NOTE. - The application will run on openwrt linux.

+7
linux bluetooth hci kernel-module bluez
source share
1 answer

Ok, today we figured out a solution:

 # hciattach -r /dev/ttyS0 bcsp 115200 

Maybe this helps someone

Useful Tips: Let this link help you.

I will give two links for more details and for bluetooth click here and for kernel configuration click here

+1
source share

All Articles