案例1--蓝牙音箱电量用完后,配对一直失败,提示PIN码不正确
基于MTK平台,通过MTKLogger开启保存HCI日志
问题定位分析
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
关键日志
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.404619 978 1018 D bt_btif : btif_dm_auth_cmpl_evt() Authentication fail reason 19
HCI定位分析
根据这些信息,配对是链路层的行为,即在 HCI中搜索
进行搜索
一目了然,看到对端主动断开连接。