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

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. 推荐一款技术人必备的接口测试神器:Apifox

    1. 背景 作为互联网行业技术从业者,接口调试是必不可少的一项技能,通常我们都会选择使用 Postman 这类工具来进行接口调试,在接口调试方面 Postman 做的确实非常出色.当然除了Postma ...

  2. 油田问题 bfs

    #include<iostream> #include<stdio.h> #include<stdlib.h> #include<time.h> #in ...

  3. IDEA去掉Autowired的黄色背景和对象的红线

    Intellij idea @AutoWired注入bean 出现红色波浪线,@autowird下面显示黄色波浪线或者标黄,如下图,解决方法总结一下供大家使用  首先选择File--Settings- ...

  4. PHP array_push() 函数

    实例 向数组尾部插入 "blue" 和 "yellow": <?php$a=array("red","green" ...

  5. Python os.chflags() 方法

    概述 os.chflags() 方法用于设置路径的标记为数字标记.多个标记可以使用 OR 来组合起来.高佣联盟 www.cgewang.com 只支持在 Unix 下使用. 语法 chflags()方 ...

  6. Python time strftime()方法

    描述 Python time strftime() 函数接收以时间元组,并返回以可读字符串表示的当地时间,格式由参数format决定.高佣联盟 www.cgewang.com 语法 strftime( ...

  7. PHP decbin() 函数

    实例 把十进制转换为二进制: <?phpecho decbin("3") . "<br>";echo decbin("1" ...

  8. java中的枚举类enum

    enum SeasonEnum {//枚举类: 本类规定了SeasonEnum(季节)类只能有四个对象SPRING,SUMMER,AUMUTN,WINTER //创建枚举类的的四个对象SPRING,S ...

  9. 每日一道 LeetCode (3):回文数

    前文合集 每日一道 LeetCode 文章合集 题目:回文数 题目来源:https://leetcode-cn.com/problems/palindrome-number/ 判断一个整数是否是回文数 ...

  10. 开源后端数据校验插件Validate.Net,类似Validate.js

    介绍 Validate.Net将Validate.js移植到.Net平台,可以更方便.更快捷的校验实体内属性值是否合法.内置多种常规数据校验规则(校验必填.校验字符串长度区间.校验最大最小值.校验值区 ...