From a2425ac3e7bf0131820f5448716e999955105833 Mon Sep 17 00:00:00 2001 From: zhanghaipeng Date: Thu, 28 Dec 2023 17:30:57 +0800 Subject: [PATCH] fix(bt/bluedroid): Fix ble app unregister no event --- .../bt/host/bluedroid/bta/gatt/bta_gattc_act.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/components/bt/host/bluedroid/bta/gatt/bta_gattc_act.c b/components/bt/host/bluedroid/bta/gatt/bta_gattc_act.c index 8bd3fecd77..b2302fa469 100644 --- a/components/bt/host/bluedroid/bta/gatt/bta_gattc_act.c +++ b/components/bt/host/bluedroid/bta/gatt/bta_gattc_act.c @@ -122,9 +122,9 @@ void bta_gattc_reset_discover_st(tBTA_GATTC_SERV *p_srcb, tBTA_GATT_STATUS statu static void bta_gattc_enable(tBTA_GATTC_CB *p_cb) { APPL_TRACE_DEBUG("bta_gattc_enable"); - /* This is a workaround because the task priority of btc (BTA_GATTC_CLOSE_EVT - in that task) is lower than the priority of the btu task. - Consequently, the p_cb->state fails to be restored to BTA_GATTC_STATE_DISABLED + /* This is a workaround because the task priority of btc (BTA_GATTC_CLOSE_EVT + in that task) is lower than the priority of the btu task. + Consequently, the p_cb->state fails to be restored to BTA_GATTC_STATE_DISABLED and remains in the BTA_GATTC_STATE_DISABLING state. */ if (p_cb->state == BTA_GATTC_STATE_DISABLED || p_cb->state == BTA_GATTC_STATE_DISABLING) { /* initialize control block */ @@ -161,7 +161,6 @@ void bta_gattc_disable(tBTA_GATTC_CB *p_cb) for (i = 0; i < BTA_GATTC_CL_MAX; i ++) { if (p_cb->cl_rcb[i].in_use) { p_cb->state = BTA_GATTC_STATE_DISABLING; - p_cb->cl_rcb[i].in_use = false; /* don't deregister HH GATT IF */ /* HH GATT IF will be deregistered by bta_hh_le_deregister when disable HH */ #if (defined BTA_HH_LE_INCLUDED && BTA_HH_LE_INCLUDED == TRUE) @@ -204,9 +203,9 @@ void bta_gattc_register(tBTA_GATTC_CB *p_cb, tBTA_GATTC_DATA *p_data) cb_data.reg_oper.status = BTA_GATT_NO_RESOURCES; /* check if GATTC module is already enabled . Else enable */ - /* This is a workaround because the task priority of btc (BTA_GATTC_CLOSE_EVT - in that task) is lower than the priority of the btu task. - Consequently, the p_cb->state fails to be restored to BTA_GATTC_STATE_DISABLED + /* This is a workaround because the task priority of btc (BTA_GATTC_CLOSE_EVT + in that task) is lower than the priority of the btu task. + Consequently, the p_cb->state fails to be restored to BTA_GATTC_STATE_DISABLED and remains in the BTA_GATTC_STATE_DISABLING state. */ if (p_cb->state == BTA_GATTC_STATE_DISABLED || p_cb->state == BTA_GATTC_STATE_DISABLING) { bta_gattc_enable (p_cb);