component/bt: fix data length update failed

This commit is contained in:
xiewenxiang 2021-09-08 19:37:25 +08:00
parent d480469aa3
commit 594f604e7d
2 changed files with 14 additions and 10 deletions

View File

@ -5364,6 +5364,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) {
@ -5376,14 +5386,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

@ -954,8 +954,10 @@ 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();
p_acl_cb->data_len_updating = true;
btsnd_hcic_ble_set_data_length(p_acl_cb->hci_handle, data_length, data_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 {