ArchLinux安装使用蓝牙(一)

一、安装

1.安装蓝牙并启动蓝牙服务

$ sudo pacman -S bluez bluez-utils
$ sudo systemctl enable bluetooth.service
$ sudo systemctl start bluetooth.service
二、使用Bluetoothctl进入蓝牙控制台

Bluez是Linux系统上的蓝牙协议栈,自带了很多有用的工具,Bluetoothctl就是其一。

$ bluetoothctl --help          查看帮助命令
$ bluetoothctl -v              查看蓝牙版本
三、使用Bluetoothctl连接蓝牙案例
$ bluetoothctl            进入蓝牙管理工具环境
[bluetooth]# power on                打开蓝牙
[bluetooth]# agent on                开启代理
[bluetooth]# scan on                 扫描蓝牙设备
[bluetooth]# pair xx:xx:xx:...       配对该设备
[bluetooth]# trust xx:xx:xx:...      信任该设备
[bluetooth]# connect xx:xx:...       连接该设备
[bluetooth]# disconnect xx:xx:...    断开蓝牙
[bluetooth]# help                   查看帮助信息
[bluetooth]# show                   查看本机蓝牙信息
[bluetooth]# discoverable yes       设置蓝牙可被发现
[bluetooth]# info xx:xx:xx:...      查看该蓝牙设备的信息
四、安装蓝牙音频
$ sudo pacman -S pulseaudio-bluetooth
五、蓝牙图形化管理工具安装
$ sudo pacman -S bluedevil
或
$ sudo pacman -S blueman
Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐