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

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

蓝牙bluez命令的更多相关文章

  1. Linux 下蓝牙bluez分析及使用 (1)

    蓝牙耳机的使用 由于Linux下蓝牙使用不及Windows下直观,致使使用时会出现一些小问题.虽然是小问题,但是由于普通的操作都具有顺序性,前面的中断了,后面的哪怕再简单,也无法继续了.正好近期工作与 ...

  2. 蓝牙bluez学习(1) Stack Architecture

    Bluez支持的features Core Specification 4.2 (GAP, L2CAP, RFCOMM, SDP, GATT) Classic Bluetooth (BR/EDR) B ...

  3. 【转】Android bluetooth介绍(二): android blueZ蓝牙代码架构及其uart 到rfcomm流程

    原文网址:http://blog.sina.com.cn/s/blog_602c72c50102uzoj.html 关键词:蓝牙blueZ  UART  HCI_UART H4  HCI  L2CAP ...

  4. 树莓派开发笔记(十一):蓝牙的使用,BlueZ协议(双树莓探测rssi并通过蓝牙互传获取的rssi信号强度)

    若该文为原创文章,转载请注明原文出处本文章博客地址:https://blog.csdn.net/qq21497936/article/details/110940484长期持续带来更多项目与技术分享, ...

  5. 【转】Android bluetooth介绍(三): 蓝牙扫描(scan)设备分析

    原文网址:http://blog.csdn.net/xubin341719/article/details/38584469 关键词:蓝牙blueZ  A2DP.SINK.sink_connect.s ...

  6. Android bluetooth介绍(三): 蓝牙扫描(scan)设备分析

    关键词:蓝牙blueZ  A2DP.SINK.sink_connect.sink_disconnect.sink_suspend.sink_resume.sink_is_connected.sink_ ...

  7. Android bluetooth介绍(两): android 蓝牙源架构和uart 至rfcomm过程

    关键词:蓝牙blueZ  UART  HCI_UART H4  HCI  L2CAP RFCOMM  版本号:基于android4.2先前版本 bluez内核:linux/linux3.08系统:an ...

  8. Android开发——蓝牙

    ---恢复内容开始--- 前言 孤芳自赏,一揽芳华: 人情冷暖,自在人心: 登高远眺,望步止前: 喜笑言开,欺人骗己. 上篇文章介绍了基本的蓝牙使用,书写的demo也不是很完善,希望各位大神能够改正. ...

  9. nRF Connect SDK(NCS)/Zephyr固件升级详解 – 重点讲述MCUboot和蓝牙空中升级

    如何在nRF Connect SDK(NCS)中实现蓝牙空中升级?MCUboot和B0两个Bootloader有什么区别?MCUboot升级使用的image格式是怎么样的?什么是SMP协议?CBOR编 ...

随机推荐

  1. Linux系统查看硬件信息神器,比设备管理器好用100倍!

    大家都知道,当我们的 Linux 系统计算机出现问题时,需要对其排除故障,首先需要做的是找出计算机的硬件信息.下面介绍一个简单易用的应用程序--HardInfo,你可以利用它来显示你电脑的每个硬件方面 ...

  2. PHPSTORM Live-Templates变量速查表

    camelCase(String) 返回字符串作为参数传递,转换为驼峰式大小写.例如, my-text-file/my text file/my_text_file将转化为 myTextFile. c ...

  3. phpbasic

    <!DOCTYPE html> <html> <body> <?php // 这是 PHP 单行注释 /* 这是 PHP 多行 注释 */ ?> < ...

  4. 第十四章 JDK新特性回顾

    14.1.JDK5新特性回顾 自动装箱.拆箱 静态导入 增强for循环 可变参数 枚举 泛型 元数据 14.2.JDK7新特性回顾 对Java集合(Collections)的增强支持 在switch中 ...

  5. 学习JavaScript数据结构与算法 2/15

    第一章 JavaScript简介 js不同于C/C++,C#,JAVA,不是强类型语言. 通常,代码质量可以用全局变量和函数的数量来考量(数量越多越糟).因此,尽可能避免使用全局变量. JS数据类型 ...

  6. (一)python 格式化 excel 格式

    需求: 客户通过 sftp 上传了一个 poc测试的 excel文件, 下到 云桌面 查看,发现一堆格式问题, 怎么办呢? 公司又不允许 吧文件下载到本地处理, 只能在 服务器上进行处理. 一堆的类型 ...

  7. Python 变量类型及变量赋值

    在 Python 中,变量不一定占用内存变量.变量就像是对某一处内存的引用,可以通过变量访问到其所指向的内存中的值,并且可以让变量指向其他的内存.在 Python 中,变量不需要声明,但是使用变量之前 ...

  8. CSV文件指定页脚

    https://www.cnblogs.com/zhangxinqi/p/9231801.html 2020-06-15

  9. JS 常用方法汇总(不定期更新)

    /** * 获取当前日期 * @returns {string} */ Common.currentDate = function () { // 获取当前日期 var date = new Date ...

  10. 账本APP服务器端开发

    账本APP开发 好好学习,天天向上 本文已收录至我的Github仓库DayDayUP:github.com/RobodLee/DayDayUP,欢迎Star,更多文章请前往:目录导航 上一篇文章我们聊 ...