简介
ComProbe Protocol Analysis System (CPAS) 是Frontline提供的一款 蓝牙 协议 log 分析 工具,Frontine这家公司主要是做抓取 蓝牙 Air sniff log 设备
安装
购买他们的抓包工具就会附带log分析工具,也可以在Frontine官网上下载,下载的时候需要填一些信息.如果嫌麻烦扫描文章后面的二维码 回复 cpas
问题背景
蓝牙音箱开始正常,电量用完后,配对一直失败, 提示PIN码不正确。分析定位该问题 请来了CPAS 分析HCI日志。
CPAS 使用指导
获取HCI日志文件
本文主要MTK平台 ,通过MTKLogger开启保存HCI日志。
导出日志又 cfa文件
打开日志文件分析
双击该文件 可以在Frame Display 看到如下界面
点击 message seq 可以看到 如下界面
问题定位分析
Android日志分析
查看logcat 搜索到关键log
01-20 10:07:55.403760 978 1075 V bt_stack: [VERBOSE2:btm_inq.cc(2032)] BDA 74:a3:4a:0f:e3:2b
01-20 10:07:55.403878 978 1075 V bt_stack: [VERBOSE2:btm_inq.cc(2035)] Inquire BDA 74:a3:4a:0f:e3:2b
01-20 10:07:55.403948 978 1075 V bt_stack: [VERBOSE1:btm_inq.cc(951)] BTM_InqDbRead: bd addr 74:a3:4a:0f:e3:2b
01-20 10:07:55.403981 978 1075 D bt_btm : btm_find_dev_type - device_type = 1 addr_type = 0
01-20 10:07:55.404019 978 1075 I bt_btm : btm_sec_rmt_name_request_complete
01-20 10:07:55.404041 978 1075 D bt_btm : btm_acl_resubmit_page
01-20 10:07:55.404081 978 1075 I bt_btm : btm_sec_rmt_name_request_complete PairState: GET_REM_NAME RemName: status: 19 State:0 p_dev_rec: 0x9ffc9000
01-20 10:07:55.404137 978 1075 I bt_btm : btm_sec_rmt_name_request_complete() continue bonding sm4: 0x0000, status:0x13
01-20 10:07:55.404160 978 1075 I bt_btm : btm_sec_change_pairing_state() Old: GET_REM_NAME
01-20 10:07:55.404181 978 1075 I bt_btm : btm_sec_change_pairing_state() New: IDLE pairing_flags:0x1
01-20 10:07:55.404336 978 1075 V bt_stack: [VERBOSE1:btm_inq.cc(951)] BTM_InqDbRead: bd addr 74:a3:4a:0f:e3:2b
01-20 10:07:55.404381 978 1075 D bt_btm : btm_find_dev_type - device_type = 1 addr_type = 0
01-20 10:07:55.404414 978 1075 D bt_btif : btif_transfer_context event 3, len 280
01-20 10:07:55.404527 978 1018 D bt_btif : btif task fetched event a001
01-20 10:07:55.404553 978 1018 D bt_btif : btif_context_switched
01-20 10:07:55.404574 978 1018 I bt_btif : btif_dm_upstreams_evt: ev: BTA_DM_AUTH_CMPL_EVT
01-20 10:07:55.404596 978 1018 D bt_btif : btif_dm_auth_cmpl_evt: bond state=1, success=0, key_present=0
01-20 10:07:55.404619 978 1018 D bt_btif : btif_dm_auth_cmpl_evt() Authentication fail reason 19
关键: Authentication fail reason 19 ,PairState: GET_REM_NAME ,bd addr 74:a3:4a:0f:e3:2b
HCI 分析定位
根据这些信息,配对是链路层的行为 即在HCI中搜索
进行搜索
一目了然,看到对端主动 断开连接。
对比验证
连接其他音箱进行对比
JBL
总结
研发过程中,善于找到工具,利用工具定位 分析问题,提升效率。同时可以用工具加深知识点,进行归纳整理。
参考
https://blog.csdn.net/ylangeia/article/details/108400659
https://cloud.tencent.com/developer/article/1689586