Issue: Page time out seen when user initiated pairing from LE scan response
Steps to reproduce
==================
Steps:
1. Turn on BT
2. inquiry any dual mode device
3. Initiate pairing (only LE scan response received but br/edr
inquiry response not received)
Actual Result:
Remote name request or create connection got page timeout some times
Expected result:
Remote name request and create connection should be successful
Root Cause:
If user finds only LE scan response for dual mode devices, then stack
treats it as dual mode based on br/edr not supported bit. If pairing
initiated from LE scan response, then stack initiates RNR and ACL connection
on br/edr transport with wrong page scan response from LE inquiry database,
it leads to page time out.
Fix:
Use page scan response from inquiry data base if br/edr inquiry response
received, else use default page scan response R1 in RNR and create connection.
Test: Follow steps above
Bug:
154286616
Change-Id: I281ebc6d0e67d88c30328cb67df7f28793f354c1
tBTM_INQUIRY_VAR_ST* p_inq = &btm_cb.btm_inq_vars;
/* Save the info */
- p_cur->inq_result_type = BTM_INQ_RESULT_BLE;
+ p_cur->inq_result_type |= BTM_INQ_RESULT_BLE;
p_cur->ble_addr_type = addr_type;
p_cur->rssi = rssi;
p_cur->ble_primary_phy = primary_phy;
if (p_i->inq_count != p_inq->inq_counter)
p_inq->inq_cmpl_info.num_resp++; /* A new response was found */
- p_cur->inq_result_type = BTM_INQ_RESULT_BR;
+ p_cur->inq_result_type |= BTM_INQ_RESULT_BR;
if (p_i->inq_count != p_inq->inq_counter) {
p_cur->device_type = BT_DEVICE_TYPE_BREDR;
p_i->scan_rsp = false;
/* If the database entry exists for the device, use its clock offset */
tINQ_DB_ENT* p_i = btm_inq_db_find(remote_bda);
- if (p_i) {
+ if (p_i && (p_i->inq_info.results.inq_result_type & BTM_INQ_RESULT_BR)) {
tBTM_INQ_INFO* p_cur = &p_i->inq_info;
btsnd_hcic_rmt_name_req(
remote_bda, p_cur->results.page_scan_rep_mode,
/* Check with the BT manager if details about remote device are known */
p_inq_info = BTM_InqDbRead(p_lcb->remote_bd_addr);
- if (p_inq_info != NULL) {
+ if ((p_inq_info != NULL) &&
+ (p_inq_info->results.inq_result_type & BTM_INQ_RESULT_BR)) {
page_scan_rep_mode = p_inq_info->results.page_scan_rep_mode;
page_scan_mode = p_inq_info->results.page_scan_mode;
clock_offset = (uint16_t)(p_inq_info->results.clock_offset);