linux上可以用bluedroid a2dp吗

Bluedroid与BluZ,蓝牙测试方法的变动(基于bludroid和BlueZ的对比)
Bluedroid与BluZ,蓝牙测试方法的变动(基于bludroid和BlueZ的对比)
[摘要:android4.2今后,增添了bludroid,正在做测试时,会发明取之前的bluez的测试,有着较大的更改。上面排列一些bluedroid的分歧面,和之前bluez的测试敕令考证(该局部是用bluez做的测试,针对]
android4.2以后,增加了bludroid,在做测试时,会发现与之前的bluez的测试,有着较大的变动。下面罗列一些bluedroid的不同点,以及之前bluez的测试命令验证(该部分是用bluez做的测试,针对bluedroid的测试后续会补充)。
对蓝牙栈bluedroid的测试变动:
1. 已经没有 bttest 的测试工具,也就说没有bt_enable(), bt_disable()的功能来打开和关闭蓝牙
2. 一些Bluedroid中没有的测试功能。
hcitool, hciconfig,rctest, l2test,Sdptool。而蓝牙 FTM 的测试工具还是有的。
3. bluedroid中所有的log均可以在log cat中查看,不像之前的bluez,一部分在log cat中,一部分在 kernel log中。并且,bluedroid对不同的profile和层次的log进行了分类(对BTM, HCI, L2CAP, RFCOMM, OBEX),在bt_stack.conf中可以进行配置 ,并想android中的Log一样,可以对输出的log做输出等级的调整(0-6来表示)。
对bluez的测试命令:
网上已经有很多资料了,找到一篇不错的资料:
原文地址:http://blog.chinaunix.net/uid--id-3554423.html&&&&& 这里感谢作者的分享!
由于原文作者虽说明了蓝牙是用的BlueZ的蓝牙栈,但未注明所使用的手机版本和型号,为了保险起见,下面是针对里面的命令做下测试。
我的环境:Android 4.1.1 蓝牙栈:BlueZ
命令行测试蓝牙
1. 命令行控制蓝牙开关
cd /data/data/com.android.providers.settings/databases
sqlite3 settings.db
select * from secure where name=&bluetooth_on&; (查看是否打开)
update secure set value=1 where name=&bluetooth_on&;& (这里的value=1是打开,0是关闭)
select * from secure where name=&bluetooth_on&; (确认是否更改成功)
reboot &重启手机生效&
2. 命令行操作蓝牙
Android原生包括高通QRD用的是blueZ的蓝牙协议栈,有提供两个工具:hciconfig和hcitool用于调试蓝牙,开始调试前首先需要将这些工具Push到手机上:
adb remount
adb push hciconfig /system/xbin
adb push hcitool /system/xbin
chmod -R 777 /system/xbin
要注意的是,这些工具只适用于blueZ,象MTK用的是bluetoothangel就不适用了
常用的一些命令:
hciconfig -a (查看蓝牙地址,芯片状态等等)
hcitool scan (进行蓝牙搜索,并列出搜索到的设备名称和设备地址)
hciconfig hciX piscan (开启Inquiry Scan和Page Scan,使手机处于可被搜索和可连接状态)
可以使用hciconfig --help以及hcitool --help来查询其它的功能,尤其要提的是hcitool cmd这个命令,通过这个命令可以发送任何的HCI Command,大部分蓝牙功能都可以通过发送HCI Command来实现,具体HCI Command格式可以查询蓝牙Spec
进入测试模式的命令:
hcitool cmd 0x06 0x0003 (Enter Test Mode)
hcitool cmd 0x03 0x 0x00 0x02 (Auto Accept All Connections)
hcitool cmd 0x03 0x001A 0x03 (Page Inquiry Scans)
hcitool cmd 0x03 0x (Disable Authentication)
hcitool cmd 0x03 0x (Disable Encryption)
Qualcomm bt test :
the follow commands to bring up bt through adb shell:
&#echo 1 & /sys/class/rfkill/rfkill0/state
#hci_qcomm_init -vvv -e
#hciattach /dev/ttyHS0 qualcomm-ibs 3000000
#hciconfig hci0 up
#hcitool scan
The follow commands are used to enter test mode.
&#bttest disable
#bttest enable
#bttest enable_dut_mode
测试后,均可正常使用。对bluedroid的实际测试,之后会回来补充。
感谢关注 Ithao123Linux频道,是专门为互联网人打造的学习交流平台,全面满足互联网人工作与学习需求,更多互联网资讯尽在 IThao123!
Laravel是一套简洁、优雅的PHP Web开发框架(PHP Web Framework)。它可以让你从面条一样杂乱的代码中解脱出来;它可以帮你构建一个完美的网络APP,而且每行代码都可以简洁、富于表达力。
Hadoop是一个由Apache基金会所开发的分布式系统基础架构。
用户可以在不了解分布式底层细节的情况下,开发分布式程序。充分利用集群的威力进行高速运算和存储。
Hadoop实现了一个分布式文件系统(Hadoop Distributed File System),简称HDFS。HDFS有高容错性的特点,并且设计用来部署在低廉的(low-cost)硬件上;而且它提供高吞吐量(high throughput)来访问应用程序的数据,适合那些有着超大数据集(large data set)的应用程序。HDFS放宽了(relax)POSIX的要求,可以以流的形式访问(streaming access)文件系统中的数据。
Hadoop的框架最核心的设计就是:HDFS和MapReduce。HDFS为海量的数据提供了存储,则MapReduce为海量的数据提供了计算。
产品设计是互联网产品经理的核心能力,一个好的产品经理一定在产品设计方面有扎实的功底,本专题将从互联网产品设计的几个方面谈谈产品设计
随着国内互联网的发展,产品经理岗位需求大幅增加,在国内,从事产品工作的大部分岗位为产品经理,其实现实中,很多从事产品工作的岗位是不能称为产品经理,主要原因是对产品经理的职责不明确,那产品经理的职责有哪些,本专题将详细介绍产品经理的主要职责
IThao123周刊7035人阅读
蓝牙相关(1)
& &虽然,Android 4.2已经将蓝牙协议栈替换为Bluedroid,但从了解低层实现的角度BlueZ,仍是有个好的入口。因为bluedroid tools有限。
& 如果只是想查看源码,下面的链接会很方便:
/platform/external/bluetooth/bluez/+/android-4.1.2_r1
android-4.1.2_r1
> ... >&&>&?
日 –&Is it going to replace the BlueZ stack with the&Bluedroid&stack in&...Question
regarding qualification and&tools&for&bluedroid&· Support for non&...
/.../android-dumps-bluez-and-integrates-broadcom-...
All we gathered until now is that&Bluedroid&was contributed by Broadcom and is&.....regard to internet gain e-mails artful multinational
companies globe this&tool,&...
&&下面的连接,供参考备忘:
蓝牙 hci 命令
蓝牙测试经验 &hcidump
hcidump抓取 log :
&1 打开蓝牙
&2 用adb shell 登陆android设备 并且用 &hcidump &-w /sdcard/hcilog
&3 开始测试
&4 测试完成,停止stop the hcidump&然后分析&&hcilog& file.
C:\Users\kang-ibm&adb shell
$ hcidump -B -w /sdcard/hcilog
hcidump -B -w /sdcard/hcilog
hcidump: permission denied &(权限不够,su)
http://fecbob.pixnet.net/blog/post/
# hcidump -x
& HCI Command: Vendor (0x3f|0x0280) plen 5
09 01 00 00 00
& HCI Event: Command Status (0x0f) plen 4
00 01 80 FE
& HCI Event: Command Complete (0x0e) plen 6
01 80 FE 00 09 00
& HCI Command: Vendor (0x3f|0x0280) plen 5
03 7C A5 01 00
& HCI Event: Command Status (0x0f) plen 4
00 01 80 FE
& HCI Event: Command Complete (0x0e) plen 10
01 80 FE FF 03 15 7C A5 01 00
& 表示發出hci命令
& 表示收到回應
hcidump從kernel接收原始資料,對應kernel中send_general_cmd的3個kvec,包含三部分:
第一部分kvec[0]: packet類型
第二部分kvec[1]: 為message header,包含opcode和data length。hcidump顯示的0x3f|0x0280中,前面部分為opcode的高6bit,表示ogf,後面為低10bit,表示ocf
第三部分kvec[2]: hcidump列印出的buffer。在發出的命令中,第一個位元組表示表示命令idx,後面的四個位元組表示val
藍牙驅動會在發送命令後用kernel_recvmsg從kernel socket接收消息。接收的消息可能如下所示:
Response: 04 0e 0a 01 80 fe 00 03 00 7c a5 01 00
Event: 04 ff 05 82 00 00 00 00
對這個消息的解釋視vendor做法。對於我現在做的這個產品來說,它是這樣解析這些消息的:
buf[1]: 0e表示命令的response,ff表示event
buf[2]:表示長度
buf[3]~buf[n]:為hcidump列印出的buffer
static int xxxxx_hci_send_general_cmd(struct mrvl8xxx_device *dev, uint8_t ogf,
uint32_t ocf, uint8_t idx, uint32_t val, uint32_t len)
struct socket *sock = dev-&
uint8_t type = HCI_COMMAND_PKT;
struct kvec vec[3];
struct hci_command_
char cmdbuf[8];
int err = 0;
dev-&request.idx =
dev-&request.val =
dev-&request.len =
cmdbuf[0] =
memcpy(&cmdbuf[1], &val, len);
cmdlen = len + 1;
hc.opcode = ((ogf & OGF_MASK) && OGF_SHIFT |&(ocf & OCF_MASK));
vec[0].iov_base = &
vec[0].iov_len = 1;
vec[1].iov_base = &
vec[1].iov_len = HCI_COMMAND_HDR_SIZE;
vec[2].iov_base =
vec[2].iov_len =
memset(&msg, 0, sizeof(msg));
err = kernel_sendmsg(sock, &msg, vec, 3, cmdlen+4);
if (err & 0)
printk(KERN_ERR &[fm] mrvl8xxx_hci_sendcmd: failed to kernel_sendmsg, return: %d\n&, err);
shadow 发表在&&(0)&(0)&人气()
转自:/2011/09/bluetooth-3.html
BlueTooth要怎麼進測試模式要怎麼搞-3
6. FAE是這麼說滴
以下是FAE所提供的兩個HCI command
實際上操作的結果:
# hcitool cmd 0x03 0x1a 0x03
hcitool cmd 0x03 0x1a 0x03
& HCI Command: ogf 0x03, ocf 0x001a, plen 1
& HCI Event: 0x0e plen 4
& 01 1A 0C 00
# hcitool cmd 0x06 0x03
hcitool cmd 0x06 0x03
& HCI Command: ogf 0x06, ocf 0x0003, plen 0
& HCI Event: 0x0e plen 4
& 01 03 18 00
HCI OGF &OCF &para1
hcitool cmd 0x03 0x1a 0x03
引述FAE的描述
&進入測試模式前, 需要下 Page 694 的 7.3.18 Write Scan Enable Command (參數 0x03) 讓模組可以被測試機找到&
&hcitool cmd 0x03 0x1a 0x03&
OGF=0x03 OCF=0x1a & 這各是參考到 7.3.18 Write Scan Enable Command
&0x03& 參數&0x03&是指 Inquiry Scan enabled + Page Scan enabled.
&HCI Event: 0x0e plen 4&
&0x0e& 根據7.7.14 Command Complete Event, 是指host端的command已經完成了
&plen 4& 是HCI event的長度
&01 1A 0C 00& 根據7.7.14 Command Complete Event,
&01&表示HCI command的packet的數目(的確只有一個packet)
&1A 0C& 其實是由host HCI command的OGF(MSB-6bit)+OCF(LSB-10bit)組成的 000011 +
= 01 1010 = 0x0C1A
&0& 根據7.3.18 Write Scan Enable Command &0&表示 Write_Scan_Enable command succeeded.
HCI OGF &OCF
hcitool cmd 0x06 0x03
引述FAE的描述
&Page 774 的 7.6.3 Enable Device Under Test Mode Command 則有進入 DUT 模式的 HCI command, 請參考.&
&hcitool cmd 0x06 0x03&
OGF=0x06 OCF=0x3 & 這各是參考到 7.6.3 Enable Device Under Test Mode Command
&HCI Event: 0x0e plen 4&
&0x0e& 根據7.7.14 Command Complete Event, 是指host端的command已經完成了
&plen 4& 是HCI event的長度
&01 1A 0C 00& 根據7.7.14 Command Complete Event,
&01&表示HCI command的packet的數目(的確只有一個packet)
&03 18& 其實是由host HCI command的OGF(MSB-6bit)+OCF(LSB-10bit)組成的 000110 +
= 00 0011 = 0x1803
&0& 根據7.6.3 Enable Device Under Test Mode Command, &0&表示 Write_Scan_Enable command succeeded.
測試模式的進入似乎是由BT spec所規範了.
所以只要是用HCI command的話應該是一體適用的.
這意味著只要是通過BT spec 2.1的藍芽裝置通通可以使用這一個方法進入測試模式.
整個測試的流程
待測物進入測試模式 -& BT測試治具規畫好測試項目(公司用的是安捷倫N4010A PC端程式remote control)
-& 測試治具會自動完成與待測物的溝通並且收集test plan的相關數據 -& 透過PC端的程式把治具上的數據log下來.
實際上前面1~5點都是BT學習過程的自high內容,真的solution是在第6點的時候才真的可以解決.
http://linux.die.net/man/8/hcidump
hcidump(8) - Linux man page
hcidump&- Parse
hcidump&[-h]
hcidump&[option [option...]] [filter]
Description
hcidump&reads raw HCI data coming from and going to a Bluetooth device (which can be specified with the option&-i,
default is the first available one) and prints to screen commands, events and data in a human-readable form. Optionally, the dump can be written to a file rather than parsed, and the dump file can be parsed in a subsequent moment.
-hPrints usage info and exits-i&&hciX&Data is read from&hciX, which must be the name of an installed Bluetooth device. If not specified, and if -r option is not set, data is read from the first available Bluetooth device.-l&&len&, --snap-len=&len&Sets max length of processed packets to&len.-p&&psm&, --psm=&psm&Sets default Protocol Service Multiplexer to&psm.-m&&compid&, --manufacturer=&compid&Sets default company id for manufacturer to&compid.-w&&file&, --save-dump=&file&Parse output is not printed to screen, instead data read from device is saved in file&file. The saved dump file can be subsequently parsed with option&-r.-r&&file&, --read-dump=&file&Data is not read from a Bluetooth device, but from file&file. file is crated with option&-w.-s&&host&, --send-dump=&host&Parse output is not printed to screen, instead data read from device is send to host&host.-n&&host&, --recv-dump=&host&Data is not read from a Bluetooth device, but from host&host.-t,&--timestampPrepend a time stamp to every packet.-a,&--asciiFor every packet, not only is the packet type displayed, but also all data in ASCII.-x,&--hexFor every packet, not only is the packet type displayed, but also all data in hex.-X,&--extFor every packet, not only is the packet type displayed, but also all data in hex and ASCII.-R,&--rawFor every packet, only the raw data is displayed.-C,&--cmtp=&psm&Sets the PSM value for the CAPI Message Transport Protocol.-H,&--hcrp=&psm&Sets the PSM value for the Hardcopy Control Channel.-O,&--obex=&channel&Sets the RFCOMM channel value for the Object Exchange Protocol.-P,&--ppp=&channel&Sets the RFCOMM channel value for the Point-to-Point Protocol.-D,&--pppdump=&file&Extract PPP traffic with pppdump format.-A,&--audio=&file&Extract SCO audio data.-B,&--btsnoopUse the BTSnoop file format.-V,&--verboseEnables a more verbose decoding of every packet.-Y,&--novendorDon't display any vendor commands or events and don't show any pin code or link key in plain text.-N,&--noappendNo appending to existing files. Always create new files.
filter is a space-separated list of packet categories: available categories are&lmp,&hci,&sco,&l2cap,&rfcomm,&sdp,&bnep,&cmtp,&hidp,&hcrp,&avdtp,&avctp,obex,&capi&and&ppp.
If filters are used, only packets belonging to the specified categories are dumped. By default, all packets are dumped.
Written by Maxim Krasnyansky &&
and Marcel Holtmann &&
man page by Fabrizio Gennari &&
转自:/wzh206/archive//1750989.html
/view/e1d89aed172ded630b1cb620.html
HCI Bluetooth adaptor with Linux and&Bluez
//hci-bluetooth-adaptor-with-linux-and-bluez/
参考知识库
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:998464次
积分:10169
积分:10169
排名:第1110名
原创:180篇
转载:220篇
译文:14篇
评论:243条
(1)(1)(2)(5)(6)(1)(7)(2)(6)(2)(8)(7)(17)(9)(16)(14)(11)(13)(32)(24)(20)(39)(13)(19)(10)(13)(7)(13)(15)(5)(3)(9)(14)(8)(6)(22)(14)1005901 & Bluedroid GKI_exception getbuf: out of buffers
Bluedroid GKI_exception getbuf: out of buffers
Bluedroid GKI_exception getbuf: out of buffers
[caf priority: p3][CR 653107][P=2]
Firefox OS
Client Software
unspecified
Gonk (Firefox OS)
2.0 S2 (23may)
Shawn Huang [:shawnjohnjr]
QA Contact:
Show dependency
06:52 PDT by Tapas[:tkundu on #b2g/gaia/memshrink/gfx] (always NI me)
praghunath
tzimmermann
in‑moztrap-
[QAnalyst-Triage+]
Project Flags:
blocking-b2g:
Tracking Flags:
status-b2g-v1.4:
status-b2g-v2.0:
Blocking Flags:
Attachments
|   |
|   |
|   |
|   |
|   |
|   |
|   |
|   |
|   |
|   |
|   |android - BlueZ vs Bluedroid bluetooth stack - Stack Overflow
to customize your list.
Announcing Stack Overflow Documentation
We started with Q&A. Technical documentation is next, and we need your help.
Whether you're a beginner or an experienced developer, you can contribute.
BlueZ have a lot of documentations and all. And from the same, i understood BlueZ supports A2DP sink support. And at the same time an android device can be made act as an A2DP sink by modifying the audio.conf file inside the same.
I also came to know that from android 4.2 onwards, the BlueZ stack was replaced by Broadcom's Bluedroid stack. I searched a lot about Bluedroid stack. But i was not able to find much details about the same.
Hope someone can help me with the following doubts.
1). Whether Bluedroid have A2DP sink support?
2). Whether the audio.conf file will be available for devices having bluedroid stack?
3). I am going to write an A2DP sink support for an android device by directly calling API's of BlueZ stack. But my final question is whether the same can be used with Bluedroid stack also? Hope Bluedroid is just an expansion of BlueZ.
Please help.
Bluedroid is a stack provided by Broadcom and is now opensource in android . Bluedroid is not related with bluez in any respect, it has few advantages over bluez(i differ to that).
[1]. Bluedroid does not have a2dp sink support as of now, as per code available
only a2dp source support is available
[2]. Audio.conf file is for bluez stack, it is not a part of bluedroid
[3]. Directly calling Bluez API-- i think you will use dbus calls but bluedroid does not support dbus method calls, it has a callback mechanism implemented, so it will not work, bluedroid is not an expansion of bluez.
A2DP Sink role is now supported in Android Lollipop (5.0). They have modified the Bluedroid source code to support the same. To completely support it , you need to modify the audio HAL (audio.h), AudioPolicyManagerBase.cpp and audio_policy.conf and Also Audio Manager, A2DPStateMachine etc.
As user987500 said, A2DP sink is supported in android L,only make minor modification, you device can changed from A2DP src to sink.
But be sure only one role can be supported for one device, which can be configured from xml file.
Your Answer
Sign up or
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Post as a guest
By posting your answer, you agree to the
Not the answer you're looking for?
Browse other questions tagged
Stack Overflow works best with JavaScript enabled7863人阅读
Android(150)
Linux 应用程序编程(115)
  这个工具据说是基于BlueZ的,但是Android4.2以后不再采用BlueZ取而代之的是BlueDroid,具体详见《》。但是一般解决方案中都是两手准备,在正常使用的时候是BlueDroid,而在调试的硬件时候还可以方便的使用基于BlueZ的hcittool。BlueDroid不利于调试硬件,这是我在公元时的观点。
#&hcitool&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
hcitool&-&HCI&Tool&ver&4.93
&&&&&&&&hcitool&[options]&&command&&[command&parameters]
&&&&&&&&--help&&Display&help
&&&&&&&&-i&dev&&HCI&device
&&&&&&&&dev&&&&&Display&local&devices
&&&&&&&&inq&&&&&Inquire&remote&devices
&&&&&&&&scan&&&&Scan&for&remote&devices
&&&&&&&&name&&&&Get&name&from&remote&device&
&&&&&&&&info&&&&Get&information&from&remote&device
&&&&&&&&spinq&&&Start&periodic&inquiry
&&&&&&&&epinq&&&Exit&periodic&inquiry
&&&&&&&&cmd&&&&&Submit&arbitrary&HCI&commands
&&&&&&&&con&&&&&Display&active&connections
&&&&&&&&cc&&&&&&Create&connection&to&remote&device
&&&&&&&&dc&&&&&&Disconnect&from&remote&device
&&&&&&&&sr&&&&&&Switch&master/slave&role
&&&&&&&&cpt&&&&&Change&connection&packet&type
&&&&&&&&rssi&&&&Display&connection&RSSI
&&&&&&&&lq&&&&&&Display&link&quality
&&&&&&&&tpl&&&&&Display&transmit&power&level
&&&&&&&&afh&&&&&Display&AFH&channel&map
&&&&&&&&lp&&&&&&Set/display&link&policy&settings
&&&&&&&&lst&&&&&Set/display&link&supervision&timeout
&&&&&&&&auth&&&&Request&authentication
&&&&&&&&enc&&&&&Set&connection&encryption
&&&&&&&&key&&&&&Change&connection&link&key
&&&&&&&&clkoff&&Read&clock&offset
&&&&&&&&clock&&&Read&local&or&remote&clock
&&&&&&&&lescan&&Start&scan
&&&&&&&&lewladd&Add&device&to&LE&White&List
&&&&&&&&lewlrm&&Remove&device&from&LE&White&List
&&&&&&&&lewlsz&&Read&size&of&LE&White&List
&&&&&&&&lewlclr&Clear&LE&White&list
&&&&&&&&lecc&&&&Create&a&LE&Connection
&&&&&&&&ledc&&&&Disconnect&a&LE&Connection
&&&&&&&&lecup&&&LE&Connection&Update
For&more&information&on&the&usage&of&each&command&use:
&&&&&&&&hcitool&&command&&--help
功能:获取本设备接口和MAC地址
功能:获取远程设备mac地址clock offset以及class.
功能:扫描远程设备
功能:获取指定MAC地址远程设备的名字
功能:获取远程设备的详情
功能:向蓝牙设备输入命令
功能:查看当前连接信息
功能:查看远程设备的信号增益(强度)
功能:查看支持的POLICY
功能:远程设备的xxx等级
功能:xxxx
参考知识库
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:1669506次
积分:21939
积分:21939
排名:第227名
原创:456篇
转载:200篇
评论:850条
(1)(9)(9)(6)(6)(6)(1)(1)(3)(4)(7)(1)(3)(10)(3)(3)(7)(3)(6)(7)(10)(9)(13)(21)(10)(8)(5)(6)(8)(10)(4)(3)(6)(5)(11)(10)(28)(26)(54)(28)(34)(30)(64)(17)(23)(115)(8)

我要回帖

更多关于 bluedroid 架构 的文章

 

随机推荐