From 9fed90bbb4efd2f70659ce9b1f47539ee0ebbceb Mon Sep 17 00:00:00 2001 From: Jin Cheng Date: Mon, 11 Sep 2023 14:41:27 +0800 Subject: [PATCH 1/3] fix(bt/bluedroid): Fixed the issue of uninitialized parameters in event BTA_AG_WBS_EVT --- components/bt/host/bluedroid/bta/hf_ag/bta_ag_act.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/components/bt/host/bluedroid/bta/hf_ag/bta_ag_act.c b/components/bt/host/bluedroid/bta/hf_ag/bta_ag_act.c index cc92328267b7..6bb9de6cc153 100644 --- a/components/bt/host/bluedroid/bta/hf_ag/bta_ag_act.c +++ b/components/bt/host/bluedroid/bta/hf_ag/bta_ag_act.c @@ -785,14 +785,17 @@ void bta_ag_rcvd_slc_ready(tBTA_AG_SCB *p_scb, tBTA_AG_DATA *p_data) void bta_ag_setcodec(tBTA_AG_SCB *p_scb, tBTA_AG_DATA *p_data) { #if (BTM_WBS_INCLUDED == TRUE) + UINT16 handle = p_data->api_setcodec.hdr.layer_specific; tBTA_AG_PEER_CODEC codec_type = p_data->api_setcodec.codec; tBTA_AG_VAL val; + val.hdr.handle = handle; + val.num = codec_type; + /* Check if the requested codec type is valid */ if((codec_type != BTA_AG_CODEC_NONE) && (codec_type != BTA_AG_CODEC_CVSD) && (codec_type != BTA_AG_CODEC_MSBC)) { - val.num = codec_type; val.hdr.status = BTA_AG_FAIL_RESOURCES; APPL_TRACE_ERROR("%s error: unsupported codec type %d", __func__, codec_type); (*bta_ag_cb.p_cback)(BTA_AG_WBS_EVT, (tBTA_AG *) &val); @@ -804,11 +807,9 @@ void bta_ag_setcodec(tBTA_AG_SCB *p_scb, tBTA_AG_DATA *p_data) (codec_type == BTA_AG_CODEC_CVSD)) { p_scb->sco_codec = codec_type; p_scb->codec_updated = TRUE; - val.num = codec_type; val.hdr.status = BTA_AG_SUCCESS; APPL_TRACE_DEBUG("%s: Updated codec type %d", __func__, codec_type); } else { - val.num = codec_type; val.hdr.status = BTA_AG_FAIL_RESOURCES; APPL_TRACE_ERROR("%s error: unsupported codec type %d",__func__, codec_type); } From 024862c76fcbc7182a870ddea49d14b5777a7f36 Mon Sep 17 00:00:00 2001 From: Jin Cheng Date: Mon, 11 Sep 2023 14:47:37 +0800 Subject: [PATCH 2/3] change(bt/bluedroid): Added line information printing when error occurs CHECK_HF_IDX --- .../host/bluedroid/btc/profile/std/hf_ag/btc_hf_ag.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/components/bt/host/bluedroid/btc/profile/std/hf_ag/btc_hf_ag.c b/components/bt/host/bluedroid/btc/profile/std/hf_ag/btc_hf_ag.c index baf9e18b317d..c0317949f012 100644 --- a/components/bt/host/bluedroid/btc/profile/std/hf_ag/btc_hf_ag.c +++ b/components/bt/host/bluedroid/btc/profile/std/hf_ag/btc_hf_ag.c @@ -134,12 +134,12 @@ do { hf_local_param[idx].btc_hf_cb.num_active = 0; \ hf_local_param[idx].btc_hf_cb.num_held = 0; -#define CHECK_HF_IDX(idx) \ -do { \ - if ((idx < 0) || (idx >= BTC_HF_NUM_CB)) { \ - BTC_TRACE_ERROR("%s: Invalid index %d", __FUNCTION__, idx); \ - return; \ - } \ +#define CHECK_HF_IDX(idx) \ +do { \ + if ((idx < 0) || (idx >= BTC_HF_NUM_CB)) { \ + BTC_TRACE_ERROR("%s:%d Invalid index %d", __FUNCTION__, __LINE__, idx); \ + return; \ + } \ } while (0) /************************************************************************************ From 62f6af0dd7a49c92d4120b82d87cb9b9cbfdfe17 Mon Sep 17 00:00:00 2001 From: Jin Cheng Date: Mon, 11 Sep 2023 14:52:37 +0800 Subject: [PATCH 3/3] fix(bt/bluedroid): Fixed incorrect arrangement in type esp_hf_dial_type_t --- components/bt/host/bluedroid/api/include/api/esp_hf_ag_api.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/bt/host/bluedroid/api/include/api/esp_hf_ag_api.h b/components/bt/host/bluedroid/api/include/api/esp_hf_ag_api.h index 0d0432802316..31c9a07e4b75 100644 --- a/components/bt/host/bluedroid/api/include/api/esp_hf_ag_api.h +++ b/components/bt/host/bluedroid/api/include/api/esp_hf_ag_api.h @@ -68,9 +68,9 @@ typedef enum /// Dial type of ESP_HF_DIAL_EVT typedef enum { - ESP_HF_DIAL_MEM = 0, /*!< Dial with a memory position */ + ESP_HF_DIAL_NUM = 0, /*!< Dial with a phone number */ ESP_HF_DIAL_VOIP, /*!< Dial with VoIP */ - ESP_HF_DIAL_NUM, /*!< Dial with a phone number */ + ESP_HF_DIAL_MEM, /*!< Dial with a memory position */ } esp_hf_dial_type_t; /// HFP AG callback parameters