From 817eec282452d37d308a0ae90e8f4832c6dff650 Mon Sep 17 00:00:00 2001 From: Priti Aghera Date: Tue, 12 Aug 2014 14:31:28 -0700 Subject: [PATCH] Fixed SMP failure for Privacy enabled Multi-Adv When privacy is enabled and multi adv instance is used, SMP pairing was failing as wrong local connection address was used. Included a fix so that local connection address is always updated when connection handle to adv instance mappping event is received. Bug: 16872808 Change-Id: I288cd6cd85fe8547d0e85b1d8419a3412a993126 --- stack/btm/btm_acl.c | 5 +++-- stack/btm/btm_ble_multi_adv.c | 12 +++++++++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/stack/btm/btm_acl.c b/stack/btm/btm_acl.c index 3b1062235..8feccde52 100644 --- a/stack/btm/btm_acl.c +++ b/stack/btm/btm_acl.c @@ -294,13 +294,14 @@ void btm_acl_created (BD_ADDR bda, DEV_CLASS dc, BD_NAME bdn, p->transport = transport; if (transport == BT_TRANSPORT_LE) { - /*allow central device to use random address for now by skipping the role check */ - if (btm_cb.ble_ctr_cb.privacy /* && p->link_role == HCI_ROLE_SLAVE */) +#if BLE_PRIVACY_SPT == TRUE + if (btm_cb.ble_ctr_cb.privacy) { p->conn_addr_type = btm_cb.ble_ctr_cb.addr_mgnt_cb.own_addr_type; memcpy(p->conn_addr, btm_cb.ble_ctr_cb.addr_mgnt_cb.private_addr, BD_ADDR_LEN); } else +#endif { p->conn_addr_type = BLE_ADDR_PUBLIC; BTM_GetLocalDeviceAddr(p->conn_addr); diff --git a/stack/btm/btm_ble_multi_adv.c b/stack/btm/btm_ble_multi_adv.c index 9ac2b4a60..b2838a7db 100644 --- a/stack/btm/btm_ble_multi_adv.c +++ b/stack/btm/btm_ble_multi_adv.c @@ -733,7 +733,7 @@ tBTM_STATUS BTM_BleDisableAdvInstance (UINT8 inst_id) void btm_ble_multi_adv_vse_cback(UINT8 len, UINT8 *p) { UINT8 sub_event; - UINT8 adv_inst, reason, conn_handle; + UINT8 adv_inst, reason, conn_handle, idx; /* Check if this is a BLE RSSI vendor specific event */ STREAM_TO_UINT8(sub_event, p); @@ -746,6 +746,16 @@ void btm_ble_multi_adv_vse_cback(UINT8 len, UINT8 *p) STREAM_TO_UINT8(reason, p); STREAM_TO_UINT16(conn_handle, p); + if ((idx = btm_handle_to_acl_index(conn_handle)) != MAX_L2CAP_LINKS) + { + if (btm_cb.ble_ctr_cb.privacy && + adv_inst <= BTM_BLE_MULTI_ADV_MAX && adv_inst != BTM_BLE_MULTI_ADV_DEFAULT_STD) + { + memcpy(btm_cb.acl_db[idx].conn_addr, btm_multi_adv_cb.p_adv_inst[adv_inst - 1].rpa, + BD_ADDR_LEN); + } + } + if (adv_inst < BTM_BleMaxMultiAdvInstanceCount() && adv_inst != BTM_BLE_MULTI_ADV_DEFAULT_STD) { -- 2.11.0