From f37456d5a14773e25386629803f7dcaecb37fb99 Mon Sep 17 00:00:00 2001 From: Andre Eisenbach Date: Sun, 3 Aug 2014 15:57:06 -0700 Subject: [PATCH] LE: Fix random address resolution when done in the stack If the local device does not support random address resolution in the Bluetooth chip, it has to be performed in the host stack. This patch fixes some instances where address resolution was not performed properly, causing device reconnection to fail. Change-Id: Ifb84a9fa44995caa3680d9a0b4248ef911eb9ad0 --- stack/btm/btm_ble.c | 6 +++--- stack/l2cap/l2c_ble.c | 9 ++++++++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/stack/btm/btm_ble.c b/stack/btm/btm_ble.c index 86d126026..0036d9239 100644 --- a/stack/btm/btm_ble.c +++ b/stack/btm/btm_ble.c @@ -1661,9 +1661,9 @@ void btm_ble_conn_complete(UINT8 *p, UINT16 evt_len) #if (BLE_VND_INCLUDED == TRUE) match = btm_public_addr_to_random_pseudo (bda, &bda_type); #endif - /* possiblly receive connection complete with resolvable random on - slave role while the device has been paired */ - if (!match && role == HCI_ROLE_SLAVE && BTM_BLE_IS_RESOLVE_BDA(bda)) + /* Possibly receiving connection complete with a resolvable random address + for a device that has been paired */ + if (!match && BTM_BLE_IS_RESOLVE_BDA(bda)) { btm_ble_resolve_random_addr(bda, btm_ble_resolve_random_addr_on_conn_cmpl, p_data); } diff --git a/stack/l2cap/l2c_ble.c b/stack/l2cap/l2c_ble.c index 3c2df029f..0b77b7884 100644 --- a/stack/l2cap/l2c_ble.c +++ b/stack/l2cap/l2c_ble.c @@ -35,10 +35,15 @@ #define L2CA_GET_UPD_ST(x) ((x) & UPD_ST_MASK) #define L2CA_SET_UPD_ST(x, y) x = (((x) & ~UPD_ST_MASK) | (y)) - #if (defined BLE_VND_INCLUDED && BLE_VND_INCLUDED == TRUE) #include "vendor_ble.h" +#else +#if BLE_PRIVACY_SPT == TRUE +extern BOOLEAN btm_ble_get_acl_remote_addr(tBTM_SEC_DEV_REC *p_dev_rec, BD_ADDR conn_addr, + tBLE_ADDR_TYPE *p_addr_type); #endif +#endif + /******************************************************************************* ** ** Function L2CA_CancelBleConnectReq @@ -649,6 +654,8 @@ BOOLEAN l2cble_init_direct_conn (tL2C_LCB *p_lcb) BTM_BleEnableIRKFeature(TRUE); btm_random_pseudo_to_public(init_addr, &init_addr_type); +#else + btm_ble_get_acl_remote_addr(p_dev_rec, init_addr, &init_addr_type); #endif #endif if (!btsnd_hcic_ble_create_ll_conn (scan_int,/* UINT16 scan_int */ -- 2.11.0