How to scan for Bluetooth devices

来自百问网嵌入式Linux wiki

获取蓝牙设备名称

开发板终端下执行如下命令,查看当前板子都有哪些蓝牙设备。
[root@imx6ull:~]# hciconfig  -a
hci0:   Type: Primary  Bus: USB
       BD Address: 38:01:46:1E:C1:2B  ACL MTU: 1021:8  SCO MTU: 255:16
       UP RUNNING
       RX bytes:4161 acl:0 sco:0 events:231 errors:0
       TX bytes:23894 acl:0 sco:0 commands:156 errors:0
       Features: 0xff 0xfb 0xff 0xfe 0xdb 0xfd 0x7b 0x87
       Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3
       Link policy: RSWITCH HOLD SNIFF PARK
       Link mode: SLAVE ACCEPT
       Name: 'RTK_BT_4.0'
       Class: 0x000000
       Service Classes: Unspecified
       Device Class: Miscellaneous,
       HCI Version: 4.0 (0x6)  Revision: 0x1e6c
       LMP Version: 4.0 (0x6)  Subversion: 0xa747
       Manufacturer: Realtek Semiconductor Corporation (93)

启用蓝牙设备

开发板终端下执行如下命令,即可启用蓝牙设备。
[root@imx6ull:~]# hciconfig  hci0 up

扫描蓝牙设备

开发板终端下执行如下命令,扫描周围都有哪些普通蓝牙设备。
[root@imx6ull:~]# hcitool scan
Scanning ...
       F4:60:E2:94:A8:ED       hceng