Bluez相关工具的使用
来源:互联网 发布:mac如何网页看视频 编辑:程序博客网 时间:2024/06/06 14:46
对于Bluez的使用,有很多辅助工具可以使用,这些工具主要在Bluez-utils/tools 目录下。
1 Bccmd
Bccmd是用来和CSR的芯片进行BCCMD(Bluecore command protocol)通讯的一个工具。BCCMD并非蓝牙协议栈的标准,而是CSR芯片的专属协议
NAME
bccmd - Utility for the CSR BCCMD interface
SYNOPSIS
bccmd bccmd [-t <transport>] [-d <device>] <command> [<args>] bccmd [-h --help]
DESCRIPTION
bccmd issues BlueCore commands to Cambridge Silicon Radio devices. If run without the <command> argument, a short help page will be displayed.
OPTIONS
-t <transport> Specify the communication transport. Valid options are: HCI Local device with Host Controller Interface (default). USB Direct USB connection. BCSP Blue Core Serial Protocol. H4 H4 serial protocol. 3WIRE 3WIRE protocol (not implemented). -d <dev> Specify a particular device to operate on. If not specified, default is the first available HCI device or /dev/ttyS0 for serial transports.
COMMANDS
builddef Get build definitions keylen <handle> Get current crypt key length clock Get local Bluetooth clock rand Get random number chiprev Get chip revision buildname Get the full build name panicarg Get panic code argument faultarg Get fault code argument coldreset Perform cold reset warmreset Perform warm reset disabletx Disable TX on the device enabletx Enable TX on the device singlechan <channel> Lock radio on specific channel hoppingon Revert to channel hopping rttxdata1 <decimal freq MHz> <level> TXData1 radio test radiotest <decimal freq MHz> <level> <id> Run radio tests, tests 4, 6 and 7 are transmit tests memtypes Get memory types psget [-r] [-s <stores>] <key> Get value for PS key. -r sends a warm reset afterwards psset [-r] [-s <stores>] <key> <value> Set value for PS key. -r sends a warm reset afterwards psclr [-r] [-s <stores>] <key> Clear value for PS key. -r sends a warm reset afterwards pslist [-r] [-s <stores>] List all PS keys. -r sends a warm reset afterwards psread [-r] [-s <stores>] Read all PS keys. -r sends a warm reset afterwards psload [-r] [-s <stores>] <file> Load all PS keys from PSR file. -r sends a warm reset afterwards pscheck [-r] [-s <stores>] <file> Check syntax of PSR file. -r sends a warm reset afterwards
查询CSR的BCCMD相关的文档,可以找到具体的含义如下:
0x0000 Default
0x0008 psram
0x0001 psi
0x0002 psf
0x0004 psrom
0x0003 psi then psf
0x0007 psi, psf then psrom
0x0009 psram then psi
0x000b psram, psi then psf
0x000f psram, psi, psf then psrom
CSR的蓝牙芯片中,PSKEY可能存储在 rom flash eeprom ram等介质里,这里的数值指明了psset/get命令操作PSKEY时所针对的存储介质及其优先顺序,通常我们会用 –s 0x0 或 –s “default” 来使用该命令,0x0的含义与0xf一样。
基本上来说,所修改的都是位于psram中的pskey,此外,pskey修改以后要起作用,还要一并使用 –r参数,或直接用warmreset命令将蓝牙芯片进行warm reset。
2 Hciattach
Hciattach主要用来初始化蓝牙设备,它的命令格式如下:
hciattach [-n] [-p] [-b] [-t timeout] [-s initial_speed] <tty> <type | id> [speed] [flow|noflow] [bdaddr]
其中最重要的参数就是 type和speed,type决定了要初始化的设备的型号,可以使用 hciattach –l 来列出所支持的设备型号。
并不是所有的参数对所有的设备都是适用的,有些设备会忽略一些参数设置,例如:查看hciattach的代码就可以看到,多数设备都忽略bdaddr参数。
Hciattach命令内部的工作步骤是:首先打开制定的tty设备,然后做一些通用的设置,如flow等,然后设置波特率为 initial_speed,然后根据type调用各自的初始化代码,最后将波特率重新设置为speed。所以调用hciattach时,要根据你的实际情况,设置好initial_speed和speed。
对于type BCSP来说,它的初始化代码只做了一件事,就是完成BCSP协议的同步操作,它并不对蓝牙芯片做任何的pskey的设置。同步操作的具体流程和规范可以参考CSR的相关文档: BCSP Link Establishment Protocol
3 Hcidump
Hcidump不在bluez-utils包里,而是在单独的hcidump包里。主要用来分析捕获和分析HCI数据包,如果使用bluez过程中出了什么问题,用hcidump往往可以发现一些出错的线索,原因。 参数很多,基本上hcidump –X –V 就可以帮你获得详细的经过格式解析的数据包。同时Hcidump可以使用hcidump --save-file=/directory/xxx.cfa命令存成cfa文件,就可以使用Frontline FTS4BT Viewer工具查看相应的蓝牙包
- Bluez相关工具的使用
- Bluez相关的各种tools的使用
- Bluez相关的各种tools的使用(主要用到hcidump)
- Bluez相关的各种tools的使用(主要用到hcidump)
- Bluez相关的各种tools的使用(主要用到hcidump)
- Bluez相关的各种tools的使用(主要用到hcidump)
- Bluez调试工具hcitool与gattool的使用实例
- BlueZ在arm linux下的使用
- BlueZ 相关tools用法
- iwconfig相关工具的使用
- 项目相关工具的使用
- iwconfig相关工具的使用
- iwconfig相关工具的使用
- iwconfig相关工具的使用
- CMUSphinx相关工具的使用
- iwconfig相关工具的使用
- bluetooth开发(一)------Bluez工具的编译与移植
- openwrt编译bluez工具gatttool
- Ubuntu 各版本网易源
- GCD小结
- ASP.NET中CSS失效总结及解决方案
- 感光器尺寸 面积 转换 计算
- Windows多线程程序设计
- Bluez相关工具的使用
- ORA-01033 oracle initialization or shutdown in progress错误解决办法
- Android ADB error
- Flurry使用初级教程 (转)
- javascript收藏之photoGallery
- 玩转BealgeBoard xM——试水Android 4.0 ICS
- ARM开发常用的22个概念
- hdu2444二分图判断+最大匹配
- 在myeclipse中查看struts java文档的方法