系统概况:
# uname -a Linux rockchip 4.4.143 #9 SMP PREEMPT Wed Feb 13 18:38:41 CST 2019 armv7l GNU/Linux 蓝牙芯片:AP6212
1、查看电源是否开启
# cd /sys/class/rfkill # ls rfkill0 rfkill1 rfkill2 # rfkill <--- 查看蓝牙对应的目录 ID TYPE DEVICE SOFT HARD 0 bluetooth bt_default blocked unblocked 1 wlan phy0 unblocked unblocked 2 wlan brcmfmac-wifi unblocked unblocked # cd rfkill0/ # cat state <--- 查看电源状态 0 <--- power down # echo 1 > ./state <--- power up [ 423.917629] [BT_RFKILL]: rfkill_rk_set_power: set bt wake_host pin output high! [ 423.980538] [BT_RFKILL]: rfkill_rk_set_power: set bt wake_host pin input! [ 423.980608] [BT_RFKILL]: ENABLE UART_RTS [ 424.081438] [BT_RFKILL]: DISABLE UART_RTS [ 424.081539] [BT_RFKILL]: bt turn on power
2、查看蓝牙是否启动
# hciconfig -a <--- 蓝牙设备未启动 # bt_pcba_test <--- 启动蓝牙设备 # hciconfig -a hci0: Type: Primary Bus: UART BD Address: 90:1B:07:8D:34:B0 ACL MTU: 1021:8 SCO MTU: 64:1 DOWN <--- 蓝牙Down状态 RX bytes:612 acl:0 sco:0 events:30 errors:0 TX bytes:398 acl:0 sco:0 commands:30 errors:0 Features: 0xbf 0xfe 0xcf 0xfe 0xdb 0xff 0x7b 0x87 Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3 Link policy: RSWITCH SNIFF Link mode: SLAVE ACCEPT
3、激活蓝牙
# hciconfig hci0 up # hciconfig dev hci0: Type: Primary Bus: UART BD Address: 90:1B:07:8D:34:B0 ACL MTU: 1021:8 SCO MTU: 64:1 UP RUNNING RX bytes:1224 acl:0 sco:0 events:60 errors:0 TX bytes:796 acl:0 sco:0 commands:60 errors:0 # hciconfig -a <--- 查看详细信息 hci0: Type: Primary Bus: UART BD Address: 90:1B:07:8D:34:B0 ACL MTU: 1021:8 SCO MTU: 64:1 UP RUNNING RX bytes:1224 acl:0 sco:0 events:60 errors:0 TX bytes:796 acl:0 sco:0 commands:60 errors:0 Features: 0xbf 0xfe 0xcf 0xfe 0xdb 0xff 0x7b 0x87 Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3 Link policy: RSWITCH SNIFF Link mode: SLAVE ACCEPT Name: 'BCM43438A1 26MHz AP6212A1_CL1 BT4.0 OTP-BD-0058' Class: 0x000000 Service Classes: Unspecified Device Class: Miscellaneous, HCI Version: 4.0 (0x6) Revision: 0xf9 LMP Version: 4.0 (0x6) Subversion: 0x2209 Manufacturer: Broadcom Corporation (15)
4、扫描看下
# hcitool scan Scanning ... 00:1A:7D:DA:71:13 CHENTONG1070 70:BB:E9:C7:1B:1C 小米手机 94:87:E0:B4:09:82 小米手机8 50:3C:EA:AF:D7:00 OPPO R11s 20:47:DA:BE:3B:B3 小米手机6 28:B2:BD:CA:69:BB GUOZF668 20:18:06:25:62:79 HC-05 34:D7:12:91:DC:C0 坚果 Pro 2 特别版