Merge branch 'bugfix/btdm_fix_doc_and_host_bug_backport_v3.3' into 'release/v3.3'

Bugfix/btdm fix doc and host bug backport v3.3

See merge request espressif/esp-idf!6955
This commit is contained in:
Jiang Jiang Jian 2019-12-18 14:19:14 +08:00
commit a109f7de57
9 changed files with 41 additions and 11 deletions

View file

@ -893,9 +893,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++;

View file

@ -706,8 +706,12 @@ void btc_dm_sec_cb_handler(btc_msg_t *msg)
pairing_cb.ble.is_pid_key_rcvd = TRUE;
memcpy(&pairing_cb.ble.pid_key, &p_data->ble_key.p_key_value->pid_key,
sizeof(tBTM_LE_PID_KEYS));
memcpy(&param.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(&param.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(&param.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: {

View file

@ -585,7 +585,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;
}

View file

@ -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.", __func__, w_cnt + w_cnt_total);
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.", __func__, w_cnt + w_cnt_total);
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;

View file

@ -2069,7 +2069,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;

View file

@ -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");

View file

@ -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;
}

View file

@ -1715,13 +1715,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) {

View file

@ -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,