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

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. 为什么不应该使用goroutine id?

    Goroutine id 的获取方式 之前做的项目中,会使用 goroutine-id(以下简称 goid) 作为日志中的一个标识参数.而 goroutine 的相关信息是不对外暴露的.想要获取 go ...

  2. 篮球30S定时器设计

    一.设计介绍 本设计采用74LS192作为计数器,74LS192具有同步加减计数功能,可以通过引脚电平对它设置达到清零重置的目的,可以达到对计数器清零的功能,使用两片级联74LS192分别显示十位和个 ...

  3. Android集成百度地图

    1. 百度地图api Android定位SDK Android地图SDK Android地图SDK<------

  4. 第一部分_Mac技巧

    原文是"池建强"的微信文章,公众号为"MacTalk" 第一天 直接在终端里输入 $ say "英文单词",Mac就会拼读该单词 第二天 使 ...

  5. functools函数中的partial函数及wraps函数

    ''' partial引用函数,并增加形参 ''' import functools def show_arg(*args,**kwargs): print("args",args ...

  6. 使用Esxi虚拟化部署OpenWrt/HomeLede+扩容硬盘 保姆级教程

    本文介绍使用VMware虚拟化平台部署OpenWrt/HomeLede,并扩容固件硬盘的方法. 推荐使用虚拟化方式部署软路由,理由如下: 部署.升级.回退.扩容等操作非常方便,特别适合折腾 可以方便的 ...

  7. Springboot+Mybatis+Clickhouse+jsp 搭建单体应用项目(一)

    一.服务器安装clickhouse服务 参阅 :https://www.cnblogs.com/liuyangfirst/p/13379064.html 二.连接数据库 成功 三.新建库 CREATE ...

  8. ElasticSearch 基础入门 and 操作索引 and 操作文档

    基本概念 索引: 类似于MySQL的表.索引的结构为全文搜索作准备,不存储原始的数据. 索引可以做分布式.每一个索引有一个或者多个分片 shard.每一个分片可以有多个副本 replica. 文档: ...

  9. MySQL的undo/redo日志和binlog日志,以及2PC

    发现自己的知识点有点散,今天就把它们连接起来,好好总结一下. 一.undo log.redo log.binlog的定义和对比   定义和作用                       所在架构层级 ...

  10. angularjs脏检查

    angularjs实现了双向绑定,与vue的defineProperty不同,它的原理在于它的脏检查机制,以下做了一些总结: angular.js介绍 AngularJs是mvvm框架,它的组件是vm ...