发布于 3年前

Arch Linux使用BlueZ连接蓝牙设备指令

下面是在Arch Linux上使用Blue Z 5.31连接蓝牙的指令。

依赖安装

需要安装一下软件:

  • bluez: bluetoothd
  • bluez-utils: bluetoothctl, rfcomm

配对

1、启动守护进程:

systemctl start bluetooth

2、使用bluetoothctl配对

power on
agent on
scan on
... wait ...
scan off
pair <dev>

3、新建串行设备

rfcomm bind 0 <dev>

创建成功后得到/dev/rfcomm0

解除配对

1、删除串行设备

rfcomm release 0

2、使用bluetoothctl解除配对

remove <dev>
power off

3、停止守护进程

systemctl stop bluetooth

注意:

1、有问题可以使用rfkill list来检查蓝牙是否被阻塞
2、rfcomm-utility现在已被弃用,官方软件包也已删除。 但在bluez-utils-compat或bluez-rfcomm还是会包含它。

©2020 edoou.com   京ICP备16001874号-3