From 911251da6fee59b25860d61292da5cbb5bdde8b5 Mon Sep 17 00:00:00 2001 From: Zhi Wei Jian Date: Wed, 7 Jan 2026 17:24:00 +0800 Subject: [PATCH] fix(ble/bluedroid): disable rsp timer and ind_ack timer (cherry picked from commit 7ff9484c468f0177d488cc4d663dda492197609c) Co-authored-by: zhiweijian --- components/bt/host/bluedroid/stack/btm/btm_sec.c | 3 ++- components/bt/host/bluedroid/stack/btu/btu_task.c | 4 ++++ .../bt/host/bluedroid/stack/gap/include/gap_int.h | 2 ++ .../bt/host/bluedroid/stack/gatt/gatt_main.c | 5 ++++- .../bt/host/bluedroid/stack/gatt/gatt_utils.c | 14 +++++++++++++- .../host/bluedroid/stack/gatt/include/gatt_int.h | 4 +++- 6 files changed, 28 insertions(+), 4 deletions(-) diff --git a/components/bt/host/bluedroid/stack/btm/btm_sec.c b/components/bt/host/bluedroid/stack/btm/btm_sec.c index 94f05ff98f4..2a04bb38ee2 100644 --- a/components/bt/host/bluedroid/stack/btm/btm_sec.c +++ b/components/bt/host/bluedroid/stack/btm/btm_sec.c @@ -2641,6 +2641,7 @@ tBTM_STATUS btm_sec_mx_access_request (BD_ADDR bd_addr, UINT16 psm, BOOLEAN is_o ** Returns void ** *******************************************************************************/ +#if (CLASSIC_BT_INCLUDED == TRUE) #if (SMP_INCLUDED == TRUE) void btm_sec_conn_req (UINT8 *bda, UINT8 *dc) { @@ -2701,7 +2702,7 @@ void btm_sec_conn_req (UINT8 *bda, UINT8 *dc) } } #endif ///SMP_INCLUDED == TRUE - +#endif // (CLASSIC_BT_INCLUDED == TRUE) /******************************************************************************* ** ** Function btm_sec_bond_cancel_complete diff --git a/components/bt/host/bluedroid/stack/btu/btu_task.c b/components/bt/host/bluedroid/stack/btu/btu_task.c index 91c1f43fb74..f6ce7e44269 100644 --- a/components/bt/host/bluedroid/stack/btu/btu_task.c +++ b/components/bt/host/bluedroid/stack/btu/btu_task.c @@ -376,11 +376,15 @@ static void btu_general_alarm_process(void *param) break; case BTU_TTYPE_ATT_WAIT_FOR_RSP: +#if (GATTC_INCLUDED == TRUE) gatt_rsp_timeout(p_tle); +#endif // (GATTC_INCLUDED == TRUE) break; case BTU_TTYPE_ATT_WAIT_FOR_IND_ACK: +#if (GATTC_INCLUDED == TRUE) gatt_ind_ack_timeout(p_tle); +#endif // (GATTC_INCLUDED == TRUE) break; #if (defined(SMP_INCLUDED) && SMP_INCLUDED == TRUE) diff --git a/components/bt/host/bluedroid/stack/gap/include/gap_int.h b/components/bt/host/bluedroid/stack/gap/include/gap_int.h index 25c48c69c88..dc6353c3250 100644 --- a/components/bt/host/bluedroid/stack/gap/include/gap_int.h +++ b/components/bt/host/bluedroid/stack/gap/include/gap_int.h @@ -128,7 +128,9 @@ typedef struct { } tGAP_CLCB; typedef struct { +#if (CLASSIC_BT_INCLUDED == TRUE) tGAP_INFO blk[GAP_MAX_BLOCKS]; +#endif // (CLASSIC_BT_INCLUDED == TRUE) UINT8 trace_level; //tGAP_FINDADDR_CB findaddr_cb; /* Contains the control block for finding a device addr */ //tBTM_INQ_INFO *cur_inqptr; diff --git a/components/bt/host/bluedroid/stack/gatt/gatt_main.c b/components/bt/host/bluedroid/stack/gatt/gatt_main.c index 2e29ea52e35..15ea739ee62 100644 --- a/components/bt/host/bluedroid/stack/gatt/gatt_main.c +++ b/components/bt/host/bluedroid/stack/gatt/gatt_main.c @@ -180,12 +180,15 @@ void gatt_free(void) fixed_queue_free(p_tcb->pending_enc_clcb, NULL); p_tcb->pending_enc_clcb = NULL; #endif // (SMP_INCLUDED == TRUE) - +#if (GATTS_INCLUDED == TRUE) btu_free_timer(&p_tcb->conf_timer_ent); memset(&p_tcb->conf_timer_ent, 0, sizeof(TIMER_LIST_ENT)); +#endif // (GATTS_INCLUDED == TRUE) +#if (GATTC_INCLUDED == TRUE) btu_free_timer(&p_tcb->ind_ack_timer_ent); memset(&p_tcb->ind_ack_timer_ent, 0, sizeof(TIMER_LIST_ENT)); +#endif // #if (GATTC_INCLUDED == TRUE) #if (GATTS_INCLUDED == TRUE) fixed_queue_free(p_tcb->sr_cmd.multi_rsp_q, NULL); diff --git a/components/bt/host/bluedroid/stack/gatt/gatt_utils.c b/components/bt/host/bluedroid/stack/gatt/gatt_utils.c index cf2b1b01238..113f43952fd 100644 --- a/components/bt/host/bluedroid/stack/gatt/gatt_utils.c +++ b/components/bt/host/bluedroid/stack/gatt/gatt_utils.c @@ -1247,6 +1247,8 @@ void gatt_start_rsp_timer(UINT16 clcb_idx) btu_start_timer (&p_clcb->rsp_timer_ent, BTU_TTYPE_ATT_WAIT_FOR_RSP, GATT_WAIT_FOR_RSP_TOUT); } + +#if (GATTS_INCLUDED == TRUE) /******************************************************************************* ** ** Function gatt_start_conf_timer @@ -1262,6 +1264,9 @@ void gatt_start_conf_timer(tGATT_TCB *p_tcb) btu_start_timer (&p_tcb->conf_timer_ent, BTU_TTYPE_ATT_WAIT_FOR_RSP, GATT_WAIT_FOR_RSP_TOUT); } +#endif // (GATTS_INCLUDED == TRUE) + +#if (GATTC_INCLUDED == TRUE) /******************************************************************************* ** ** Function gatt_start_ind_ack_timer @@ -1279,6 +1284,7 @@ void gatt_start_ind_ack_timer(tGATT_TCB *p_tcb) GATT_WAIT_FOR_IND_ACK_TOUT); } + /******************************************************************************* ** ** Function gatt_rsp_timeout @@ -1337,6 +1343,7 @@ void gatt_ind_ack_timeout(TIMER_LIST_ENT *p_tle) attp_send_cl_msg(((tGATT_TCB *)p_tle->param), 0, GATT_HANDLE_VALUE_CONF, NULL); } +#endif // (GATTC_INCLUDED == TRUE) #if (GATTS_INCLUDED == TRUE) /******************************************************************************* @@ -2095,6 +2102,7 @@ BOOLEAN gatt_find_specific_app_in_hold_link(tGATT_TCB *p_tcb, tGATT_IF p_gatt_if return found; } +#if (GATTC_INCLUDED == TRUE) /******************************************************************************* ** ** Function gatt_cmd_enq @@ -2148,6 +2156,7 @@ tGATT_CLCB *gatt_cmd_dequeue(tGATT_TCB *p_tcb, UINT8 *p_op_code) return p_clcb; } +#endif // (GATTC_INCLUDED == TRUE) /******************************************************************************* ** @@ -2316,9 +2325,12 @@ void gatt_cleanup_upon_disc(BD_ADDR bda, UINT16 reason, tBT_TRANSPORT transport) gatt_clcb_dealloc(p_clcb); } } - +#if (GATTC_INCLUDED == TRUE) btu_free_timer (&p_tcb->ind_ack_timer_ent); +#endif // #if (GATTC_INCLUDED == TRUE) +#if (GATTS_INCLUDED == TRUE) btu_free_timer (&p_tcb->conf_timer_ent); +#endif // (GATTS_INCLUDED == TRUE) #if (SMP_INCLUDED == TRUE) gatt_free_pending_enc_queue(p_tcb); #endif // (SMP_INCLUDED == TRUE) diff --git a/components/bt/host/bluedroid/stack/gatt/include/gatt_int.h b/components/bt/host/bluedroid/stack/gatt/include/gatt_int.h index b0984f479c7..dbb45827428 100644 --- a/components/bt/host/bluedroid/stack/gatt/include/gatt_int.h +++ b/components/bt/host/bluedroid/stack/gatt/include/gatt_int.h @@ -397,16 +397,18 @@ typedef struct { /* server response data */ #if (GATTS_INCLUDED == TRUE) tGATT_SR_CMD sr_cmd; -#endif ///GATTS_INCLUDED == TRUE UINT16 indicate_handle; TIMER_LIST_ENT conf_timer_ent; /* peer confirm to indication timer */ +#endif ///GATTS_INCLUDED == TRUE UINT8 prep_cnt[GATT_MAX_APPS]; +#if (GATTC_INCLUDED == TRUE) UINT8 ind_count; tGATT_CMD_Q cl_cmd_q[GATT_CL_MAX_LCB]; TIMER_LIST_ENT ind_ack_timer_ent; /* local app confirm to indication timer */ +#endif // (GATTC_INCLUDED == TRUE) UINT8 pending_cl_req; UINT8 next_slot_inq; /* index of next available slot in queue */ #if (GATTS_ROBUST_CACHING_ENABLED == TRUE)