【发布时间】:2017-06-16 03:16:40
【问题描述】:
我正在使用QN9021 SoC 在controller mode(BLE 蓝牙核心规范 v4.0)中工作。它支持一些标准的HCI 命令以及一些供应商特定的命令。我正在尝试将它附加到我的ubuntu 笔记本电脑中。
我使用的命令是hciattach。
hciattach -s 9600 /dev/ttyUSBx any 9600 noflow nosleep
hcidump 在执行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
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 编写模块。
注意:- 此项目无法更改 SoC 或为其编写固件以支持所有必要的命令。
编辑:
我知道我的 SoC 支持的HCIcommand 列表。我正在考虑创建一个module 来告诉内核和运行的守护程序只向 SoC 发送支持的命令。我看了一下 linux 内核源代码(特别是在这个hci_core.c)。我认为修改它可能会在经历此link 后解决问题。在这个链接中,一些开发者提供了一个补丁来支持bluetooth dongle。该补丁可防止hci_core.c 文件向特定制造商的加密狗发送特定的 HCI 命令。
我想要的只是解决这个问题的建议。我需要修改 linux 内核或为我的 SoC 编写模块吗?
注意:- 应用程序将在 openwrt linux 上运行。
【问题讨论】:
标签: linux bluetooth kernel-module bluez hci