This change configures device privacy mode for each
remote device added to the resolving list.
Before exercising the privacy command it confirms
whether the set privacy HCI command is supported.
This patch is based on CAF patch by niarora@codeaurora.org
36fa3c528d2ae58e0b3f969665e3d25986dcdbaa
Test: manual
Bug:
35935853
Change-Id: I839045ccc3ddb73dc9c0cbe05d87c25dae9b9236
btsnd_hcic_ble_add_device_resolving_list(
p_dev_rec->ble.static_addr_type, p_dev_rec->ble.static_addr,
peer_irk, local_irk);
+
+ if (controller_get_interface()->supports_ble_privacy()) {
+ BTM_TRACE_DEBUG("%s: adding device privacy mode", __func__);
+ btsnd_hcic_ble_set_privacy_mode(p_dev_rec->ble.static_addr_type,
+ p_dev_rec->ble.static_addr, 0x01);
+ }
} else {
uint8_t param[40] = {0};
uint8_t* p = param;
btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p);
}
+void btsnd_hcic_ble_set_privacy_mode(uint8_t addr_type_peer, BD_ADDR bda_peer,
+ uint8_t privacy_type) {
+ BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE);
+ uint8_t* pp = (uint8_t*)(p + 1);
+
+ p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_BLE_SET_PRIVACY_MODE;
+ p->offset = 0;
+
+ UINT16_TO_STREAM(pp, HCI_BLE_SET_PRIVACY_MODE);
+ UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_BLE_SET_PRIVACY_MODE);
+ UINT8_TO_STREAM(pp, addr_type_peer);
+ BDADDR_TO_STREAM(pp, bda_peer);
+ UINT8_TO_STREAM(pp, privacy_type);
+
+ btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p);
+}
+
void btsnd_hcic_ble_clear_resolving_list(void) {
BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE);
uint8_t* pp = (uint8_t*)(p + 1);
#define HCI_LE_SET_EXTENDED_SCAN_PARAMETERS (0x0041 | HCI_GRP_BLE_CMDS)
#define HCI_LE_SET_EXTENDED_SCAN_ENABLE (0x0042 | HCI_GRP_BLE_CMDS)
#define HCI_LE_EXTENDED_CREATE_CONNECTION (0x0043 | HCI_GRP_BLE_CMDS)
+#define HCI_BLE_SET_PRIVACY_MODE (0x004E | HCI_GRP_BLE_CMDS)
/* LE Get Vendor Capabilities Command OCF */
#define HCI_BLE_VENDOR_CAP_OCF (0x0153 | HCI_GRP_VENDOR_SPECIFIC)
#define HCIC_PARAM_SIZE_BLE_ADD_DEV_RESOLVING_LIST (7 + HCIC_BLE_IRK_SIZE * 2)
#define HCIC_PARAM_SIZE_BLE_RM_DEV_RESOLVING_LIST 7
+#define HCIC_PARAM_SIZE_BLE_SET_PRIVACY_MODE 8
#define HCIC_PARAM_SIZE_BLE_CLEAR_RESOLVING_LIST 0
#define HCIC_PARAM_SIZE_BLE_READ_RESOLVING_LIST_SIZE 0
#define HCIC_PARAM_SIZE_BLE_READ_RESOLVABLE_ADDR_PEER 7
extern void btsnd_hcic_ble_rm_device_resolving_list(uint8_t addr_type_peer,
BD_ADDR bda_peer);
+extern void btsnd_hcic_ble_set_privacy_mode(uint8_t addr_type_peer,
+ BD_ADDR bda_peer,
+ uint8_t privacy_type);
+
extern void btsnd_hcic_ble_clear_resolving_list(void);
extern void btsnd_hcic_ble_read_resolvable_addr_peer(uint8_t addr_type_peer,