一、抓取蓝牙log步骤:
1、打开开发者选项中HCI蓝牙log开关
2、重启下蓝牙开关后进行操作
3、生成的 btsnoop_hci.log 文件在data目录下(不确定的可以直接在data目录下find下)
高通目前路径是: data/misc/bluetooth/logs/btsnoop_hci.log (仅供参考)
MTK目前路径是: /data/log/bt/btsnoop_hci.log(仅供参考)
4、btsnoop_hci.log 文件需要使用 Wireshark 工具查看,下载安装下即可
注意事项:如果生成的log文件是空的,那么可能是未配置 log 输出。查看下设备 etc/bluetooth/bt_stack.conf 中配置
# 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 )
# BT_TRACE_LEVEL_VERBOSE 6 ( Verbose messages ) - Currently supported for TRC_BTAPP only.
TRC_BTM=2
TRC_HCI=2
TRC_L2CAP=2
TRC_RFCOMM=2
TRC_OBEX=2
TRC_AVCT=2
TRC_AVDT=2
TRC_AVRC=2
TRC_AVDT_SCB=2
TRC_AVDT_CCB=2
TRC_A2D=2
TRC_SDP=2
TRC_SMP=2
TRC_BTAPP=2
TRC_BTIF=2
TRC_BNEP=2
TRC_PAN=2
TRC_HID_HOST=2
TRC_HID_DEV=2
# This is Log configuration for new C++ code using LOG() macros.
# See libchrome/base/logging.h for description on how to configure your logs.
# sample configuration:
#LoggingV=--v=0
LoggingVModule=--vmodule=*/btm/*=1,btm_ble_multi*=2,*/bta/gatt/*=1,*/stack/gatt/*=1,*/stack/smp/*=1,btif_ble*=1
LoggingVModule 这个需要是打开状态,如果是被注释的,将文件修改下push进去替换后,重新抓下蓝牙log即可。
二、查看Log
点击具体指令查看内容,例如查看获取的蓝牙版本号等。