Linux命令行连接蓝牙设备
2022-5-21 15:27:35 Author: blog.xlab.app(查看原文) 阅读量:10 收藏

发表于 分类于 阅读次数: 本文字数: 569 阅读时长 ≈ 1 分钟

给Linux接蓝牙键盘,方便在多设备之间切换

开启蓝牙设备

之前为了省电,把不用的设备全关了,手动到BIOS里把蓝牙设备打开,进系统确认蓝牙设备打开

1
2
> bluetooth
bluetooth = on

开启蓝牙服务

1
2
systemctl start bluetooth
systemctl enable bluetooth

确认服务启动正常

1
systemctl status bluetooth

连接蓝牙设备

进入交互式管理

1
bluetoothctl

开启agent

1
2
[bluetooth]# agent on
[bluetooth]# default-agent

开启扫描

1
[bluetooth]# scan on

会不停的输出显示扫到的设备,出现设备之后配对

1
[bluetooth]# pair 设备的MAC地址

信任这个设备

1
[bluetooth]# trust 设备的MAC地址

连接设备,之后就可以使用了

1
[bluetooth]# connect 设备的MAC地址

tips

只有一个键盘的时候,可以先用ssh连上去,然后打开Windows的虚拟键盘,用鼠标操作上面的命令配对

完成后关闭配对和发现

1
2
[bluetooth]# pairable off
[bluetooth]# discoverable off

参考

https://wiki.automotivelinux.org/bluetooth


文章来源: https://blog.xlab.app/p/591afee0/
如有侵权请联系:admin#unsafe.sh