OSDN Git Service

LE: Fix random address resolution when done in the stack
authorAndre Eisenbach <eisenbach@google.com>
Sun, 3 Aug 2014 22:57:06 +0000 (15:57 -0700)
committerAndre Eisenbach <eisenbach@google.com>
Sun, 3 Aug 2014 23:07:58 +0000 (16:07 -0700)
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
stack/l2cap/l2c_ble.c

index 86d1260..0036d92 100644 (file)
@@ -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);
         }
index 3c2df02..0b77b78 100644 (file)
 #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      */