首先确保 bluez, bluez-utils
已经安装好,否则在终端安装:
sudo pacman -S bluez bluez-utils
systemctl status bluetooth.service
如果蓝牙服务未启动,则需手动启动蓝牙服务:
sudo systemctl start bluetooth.service
bluetoothctl
此时会进入到对应蓝牙适配器的操控终端:[bluetooth]#
在蓝牙适配器终端 [bluetooth]#
输入以下命令:
scan on
启动搜索蓝牙设备模式。
[NEW] Device **:**:**:**:**:** XXX
,其中 **:**:**:**:**:**
是蓝牙设备的 mac 地址,XXX
为该蓝牙设备的设备名。**:**:**:**:**:**
为其 mac 地址。)info **:**:**:**:**:**
当蓝牙适配器已经搜索到所需的蓝牙设备时,在蓝牙适配器终端 [bluetooth]#
输入以下命令停止搜索:
scan off
在蓝牙适配器终端 [bluetooth]#
根据 mac 地址输入以下命令来配对蓝牙设备:
pair **:**:**:**:**:**
其中 **:**:**:**:**:**
是蓝牙设备的 mac 地址。
若蓝牙适配器终端显示 Pairing successful
则说明配对成功。
配对成功后,进一步在蓝牙适配器终端 [bluetooth]#
通过以下命令连接蓝牙设备:
connect **:**:**:**:**:**
其中 **:**:**:**:**:**
是蓝牙设备的 mac 地址。
Connection successful
则说明连接成功。此时就可以正常使用蓝牙设备了。[XXX]#
,其中 XXX
是蓝牙设备的设备名。info
当需要断开连接时,在蓝牙适配器终端 [bluetooth]#
通过以下命令断开蓝牙设备:
disconnect
蓝牙适配器终端显示 Successful disconnected
则说明成功断开连接。
当需要移除配对的蓝牙设备时,在蓝牙适配器终端 [bluetooth]#
通过以下命令移除蓝牙设备:
remove **:**:**:**:**:**
其中 **:**:**:**:**:**
是蓝牙设备的 mac 地址。
蓝牙适配器终端显示 Device has been removed
则说明成功移除蓝牙设备。
【注】更多命令操作及解释可在蓝牙适配器终端 [bluetooth]#
或蓝牙设备终端输入 help
查看。