Merge branch 'bugfix/btdm_ble_data_length_update_fail_v4.0' into 'release/v4.0'

Fix data length update failed(release v4.0)

See merge request espressif/esp-idf!15505
This commit is contained in:
Jiang Jiang Jian 2021-10-18 07:40:49 +00:00
commit 26f7754ca8
2 changed files with 14 additions and 10 deletions

View File

@ -5287,6 +5287,16 @@ void bta_dm_ble_set_data_length(tBTA_DM_MSG *p_data)
APPL_TRACE_ERROR("%s error: Invalid connection remote_bda.", __func__);
return;
}
p_acl_cb->p_set_pkt_data_cback = p_data->ble_set_data_length.p_set_pkt_data_cback;
// if the value of the data length is same, triger callback directly
if(p_data->ble_set_data_length.tx_data_length == p_acl_cb->data_length_params.tx_len) {
if(p_data->ble_set_data_length.p_set_pkt_data_cback) {
(*p_data->ble_set_data_length.p_set_pkt_data_cback)(status, &p_acl_cb->data_length_params);
}
return;
}
if(p_acl_cb->data_len_updating) {
// aleady have one cmd
if(p_acl_cb->data_len_waiting) {
@ -5299,14 +5309,6 @@ void bta_dm_ble_set_data_length(tBTA_DM_MSG *p_data)
return;
}
} else {
p_acl_cb->p_set_pkt_data_cback = p_data->ble_set_data_length.p_set_pkt_data_cback;
// if the value of the data length is same, triger callback directly
if(p_data->ble_set_data_length.tx_data_length == p_acl_cb->data_length_params.tx_len) {
if(p_data->ble_set_data_length.p_set_pkt_data_cback) {
(*p_data->ble_set_data_length.p_set_pkt_data_cback)(status, &p_acl_cb->data_length_params);
}
return;
}
status = BTM_SetBleDataLength(p_data->ble_set_data_length.remote_bda,
p_data->ble_set_data_length.tx_data_length);
}

View File

@ -936,9 +936,11 @@ void btm_read_remote_version_complete (UINT8 *p)
if (HCI_LE_DATA_LEN_EXT_SUPPORTED(p_acl_cb->peer_le_features)) {
uint16_t data_length = controller_get_interface()->get_ble_default_data_packet_length();
uint16_t data_txtime = controller_get_interface()->get_ble_default_data_packet_txtime();
if (data_length != p_acl_cb->data_length_params.tx_len) {
p_acl_cb->data_len_updating = true;
btsnd_hcic_ble_set_data_length(p_acl_cb->hci_handle, data_length, data_txtime);
}
}
l2cble_notify_le_connection (p_acl_cb->remote_addr);
} else {
//slave role, read remote feature