新闻| 论坛| 博客| 在线研讨会
蓝牙bluez命令
电子禅石| 2021-05-14 19:37:56 阅读:11042 发布文章

记录一下自己平时调试蓝牙的命令,后续学习到再添加

sdptool命令:

sdptool add SP - 添加SPP:

sdptool add --channel=1 DID SP DUN LAN FAX OPUSH FTP HS HF SAP NAP GN PANU HID CIP CTP A2SRC A2SNK SYNCML NOKID PCSUITE SR1

sdptool brower local - 查看适配器提供的功能

bluetoothctl 命令:

bluetoothctl scan on 扫描
bluetoothctl agent on 代理
bluetoothctl default-agent 默认代理
bluetoothctl trust xx:xx:xx:xx:CF:F0 信任
bluetoothctl pair xx:xx:xx:xx:CF:F0 配对

命令行进入: bluetoothctl

查看:default-agent

注册agent:agent on

扫描:scan on

停止扫描:scan off

找到要配对的蓝牙:pair xx:xx:xx:xx:xx:xx

添加信任:trust xx:xx:xx:xx:xx:xx

连接:connect xx:xx:xx:xx:xx:xx

设置蓝牙可被发现状态:discoverable yes

rfcomm命令:

mknod /dev/rfcomm0 c 216 0 ---216是RFCOMM设备号

rfcomm bind 0 xx:xx:xx:xx:CF:F0 绑定设备

rfcomm connect 0 xx:xx:xx:xx:CF:F0 1连接设备

rfcomm show 0 查看设备状态

cat >/dev/rfcomm0 写数据

rfcomm release 0 解绑

rfcomm watch /dev/rfcomm0 3 /sbin/agetty rfcomm0 linux 115200 --没用过

hciconfig命令:

hciconfig hci0 piscan 可使设备既可见
hciconfig -a 查看hci详细信息
hciconfig hci0 sspmode disable #关闭简易配对模式 enable为使能简易配对
hciconfig hci0 sspmode #查看简易配对模式状态

hciconfig hci0 up

hciconfig hci0 down

hciattach命令:

hciattach /dev/ttyACM1 any

linux蓝牙配置文件:

Bluetoothd保存的对端设备的信息:
/var/lib/bluetooth/

bluetooth配置:
/etc/bluetooth/

/usr/lib/systemd/system/bluetooth.service

/sys/class/bluetooth/

dbus中系统总线的配置
/etc/dbus-1/system.d/bluetooth.conf

bluetooth service和bluetoothd进程:


service --status-all | grep blue -查看是否存在bluetooth service


ps -ef|grep blue -查看是否存在bluetoothd进程

service bluetooth start -开启bluetooth service

service bluetooth stop -停止bluetooth service

停止bluetoothd进程方法:
rfkill block bluetooth
sudo service bluetooth stop
rfkill unblock bluetooth

bluetoothd -n -d - 启动bluetoothd


*博客内容为网友个人发布,仅代表博主个人观点,如有侵权请联系工作人员删除。

参与讨论
登录后参与讨论
属于自己的技术积累分享,成为嵌入式系统研发高手。
最近文章
签名类型
2024-04-29 16:28:59
cat 文件名
2024-04-29 15:05:34
推荐文章
最近访客