专栏中心

EEPW首页 > 专栏 > 蓝牙bluez命令

蓝牙bluez命令

发布人:电子禅石 时间:2021-05-14 来源:工程师 发布文章

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

 

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


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

关键词: bluetooth

相关推荐

利用Bluetooth®低功耗技术进行定位跟踪

意法半导体推出单片天线匹配IC,配合Bluetooth LE SoC和STM32无线MCU,让射频设计变得更轻松、快捷

Microchip推出新型PIC单片机系列产品,以更简便方式添加Bluetooth低功耗连接功能

蓝牙无线通讯协议V1.1

CEVA Bluetooth 5.4 IP获得蓝牙技术联盟(SIG)认证包含新功能以满足快速增长的电子货架标签(ESL)市场需求

EDA/PCB 2023-09-18

高性价比无线MCU如何帮您将低功耗蓝牙应用到更多产品中

WIDCOMM Bluetooth Software1.4.1 Build 6

Achieving best-in-class RF performance in next gen Industrial and Medical connected applications

视频 2025-07-21

Bluetooth的过去与未来

Nordic助力双模模块简化Bluetooth Classic Audio和LE Audio产品开发

利用创新的Bluetooth核心规范v5.1中的到达角(AoA)增强室内定位服务

意法半导体推出STM32WB1MMC Bluetooth LE 认证模块

Bluetooth 蓝牙 规范 10.1版

Silicon Labs宣布推出具有先进硬件和软件的全新 Bluetooth®定位服务

硕士学位论文 在蓝芽环境中传送H.263 视讯资料

利用Bluetooth 低功耗技术进行定位跟踪方案解析

BM70蓝牙解决方案

更多 培训课堂
更多 焦点
更多 视频

技术专区