我正在使用基于 RTL8822ce 芯片的 NVIDIA Jetson TX2 NX 和 WiFi-BT 模块。蓝牙可以打开并查看每个细节,但当开始扫描时,它不会列出附近的设备。
[NEW] Controller 70:66:55:A6:F4:72 BlueZ 5.48 [default]
Agent registered
[bluetooth]# show
Controller 70:66:55:A6:F4:72 (public)
Name: BlueZ 5.48
Alias: BlueZ 5.48
Class: 0x00000000
Powered: yes
Discoverable: no
Pairable: yes
UUID: Generic Attribute Profile (00001801-0000-1000-8000-00805f9b34fb)
UUID: PnP Information (00001200-0000-1000-8000-00805f9b34fb)
UUID: Generic Access Profile (00001800-0000-1000-8000-00805f9b34fb)
Modalias: usb:v1D6Bp0246d0530
Discovering: no
[bluetooth]# discoverable on
Changing discoverable on succeeded
[CHG] Controller 70:66:55:A6:F4:72 Discoverable: yes
[bluetooth]# show
Controller 70:66:55:A6:F4:72 (public)
Name: BlueZ 5.48
Alias: BlueZ 5.48
Class: 0x00000000
Powered: yes
Discoverable: yes
Pairable: yes
UUID: Generic Attribute Profile (00001801-0000-1000-8000-00805f9b34fb)
UUID: PnP Information (00001200-0000-1000-8000-00805f9b34fb)
UUID: Generic Access Profile (00001800-0000-1000-8000-00805f9b34fb)
Modalias: usb:v1D6Bp0246d0530
Discovering: no
[bluetooth]# scan on
Discovery started
[CHG] Controller 70:66:55:A6:F4:72 Discovering: yes
[bluetooth]# scan off
[CHG] Controller 70:66:55:A6:F4:72 Discovering: no
Discovery stopped
[bluetooth]# exit
Agent unregistered
[DEL] Controller 70:66:55:A6:F4:72 BlueZ 5.48 [default]
但是当我记录日志时,我注意到 HCI 命令顺序中存在一些问题。
root@localhost:/home/ASKC# btmon
Bluetooth monitor ver 5.48
= Note: Linux version 4.9.253-tegra (aarch64) 0.275592
= Note: Bluetooth subsystem version 2.22 0.275595
= New Index: 70:66:55:A6:F4:72 (Primary,USB,hci0) [hci0] 0.275596
= Open Index: 70:66:55:A6:F4:72 [hci0] 0.275597
= Index Info: 70:66:55:A6:F4:72 (Realtek Semiconductor Corporation) [hci0] 0.275598
@ MGMT Open: bluetoothd (privileged) version 1.14 {0x0002} 0.275599
@ MGMT Open: bluetoothd (privileged) version 1.14 {0x0001} 0.275601
@ MGMT Open: btmon (privileged) version 1.14 {0x0003} 0.275626
@ MGMT Command: Set Connectable (0x0007) plen 1 {0x0001} [hci0] 17.340311
Connectable: Enabled (0x01)
@ MGMT Event: Command Complete (0x0001) plen 7 {0x0001} [hci0] 17.340407
Set Connectable (0x0007) plen 4
Status: Success (0x00)
Current settings: 0x00000ad3
Powered
Connectable
Bondable
Secure Simple Pairing
BR/EDR
Low Energy
Secure Connections
@ MGMT Event: New Settings (0x0006) plen 4 {0x0003} [hci0] 17.340425
Current settings: 0x00000ad3
Powered
Connectable
Bondable
Secure Simple Pairing
BR/EDR
Low Energy
Secure Connections
@ MGMT Event: New Settings (0x0006) plen 4 {0x0002} [hci0] 17.340425
Current settings: 0x00000ad3
Powered
Connectable
Bondable
Secure Simple Pairing
BR/EDR
Low Energy
Secure Connections
@ MGMT Command: Set Discoverable (0x0006) plen 3 {0x0001} [hci0] 17.340628
Discoverable: General (0x01)
Timeout: 180
< HCI Command: Write Current IAC LAP (0x03|0x003a) plen 4 #1 [hci0] 17.340783
Number of IAC: 1
Access code: 0x9e8b33 (General Inquiry)
> HCI Event: Command Complete (0x0e) plen 4 #2 [hci0] 17.341793
Write Current IAC LAP (0x03|0x003a) ncmd 2
Status: Success (0x00)
< HCI Command: Write Scan Enable (0x03|0x001a) plen 1 #3 [hci0] 17.341914
Scan enable: Inquiry Scan + Page Scan (0x03)
> HCI Event: Command Complete (0x0e) plen 4 #4 [hci0] 17.342825
Write Scan Enable (0x03|0x001a) ncmd 2
Status: Success (0x00)
@ MGMT Event: Command Complete (0x0001) plen 7 {0x0001} [hci0] 17.342964
Set Discoverable (0x0006) plen 4
Status: Success (0x00)
Current settings: 0x00000adb
Powered
Connectable
Discoverable
Bondable
Secure Simple Pairing
BR/EDR
Low Energy
Secure Connections
@ MGMT Event: New Settings (0x0006) plen 4 {0x0003} [hci0] 17.343001
Current settings: 0x00000adb
Powered
Connectable
Discoverable
Bondable
Secure Simple Pairing
BR/EDR
Low Energy
Secure Connections
@ MGMT Event: New Settings (0x0006) plen 4 {0x0002} [hci0] 17.343001
Current settings: 0x00000adb
Powered
Connectable
Discoverable
Bondable
Secure Simple Pairing
BR/EDR
Low Energy
Secure Connections
@ MGMT Command: Start Discovery (0x0023) plen 1 {0x0001} [hci0] 30.352194
Address type: 0x07
BR/EDR
LE Public
LE Random
< HCI Command: LE Set Random Address (0x08|0x0005) plen 6 #5 [hci0] 30.352384
Address: 1D:0F:B3:73:FA:E7 (Non-Resolvable)
> HCI Event: Command Complete (0x0e) plen 4 #6 [hci0] 30.353773
LE Set Random Address (0x08|0x0005) ncmd 2
Status: Success (0x00)
< HCI Command: LE Set Scan Parameters (0x08|0x000b) plen 7 #7 [hci0] 30.353889
Type: Active (0x01)
Interval: 11.250 msec (0x0012)
Window: 11.250 msec (0x0012)
Own address type: Random (0x01)
Filter policy: Accept all advertisement (0x00)
> HCI Event: Command Complete (0x0e) plen 4 #8 [hci0] 30.354774
LE Set Scan Parameters (0x08|0x000b) ncmd 2
Status: Success (0x00)
< HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2 #9 [hci0] 30.354871
Scanning: Enabled (0x01)
Filter duplicates: Enabled (0x01)
> HCI Event: Command Complete (0x0e) plen 4 #10 [hci0] 30.355763
LE Set Scan Enable (0x08|0x000c) ncmd 2
Status: Success (0x00)
@ MGMT Event: Command Complete (0x0001) plen 4 {0x0001} [hci0] 30.356005
Start Discovery (0x0023) plen 1
Status: Success (0x00)
Address type: 0x07
BR/EDR
LE Public
LE Random
@ MGMT Event: Discovering (0x0013) plen 2 {0x0003} [hci0] 30.356057
Address type: 0x07
BR/EDR
LE Public
LE Random
Discovery: Enabled (0x01)
@ MGMT Event: Discovering (0x0013) plen 2 {0x0002} [hci0] 30.356057
Address type: 0x07
BR/EDR
LE Public
LE Random
Discovery: Enabled (0x01)
@ MGMT Event: Discovering (0x0013) plen 2 {0x0001} [hci0] 30.356057
Address type: 0x07
BR/EDR
LE Public
LE Random
Discovery: Enabled (0x01)
< HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2 #11 [hci0] 35.626810
Scanning: Disabled (0x00)
Filter duplicates: Disabled (0x00)
> HCI Event: Command Complete (0x0e) plen 4 #12 [hci0] 35.627802
LE Set Scan Enable (0x08|0x000c) ncmd 2
Status: Success (0x00)
< HCI Command: Inquiry (0x01|0x0001) plen 5 #13 [hci0] 35.627958
Access code: 0x9e8b33 (General Inquiry)
Length: 5.12s (0x04)
Num responses: 0
> HCI Event: Command Status (0x0f) plen 4 #14 [hci0] 35.628759
Inquiry (0x01|0x0001) ncmd 2
Status: Success (0x00)
> HCI Event: Inquiry Complete (0x01) plen 1 #15 [hci0] 40.750766
Status: Success (0x00)
@ MGMT Event: Discovering (0x0013) plen 2 {0x0003} [hci0] 40.750922
Address type: 0x07
BR/EDR
LE Public
LE Random
Discovery: Disabled (0x00)
@ MGMT Event: Discovering (0x0013) plen 2 {0x0002} [hci0] 40.750922
Address type: 0x07
BR/EDR
LE Public
LE Random
Discovery: Disabled (0x00)
@ MGMT Event: Discovering (0x0013) plen 2 {0x0001} [hci0] 40.750922
Address type: 0x07
BR/EDR
LE Public
LE Random
Discovery: Disabled (0x00)
client_loop: send disconnect: Broken pipe
可以看到,在扫描启用步骤之后,HCI 命令:Inquiry 未发送。而当扫描禁用时,HCI 命令:Inquiry 正在发送。也就是说,命令和事件序列的顺序存在差异。
我可以改变顺序吗?有人能帮我解决吗?
答案1
我们必须在驱动程序文件中的 misc 文件中添加模块的设备 ID。设备 ID 可以通过lsusb
命令获取。
另外,我们需要删除内核中加载的不需要的模块。使用检查lsmod
。