mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge branch 'bugfix/btdm_fix_doc_and_host_bug_backport_v4.0' into 'release/v4.0'
Bugfix/btdm fix doc and host bug backport v4.0 See merge request espressif/esp-idf!6954
This commit is contained in:
commit
b0d6c01b04
@ -409,6 +409,16 @@ bool config_save(const config_t *config, const char *filename)
|
||||
for (const list_node_t *node = list_begin(config->sections); node != list_end(config->sections); node = list_next(node)) {
|
||||
const section_t *section = (const section_t *)list_node(node);
|
||||
w_cnt = snprintf(line, 1024, "[%s]\n", section->name);
|
||||
if(w_cnt < 0) {
|
||||
OSI_TRACE_ERROR("snprintf error w_cnt %d.",w_cnt);
|
||||
err_code |= 0x10;
|
||||
goto error;
|
||||
}
|
||||
if(w_cnt_total + w_cnt > config_size + 100) {
|
||||
OSI_TRACE_ERROR("%s, memcpy size (w_cnt + w_cnt_total = %d) is larger than buffer size (config_size = %d).", __func__, (w_cnt + w_cnt_total),config_size);
|
||||
err_code |= 0x20;
|
||||
goto error;
|
||||
}
|
||||
OSI_TRACE_DEBUG("section name: %s, w_cnt + w_cnt_total = %d\n", section->name, w_cnt + w_cnt_total);
|
||||
memcpy(buf + w_cnt_total, line, w_cnt);
|
||||
w_cnt_total += w_cnt;
|
||||
@ -417,6 +427,16 @@ bool config_save(const config_t *config, const char *filename)
|
||||
const entry_t *entry = (const entry_t *)list_node(enode);
|
||||
OSI_TRACE_DEBUG("(key, val): (%s, %s)\n", entry->key, entry->value);
|
||||
w_cnt = snprintf(line, 1024, "%s = %s\n", entry->key, entry->value);
|
||||
if(w_cnt < 0) {
|
||||
OSI_TRACE_ERROR("snprintf error w_cnt %d.",w_cnt);
|
||||
err_code |= 0x10;
|
||||
goto error;
|
||||
}
|
||||
if(w_cnt_total + w_cnt > config_size + 100) {
|
||||
OSI_TRACE_ERROR("%s, memcpy size (w_cnt + w_cnt_total = %d) is larger than buffer size.(config_size = %d)", __func__, w_cnt + w_cnt_total,config_size);
|
||||
err_code |= 0x20;
|
||||
goto error;
|
||||
}
|
||||
OSI_TRACE_DEBUG("%s, w_cnt + w_cnt_total = %d", __func__, w_cnt + w_cnt_total);
|
||||
memcpy(buf + w_cnt_total, line, w_cnt);
|
||||
w_cnt_total += w_cnt;
|
||||
|
@ -896,9 +896,10 @@ bt_status_t btc_storage_get_bonded_ble_devices_list(esp_ble_bond_dev_t *bond_dev
|
||||
if (_btc_storage_get_ble_bonding_key(&bd_addr, BTM_LE_KEY_PID, buffer, sizeof(tBTM_LE_PID_KEYS)) == BT_STATUS_SUCCESS) {
|
||||
bond_dev->bond_key.key_mask |= ESP_BLE_ID_KEY_MASK;
|
||||
tBTM_LE_PID_KEYS *pid_key = (tBTM_LE_PID_KEYS *) buffer;
|
||||
memcpy(&bond_dev->bond_key.pid_key.irk, pid_key->irk, BT_OCTET16_LEN);
|
||||
//Note: The memory size of the pid_key.addr_type in bond_key is different from that of (tBTM_LE_PID_KEYS) *pid_key.
|
||||
memcpy(&bond_dev->bond_key.pid_key.irk, pid_key->irk, ESP_BT_OCTET16_LEN);
|
||||
bond_dev->bond_key.pid_key.addr_type = pid_key->addr_type;
|
||||
memcpy(&bond_dev->bond_key.pid_key.static_addr, pid_key->static_addr, sizeof(BD_ADDR));
|
||||
memcpy(&bond_dev->bond_key.pid_key.static_addr, pid_key->static_addr, ESP_BD_ADDR_LEN);
|
||||
}
|
||||
//serch for the next bond device
|
||||
bond_dev++;
|
||||
|
@ -711,8 +711,12 @@ void btc_dm_sec_cb_handler(btc_msg_t *msg)
|
||||
btc_dm_cb.pairing_cb.ble.is_pid_key_rcvd = TRUE;
|
||||
memcpy(&btc_dm_cb.pairing_cb.ble.pid_key, &p_data->ble_key.p_key_value->pid_key,
|
||||
sizeof(tBTM_LE_PID_KEYS));
|
||||
memcpy(¶m.ble_security.ble_key.p_key_value.pid_key,
|
||||
&p_data->ble_key.p_key_value->pid_key, sizeof(tBTM_LE_PID_KEYS));
|
||||
//Note: The memory size of the addr_type in ble_security.ble_key.p_key_value.pid_key is different from that of p_data->ble_key.p_key_value->pid_key.
|
||||
memcpy(¶m.ble_security.ble_key.p_key_value.pid_key.irk,
|
||||
&p_data->ble_key.p_key_value->pid_key.irk, ESP_BT_OCTET16_LEN);
|
||||
param.ble_security.ble_key.p_key_value.pid_key.addr_type = p_data->ble_key.p_key_value->pid_key.addr_type;
|
||||
memcpy(¶m.ble_security.ble_key.p_key_value.pid_key.static_addr,
|
||||
&p_data->ble_key.p_key_value->pid_key.static_addr, ESP_BD_ADDR_LEN);
|
||||
break;
|
||||
}
|
||||
case BTM_LE_KEY_PCSRK: {
|
||||
|
@ -589,7 +589,7 @@ static void btc_blufi_wifi_conn_report(uint8_t opmode, uint8_t sta_conn_state, u
|
||||
*p++ = info->softap_max_conn_num;
|
||||
}
|
||||
if (info->softap_channel_set) {
|
||||
*p++ = BLUFI_TYPE_DATA_SUBTYPE_SOFTAP_MAX_CONN_NUM;
|
||||
*p++ = BLUFI_TYPE_DATA_SUBTYPE_SOFTAP_CHANNEL;
|
||||
*p++ = 1;
|
||||
*p++ = info->softap_channel;
|
||||
}
|
||||
|
@ -2071,7 +2071,7 @@ void BTM_BleGetWhiteListSize(uint16_t *length)
|
||||
{
|
||||
tBTM_BLE_CB *p_cb = &btm_cb.ble_ctr_cb;
|
||||
if (p_cb->white_list_avail_size == 0) {
|
||||
BTM_TRACE_DEBUG("%s Whitelist full.", __func__);
|
||||
BTM_TRACE_WARNING("%s Whitelist full.", __func__);
|
||||
}
|
||||
*length = p_cb->white_list_avail_size;
|
||||
return;
|
||||
|
@ -292,8 +292,11 @@ void btm_ble_add_resolving_list_entry_complete(UINT8 *p, UINT16 evt_len)
|
||||
}
|
||||
} else if (status == HCI_ERR_MEMORY_FULL) { /* BT_ERROR_CODE_MEMORY_CAPACITY_EXCEEDED */
|
||||
btm_cb.ble_ctr_cb.resolving_list_avail_size = 0;
|
||||
BTM_TRACE_DEBUG("%s Resolving list Full ", __func__);
|
||||
BTM_TRACE_WARNING("%s Resolving list Full ", __func__);
|
||||
} else {
|
||||
BTM_TRACE_ERROR("%s Add resolving list error %d ", __func__, status);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
@ -811,6 +814,8 @@ BOOLEAN btm_ble_resolving_list_load_dev(tBTM_SEC_DEV_REC *p_dev_rec)
|
||||
} else {
|
||||
btm_ble_enable_resolving_list(BTM_BLE_RL_INIT);
|
||||
}
|
||||
} else {
|
||||
BTM_TRACE_WARNING("%s Resolving list full ", __func__);
|
||||
}
|
||||
} else {
|
||||
BTM_TRACE_DEBUG("Device already in Resolving list\n");
|
||||
|
@ -392,7 +392,7 @@ tGATT_STATUS gatts_db_read_attr_value_by_type (tGATT_TCB *p_tcb,
|
||||
p_rsp->len += (len + 2);
|
||||
*p_len -= (len + 2);
|
||||
} else {
|
||||
GATT_TRACE_ERROR("format mismatch");
|
||||
GATT_TRACE_WARNING("format mismatch");
|
||||
status = GATT_NO_RESOURCES;
|
||||
break;
|
||||
}
|
||||
|
@ -1760,13 +1760,13 @@ void smp_match_dhkey_checks(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
|
||||
SMP_TRACE_DEBUG("%s\n", __func__);
|
||||
|
||||
if (memcmp(p_data->key.p_data, p_cb->remote_dhkey_check, BT_OCTET16_LEN)) {
|
||||
SMP_TRACE_WARNING ("dhkey chcks do no match\n");
|
||||
SMP_TRACE_WARNING ("dhkey checks do no match\n");
|
||||
p_cb->failure = reason;
|
||||
smp_sm_event(p_cb, SMP_AUTH_CMPL_EVT, &reason);
|
||||
return;
|
||||
}
|
||||
|
||||
SMP_TRACE_EVENT ("dhkey chcks match\n");
|
||||
SMP_TRACE_EVENT ("dhkey checks match\n");
|
||||
|
||||
/* compare the max encryption key size, and save the smaller one for the link */
|
||||
if (p_cb->peer_enc_size < p_cb->loc_enc_size) {
|
||||
|
@ -551,7 +551,7 @@ case ESP_GATTC_SEARCH_CMPL_EVT:
|
||||
ESP_LOGE(GATTC_TAG, "search service failed, error status = %x", p_data->search_cmpl.status);
|
||||
break;
|
||||
}
|
||||
conn_id = p_data->search_cmpl.conn_id;h
|
||||
conn_id = p_data->search_cmpl.conn_id;
|
||||
if (get_server){
|
||||
uint16_t count = 0;
|
||||
esp_gatt_status_t status = esp_ble_gattc_get_attr_count( gattc_if,
|
||||
|
Loading…
Reference in New Issue
Block a user