Android Bluedroid Debugging i.e New BT Stack from Android Community:
Wow ... its been more than 2 years i updated my blog ... Am i too lazy or too busy or combination of both. Combination of both -:).
Anyways today i see a need to update my blog with some important info regarding Bluedroid debugging. Bluedroid is the latest and greatest Bluetooth stack from Android developed by Google & Broadcom jointly. So obviously Google does not have interest or resources to maintain two stacks hence they are going to drop famous BlueZ stack for good reasons.
BlueZ stack comes with lot of good tools like hcidump for debugging and i see all those tools no more work starting with Android JB MR2 a.k.a 4.3 which has Bluedroid integrated full-fledged.
So Bluedroid got to have new tools or some tools to debug but as usual Google is very poor at documenting the things and they leave finding puzzles to developers out there. SO today's quest is fining the debugging tools for Bluedroid.
After spending some time with Google & Google Groups which yield no good information. With the help of one BT engineer who was struggling to find this info, pointed me this configuration file. I have explored further and here is magic that you need to do
You essentially find different conf file under external/bluetooth/bluedroid/conf/
auto_pair_devlist.conf
bt_did.conf
bt_stack.conf
bt_stack.conf looks interesting out of the all conf file. SO open the file and look at BTSnoopLogOutput field and change it to "true". You are good to go.
==================================
==================================================
More spoon feeding
Through Settings
For those who prefer simple approach ( BTW at the time of writing this article, i don't think there was any option available to enable HCI dump under "Developer options" )
Thanks to one of the commenter for pointing out this one.
Goto Setting --> Developer Options --> Enable Bluetooth snoop log option
That's it !!!
Wow ... its been more than 2 years i updated my blog ... Am i too lazy or too busy or combination of both. Combination of both -:).
Anyways today i see a need to update my blog with some important info regarding Bluedroid debugging. Bluedroid is the latest and greatest Bluetooth stack from Android developed by Google & Broadcom jointly. So obviously Google does not have interest or resources to maintain two stacks hence they are going to drop famous BlueZ stack for good reasons.
BlueZ stack comes with lot of good tools like hcidump for debugging and i see all those tools no more work starting with Android JB MR2 a.k.a 4.3 which has Bluedroid integrated full-fledged.
So Bluedroid got to have new tools or some tools to debug but as usual Google is very poor at documenting the things and they leave finding puzzles to developers out there. SO today's quest is fining the debugging tools for Bluedroid.
After spending some time with Google & Google Groups which yield no good information. With the help of one BT engineer who was struggling to find this info, pointed me this configuration file. I have explored further and here is magic that you need to do
You essentially find different conf file under external/bluetooth/bluedroid/conf/
auto_pair_devlist.conf
bt_did.conf
bt_stack.conf
bt_stack.conf looks interesting out of the all conf file. SO open the file and look at BTSnoopLogOutput field and change it to "true". You are good to go.
==================================
1 # Enable BtSnoop logging function 2# valid value : true, false 3BtSnoopLogOutput=false 4 5# BtSnoop log output file 6BtSnoopFileName=/sdcard/btsnoop_hci.log 7 8# Enable trace level reconfiguration function 9# Must be present before any TRC_ trace level settings 10TraceConf=true 11 12# Enable Secure Simple Pairing debug mode 13SSPDebug=false 14 15# Trace level configuration 16# BT_TRACE_LEVEL_NONE 0 ( No trace messages to be generated ) 17# BT_TRACE_LEVEL_ERROR 1 ( Error condition trace messages ) 18# BT_TRACE_LEVEL_WARNING 2 ( Warning condition trace messages ) 19# BT_TRACE_LEVEL_API 3 ( API traces ) 20# BT_TRACE_LEVEL_EVENT 4 ( Debug messages for events ) 21# BT_TRACE_LEVEL_DEBUG 5 ( Full debug messages ) 22# BT_TRACE_LEVEL_VERBOSE 6 ( Verbose messages ) - Currently supported for TRC_BTAPP only. 23TRC_BTM=2 24TRC_HCI=2 25TRC_L2CAP=2 26TRC_RFCOMM=2 27TRC_OBEX=2 28TRC_AVCT=2 29TRC_AVDT=2 30TRC_AVRC=2 31TRC_AVDT_SCB=2 32TRC_AVDT_CCB=2 33TRC_A2D=2 34TRC_SDP=2 35TRC_GATT=2 36TRC_SMP=2 37TRC_BTAPP=2 38TRC_BTIF=2
More spoon feeding
$ adb root
$adb pull /etc/bluetooth/bt_stack.conf bt_stack.conf
Edit st_stack.conf and change BtSnoopLogOutput=true. Save it
After this step snoop logs will be saved to /sdcard/btsnoop_hci.log automatically.
$ adb push bt_stack.conf etc/bluetooth/bt_stack.conf
$ adb pull /sdcard/btsnoop_hci.log
$ wireshark btsnoop_hci.log &
That's it folks ... Don't hesitate post any technical comments you may have on this topic. See you soon with next tip !!
Through Settings
For those who prefer simple approach ( BTW at the time of writing this article, i don't think there was any option available to enable HCI dump under "Developer options" )
Thanks to one of the commenter for pointing out this one.
Goto Setting --> Developer Options --> Enable Bluetooth snoop log option
That's it !!!
Comments
I see that on Android KitKat (4.4) there is a simple "Enabled Bluetooth HCI snoop log" menu option on the device, under "Developer options".
:-)