Android设备中,通常有一个文件(/etc/bluetooth/bt_stack.conf)可以设置调试参数
将BtSnoopLogOutput设置为true,就可以将协议包写入文件BtSnoopFileName
将TraceConf设置为true,就可以设置bluedroid对应模块的log输出,比如讲TRC_HCI设置成5,HCI的所有debug信息就会打开,在log中可以看到
# Enable BtSnoop logging function
# valid value : true, false
BtSnoopLogOutput=true
# BtSnoop log output file
BtSnoopFileName=/data/misc/bluedroid/btsnoop_hci.log
# Enable trace level reconfiguration function
# Must be present before any TRC_ trace level settings
TraceConf=true
# Trace level configuration
# BT_TRACE_LEVEL_NONE 0 ( No trace messages to be generated )
# BT_TRACE_LEVEL_ERROR 1 ( Error condition trace messages )
# BT_TRACE_LEVEL_WARNING 2 ( Warning condition trace messages )
# BT_TRACE_LEVEL_API 3 ( API traces )
# BT_TRACE_LEVEL_EVENT 4 ( Debug messages for events )
# BT_TRACE_LEVEL_DEBUG 5 ( Full debug messages )
TRC_BTM=5
TRC_HCI=5
TRC_L2CAP=5
TRC_RFCOMM=5
TRC_OBEX=5
TRC_AVCT=5
TRC_AVDT=5
TRC_AVRC=5
TRC_AVDT_SCB=5
TRC_AVDT_CCB=5
TRC_A2D=5
TRC_SDP=5
TRC_GATT=5
TRC_SMP=5
TRC_BTAPP=5