使用hciattach在uart上进行蓝牙? [英] Bluetooth over uart using hciattach?
问题描述
我正在使用在controller mode
(BLE蓝牙核心规范v4.0)中运行的QN9021
SoC.它支持某些标准HCI
命令以及某些供应商特定的命令.我正在尝试将其连接到我的ubuntu
笔记本电脑中.
I am using QN9021
SoC working in controller mode
(BLE Bluetooth core specification v4.0). It supports some standard HCI
commands as well as some vendor specific commands. I am trying to attach it in my ubuntu
laptop.
我使用的命令是hciattach
.
hciattach -s 9600 /dev/ttyUSBx any 9600 noflow nosleep
在执行sudo hciconfig hci1 up
时显示hcidump
.
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
hciconfig
命令显示:
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
我想知道如何防止内核或某些蓝牙内核模块发送不支持的HCI命令.我需要修补linux内核源代码还是为SoC编写模块.
I would like to know how to prevent the kernel or some bluetooth kernel module to send non-supported HCI commands. Do i need to patch linux kernel source code or write a module for my SoC.
注意:-此项目无法更改SoC或为其编写固件以支持所有必要的命令.
Note:- Changing the SoC or writing firmware for it to support all necessary commands is not possible for this project.
我知道我的SoC支持的HCI
命令列表.我正在考虑创建一个module
来告诉正在运行的内核和守护程序仅将支持的命令发送到SoC.我看了一下Linux内核源代码(特别是在 hci_core.c 上) .我认为修改此链接可能会解决此链接之后的问题.在此链接中,一些开发人员提供了一个补丁来支持bluetooth dongle
.该补丁可防止 hci_core.c 文件将特定的HCI命令发送到特定制造商的加密狗.
I know the list of HCI
command supported by my SoC. I am thinking of creating a module
to tell the kernel and daemons running to send only supported commands to the SoC. I have a look at linux kernel source (specifically at this hci_core.c). I think modifying it may solve the problem after going through this link. In this link, some developer has provided a patch to support a bluetooth dongle
. The patch prevents the hci_core.c file to send a specific HCI command to a dongle of a particular manufacturer.
我只想提出解决此问题的建议.我需要修改linux内核或为SoC编写模块吗?
All i want is suggestion to resolve this problem. Do i need to modify the linux kernel or write a module for my SoC?
注意:-该应用程序将在openwrt
linux上运行.
NOTE:- The application will run on openwrt
linux.
推荐答案
好的,今天我们找到了解决方案:
Okay, today we found out the solution:
# hciattach -r /dev/ttyS0 bcsp 115200
也许对某人有帮助
有用的提示:可以此链接会为您提供帮助.
Helpful Tips:May this link will be helps to you.
I will give two links for more details and for bluetooth click here and for kernel configuration click here
这篇关于使用hciattach在uart上进行蓝牙?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!