From 615dcb41153bcedd59c130ebdf412bfb48ae5136 Mon Sep 17 00:00:00 2001 From: zwj Date: Tue, 6 Sep 2022 21:12:30 +0800 Subject: [PATCH 1/3] fix calling esp_ble_get_cur_sendable_packets_num() sometimes crashes when bluetooth is disconnecting --- components/bt/host/bluedroid/stack/l2cap/l2c_api.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/components/bt/host/bluedroid/stack/l2cap/l2c_api.c b/components/bt/host/bluedroid/stack/l2cap/l2c_api.c index 2377d66e65..ed582a21b7 100644 --- a/components/bt/host/bluedroid/stack/l2cap/l2c_api.c +++ b/components/bt/host/bluedroid/stack/l2cap/l2c_api.c @@ -2344,7 +2344,15 @@ void l2ble_update_att_acl_pkt_num(UINT8 type, tl2c_buff_param_t *param) xSemaphoreGive(buff_semaphore); break; } - fixed_queue_t * queue = p_lcb->p_fixed_ccbs[L2CAP_ATT_CID - L2CAP_FIRST_FIXED_CHNL]->xmit_hold_q; + + tL2C_CCB *p_ccb = p_lcb->p_fixed_ccbs[L2CAP_ATT_CID - L2CAP_FIRST_FIXED_CHNL]; + if(p_ccb == NULL) { + L2CAP_TRACE_ERROR("%s not found p_ccb", __func__); + xSemaphoreGive(buff_semaphore); + break; + } + + fixed_queue_t * queue = p_ccb->xmit_hold_q; att_max_num = MIN(p_lcb->link_xmit_quota, L2CAP_CACHE_ATT_ACL_NUM); if (queue == NULL){ L2CAP_TRACE_ERROR("%s not found queue", __func__); From 284b77e6a57816e0dbf3f5840e26355a26ec0523 Mon Sep 17 00:00:00 2001 From: cjin Date: Thu, 8 Sep 2022 15:44:31 +0800 Subject: [PATCH 2/3] fix err using rpa for confirmation calculation --- components/bt/host/bluedroid/stack/btm/btm_ble.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/bt/host/bluedroid/stack/btm/btm_ble.c b/components/bt/host/bluedroid/stack/btm/btm_ble.c index 4f41cd5208..c55e31124b 100644 --- a/components/bt/host/bluedroid/stack/btm/btm_ble.c +++ b/components/bt/host/bluedroid/stack/btm/btm_ble.c @@ -1949,7 +1949,7 @@ void btm_ble_conn_complete(UINT8 *p, UINT16 evt_len, BOOLEAN enhanced) } #if (BLE_PRIVACY_SPT == TRUE ) peer_addr_type = bda_type; - match = btm_identity_addr_to_random_pseudo (bda, &bda_type, TRUE); + match = btm_identity_addr_to_random_pseudo (bda, &bda_type, FALSE); /* possiblly receive connection complete with resolvable random on slave role while the device has been paired */ From b70ffe519ffc8294fdfa2883557c2fb0ac4fddb9 Mon Sep 17 00:00:00 2001 From: cjin Date: Thu, 25 Aug 2022 21:15:35 +0800 Subject: [PATCH 3/3] fix on data len change cmd malfunction --- components/bt/host/bluedroid/stack/btm/btm_ble_gap.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/components/bt/host/bluedroid/stack/btm/btm_ble_gap.c b/components/bt/host/bluedroid/stack/btm/btm_ble_gap.c index f1bbdfb6e6..e16f298256 100644 --- a/components/bt/host/bluedroid/stack/btm/btm_ble_gap.c +++ b/components/bt/host/bluedroid/stack/btm/btm_ble_gap.c @@ -4153,10 +4153,11 @@ void btm_ble_read_remote_features_complete(UINT8 *p) btsnd_hcic_rmt_ver_req (p_acl_cb->hci_handle); } else{ + 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 (p_acl_cb->transport == BT_TRANSPORT_LE) { - 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 (HCI_LE_DATA_LEN_EXT_SUPPORTED(p_acl_cb->peer_le_features) && + (p_acl_cb->data_length_params.tx_len != data_length)) { p_acl_cb->data_len_updating = true; btsnd_hcic_ble_set_data_length(p_acl_cb->hci_handle, data_length, data_txtime); }