查询蓝牙接口的信息,在终端中输入:hciconfig
thinKinG@thinKinG-PC:~/Desktop$ hciconfig
hci0: Type: Primary Bus: USB
BD Address: 50:2F:9B:56:EE:3C ACL MTU: 1021:4 SCO MTU: 96:6
UP RUNNING PSCAN ISCAN
RX bytes:3070158 acl:162287 sco:0 events:5466 errors:0
TX bytes:813975 acl:28 sco:0 commands:3343 errors:0
打开蓝牙开关,在终端中输入:sudo hciconfig hci0 up
thinKinG@thinKinG-PC:~/Desktop$ sudo hciconfig hci0 up
请输入密码:
验证成功
关闭蓝牙开关,在终端中输入:sudo hciconfig hci0 down
thinKinG@thinKinG-PC:~/Desktop$ sudo hciconfig hci0 down
搜索蓝牙外设,在终端中输入:hcitool scan
thinKinG@thinKinG-PC:~/Desktop$ hcitool scan
Scanning ...
配对蓝牙外设,在终端中输入:bluetoothctl pair A4:C3:F0:91:D0:C4
thinKinG@thinKinG-PC:~/Desktop$ bluetoothctl pair A4:C3:F0:91:D0:C4
Attempting to pair with A4:C3:F0:91:D0:C4
[CHG] Device A4:C3:F0:91:D0:C4 Connected: yes
[CHG] Device A4:C3:F0:91:D0:C4 UUIDs: 00001104-0000-1000-8000-00805f9b34fb
[CHG] Device A4:C3:F0:91:D0:C4 UUIDs: 00001105-0000-1000-8000-00805f9b34fb
[CHG] Device A4:C3:F0:91:D0:C4 UUIDs: 00001106-0000-1000-8000-00805f9b34fb
[CHG] Device A4:C3:F0:91:D0:C4 UUIDs: 00001108-0000-1000-8000-00805f9b34fb
[CHG] Device A4:C3:F0:91:D0:C4 UUIDs: 0000110a-0000-1000-8000-00805f9b34fb
[CHG] Device A4:C3:F0:91:D0:C4 UUIDs: 0000110b-0000-1000-8000-00805f9b34fb
[CHG] Device A4:C3:F0:91:D0:C4 UUIDs: 0000110c-0000-1000-8000-00805f9b34fb
[CHG] Device A4:C3:F0:91:D0:C4 UUIDs: 0000110e-0000-1000-8000-00805f9b34fb
[CHG] Device A4:C3:F0:91:D0:C4 UUIDs: 00001112-0000-1000-8000-00805f9b34fb
[CHG] Device A4:C3:F0:91:D0:C4 UUIDs: 0000112f-0000-1000-8000-00805f9b34fb
[CHG] Device A4:C3:F0:91:D0:C4 UUIDs: 00001132-0000-1000-8000-00805f9b34fb
[CHG] Device A4:C3:F0:91:D0:C4 UUIDs: 00001133-0000-1000-8000-00805f9b34fb
[CHG] Device A4:C3:F0:91:D0:C4 UUIDs: 00001200-0000-1000-8000-00805f9b34fb
[CHG] Device A4:C3:F0:91:D0:C4 UUIDs: 00005005-0000-1000-8000-0002ee000001
[CHG] Device A4:C3:F0:91:D0:C4 ServicesResolved: yes
[CHG] Device A4:C3:F0:91:D0:C4 Paired: yes
Pairing successful
说明:A4:C3:F0:91:D0:C4
是外设的mac地址
查看已成功配对的设备,在终端中输入:bluetoothctl paired-devices
thinKinG@thinKinG-PC:~/Desktop$ bluetoothctl paired-devices
Device FE:50:48:58:C3:00 M585/M590
查看已配对设备连接状态,在终端中输入:bluetoothctl info A4:C3:F0:91:D0:C4
thinKinG@thinKinG-PC:~/Desktop$ bluetoothctl info A4:C3:F0:91:D0:C4
Device A4:C3:F0:91:D0:C4 (public)
Name: xuqi-PC
Alias: xuqi-PC
Class: 0x001c010c
Icon: computer
Paired: yes
Trusted: no
Blocked: no
Connected: no
LegacyPairing: no
UUID: IrMC Sync (00001104-0000-1000-8000-00805f9b34fb)
UUID: OBEX Object Push (00001105-0000-1000-8000-00805f9b34fb)
UUID: OBEX File Transfer (00001106-0000-1000-8000-00805f9b34fb)
UUID: Headset (00001108-0000-1000-8000-00805f9b34fb)
UUID: Audio Source (0000110a-0000-1000-8000-00805f9b34fb)
UUID: Audio Sink (0000110b-0000-1000-8000-00805f9b34fb)
UUID: A/V Remote Control Target (0000110c-0000-1000-8000-00805f9b34fb)
UUID: A/V Remote Control (0000110e-0000-1000-8000-00805f9b34fb)
UUID: Headset AG (00001112-0000-1000-8000-00805f9b34fb)
UUID: Phonebook Access Server (0000112f-0000-1000-8000-00805f9b34fb)
UUID: Message Access Server (00001132-0000-1000-8000-00805f9b34fb)
UUID: Message Notification Se.. (00001133-0000-1000-8000-00805f9b34fb)
UUID: PnP Information (00001200-0000-1000-8000-00805f9b34fb)
UUID: Vendor specific (00005005-0000-1000-8000-0002ee000001)
Modalias: usb:v1D6Bp0246d0532
说明:A4:C3:F0:91:D0:C4
是外设的mac地址
断开已配对设备,在终端中输入:bluetoothctl disconnect A4:C3:F0:91:D0:C4
thinKinG@thinKinG-PC:~/Desktop$ bluetoothctl disconnect A4:C3:F0:91:D0:C4
Attempting to disconnect from A4:C3:F0:91:D0:C4
Successful disconnected
说明:A4:C3:F0:91:D0:C4
是外设的mac地址
连接已配对设备,在终端中输入:bluetoothctl connect A4:C3:F0:91:D0:C4
thinKinG@thinKinG-PC:~/Desktop$ bluetoothctl connect A4:C3:F0:91:D0:C4
Attempting to connect to A4:C3:F0:91:D0:C4
[CHG] Device A4:C3:F0:91:D0:C4 Connected: yes
Connection successful
说明:A4:C3:F0:91:D0:C4
是外设的mac地址
删除配对设备,在终端中输入:bluetoothctl remove A4:C3:F0:91:D0:C4
thinKinG@thinKinG-PC:~/Desktop$ bluetoothctl remove A4:C3:F0:91:D0:C4
[CHG] Device A4:C3:F0:91:D0:C4 ServicesResolved: no
Device has been removed
说明:A4:C3:F0:91:D0:C4
是外设的mac地址