mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge branch 'bugfix/fix_ble_gen_rpa_by_host' into 'master'
Bluedroid: fix ble rpa generate and update by host See merge request espressif/esp-idf!19617
This commit is contained in:
commit
6014e92a8d
@ -56,8 +56,9 @@ static void btm_gen_resolve_paddr_cmpl(tSMP_ENC *p)
|
|||||||
p_cb->private_addr[5] = p->param_buf[0];
|
p_cb->private_addr[5] = p->param_buf[0];
|
||||||
p_cb->private_addr[4] = p->param_buf[1];
|
p_cb->private_addr[4] = p->param_buf[1];
|
||||||
p_cb->private_addr[3] = p->param_buf[2];
|
p_cb->private_addr[3] = p->param_buf[2];
|
||||||
|
|
||||||
/* set it to controller */
|
/* set it to controller */
|
||||||
btsnd_hcic_ble_set_random_addr(p_cb->private_addr);
|
btm_ble_set_random_addr(p_cb->private_addr);
|
||||||
|
|
||||||
p_cb->exist_addr_bit |= BTM_BLE_GAP_ADDR_BIT_RESOLVABLE;
|
p_cb->exist_addr_bit |= BTM_BLE_GAP_ADDR_BIT_RESOLVABLE;
|
||||||
memcpy(p_cb->resolvale_addr, p_cb->private_addr, BD_ADDR_LEN);
|
memcpy(p_cb->resolvale_addr, p_cb->private_addr, BD_ADDR_LEN);
|
||||||
@ -66,23 +67,6 @@ static void btm_gen_resolve_paddr_cmpl(tSMP_ENC *p)
|
|||||||
p_cb->set_local_privacy_cback = NULL;
|
p_cb->set_local_privacy_cback = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (btm_cb.ble_ctr_cb.inq_var.adv_mode == BTM_BLE_ADV_ENABLE){
|
|
||||||
BTM_TRACE_DEBUG("Advertise with new resolvable private address, now.");
|
|
||||||
/**
|
|
||||||
* Restart advertising, using new resolvable private address
|
|
||||||
*/
|
|
||||||
btm_ble_stop_adv();
|
|
||||||
btm_ble_start_adv();
|
|
||||||
}
|
|
||||||
if (btm_cb.ble_ctr_cb.inq_var.state == BTM_BLE_SCANNING){
|
|
||||||
BTM_TRACE_DEBUG("Scan with new resolvable private address, now.");
|
|
||||||
/**
|
|
||||||
* Restart scaning, using new resolvable private address
|
|
||||||
*/
|
|
||||||
btm_ble_stop_scan();
|
|
||||||
btm_ble_start_scan();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* start a periodical timer to refresh random addr */
|
/* start a periodical timer to refresh random addr */
|
||||||
btu_stop_timer_oneshot(&p_cb->raddr_timer_ent);
|
btu_stop_timer_oneshot(&p_cb->raddr_timer_ent);
|
||||||
#if (BTM_BLE_CONFORMANCE_TESTING == TRUE)
|
#if (BTM_BLE_CONFORMANCE_TESTING == TRUE)
|
||||||
|
@ -4119,6 +4119,59 @@ tBTM_STATUS btm_ble_stop_adv(void)
|
|||||||
return rt;
|
return rt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tBTM_STATUS btm_ble_set_random_addr(BD_ADDR random_bda)
|
||||||
|
{
|
||||||
|
tBTM_STATUS rt = BTM_SUCCESS;
|
||||||
|
|
||||||
|
osi_mutex_lock(&adv_enable_lock, OSI_MUTEX_MAX_TIMEOUT);
|
||||||
|
osi_mutex_lock(&scan_enable_lock, OSI_MUTEX_MAX_TIMEOUT);
|
||||||
|
|
||||||
|
if (btm_cb.ble_ctr_cb.inq_var.adv_mode == BTM_BLE_ADV_ENABLE) {
|
||||||
|
if (btsnd_hcic_ble_set_adv_enable (BTM_BLE_ADV_DISABLE)) {
|
||||||
|
osi_sem_take(&adv_enable_sem, OSI_SEM_MAX_TIMEOUT);
|
||||||
|
rt = adv_enable_status;
|
||||||
|
} else {
|
||||||
|
rt = BTM_BAD_VALUE_RET;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (BTM_BLE_IS_DISCO_ACTIVE(btm_cb.ble_ctr_cb.scan_activity)) {
|
||||||
|
if (btsnd_hcic_ble_set_scan_enable (BTM_BLE_SCAN_DISABLE, BTM_BLE_SCAN_DUPLICATE_DISABLE)) {
|
||||||
|
osi_sem_take(&scan_enable_sem, OSI_SEM_MAX_TIMEOUT);
|
||||||
|
rt = scan_enable_status;
|
||||||
|
} else {
|
||||||
|
rt = BTM_BAD_VALUE_RET;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rt == BTM_SUCCESS) {
|
||||||
|
btsnd_hcic_ble_set_random_addr(random_bda);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (btm_cb.ble_ctr_cb.inq_var.adv_mode == BTM_BLE_ADV_ENABLE) {
|
||||||
|
if (btsnd_hcic_ble_set_adv_enable (BTM_BLE_ADV_ENABLE)) {
|
||||||
|
osi_sem_take(&adv_enable_sem, OSI_SEM_MAX_TIMEOUT);
|
||||||
|
rt = adv_enable_status;
|
||||||
|
} else {
|
||||||
|
rt = BTM_BAD_VALUE_RET;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (BTM_BLE_IS_DISCO_ACTIVE(btm_cb.ble_ctr_cb.scan_activity)) {
|
||||||
|
if (btsnd_hcic_ble_set_scan_enable (BTM_BLE_SCAN_ENABLE, btm_cb.ble_ctr_cb.inq_var.scan_duplicate_filter)) {
|
||||||
|
osi_sem_take(&scan_enable_sem, OSI_SEM_MAX_TIMEOUT);
|
||||||
|
rt = scan_enable_status;
|
||||||
|
} else {
|
||||||
|
rt = BTM_BAD_VALUE_RET;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
osi_mutex_unlock(&adv_enable_lock);
|
||||||
|
osi_mutex_unlock(&scan_enable_lock);
|
||||||
|
|
||||||
|
return rt;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
**
|
**
|
||||||
|
@ -419,6 +419,7 @@ tBTM_STATUS btm_ble_stop_adv(void);
|
|||||||
tBTM_STATUS btm_ble_start_scan(void);
|
tBTM_STATUS btm_ble_start_scan(void);
|
||||||
void btm_ble_create_ll_conn_complete (UINT8 status);
|
void btm_ble_create_ll_conn_complete (UINT8 status);
|
||||||
void btm_ble_create_conn_cancel_complete (UINT8 *p);
|
void btm_ble_create_conn_cancel_complete (UINT8 *p);
|
||||||
|
tBTM_STATUS btm_ble_set_random_addr(BD_ADDR random_bda);
|
||||||
|
|
||||||
/* LE security function from btm_sec.c */
|
/* LE security function from btm_sec.c */
|
||||||
#if SMP_INCLUDED == TRUE
|
#if SMP_INCLUDED == TRUE
|
||||||
|
Loading…
Reference in New Issue
Block a user