From 7c2f1287ecfe10d8ba7525ee81263dbb47a1f46f Mon Sep 17 00:00:00 2001 From: weitianhua Date: Thu, 20 Feb 2020 17:53:34 +0800 Subject: [PATCH] Bugfix for HFP and some Github issue. 1. Bugfix for AG audio crash (change the return position) 2. Fix the error macro name and error return in hfp_hf demo 3. Fix the annotation error using UTF-8 ' (from Github) 4. Change or remove the log in SCO related code region. 5. Correct error of introduction of a function. --- .../bta/hf_client/bta_hf_client_sco.c | 4 ++-- .../btc/profile/std/hf_client/btc_hf_client.c | 1 - .../bluedroid/stack/btm/include/btm_int.h | 3 +-- .../bluedroid/stack/include/stack/avrc_defs.h | 21 ++++++++----------- .../classic_bt/hfp_hf/main/bt_app_hf.c | 10 ++++----- 5 files changed, 17 insertions(+), 22 deletions(-) diff --git a/components/bt/host/bluedroid/bta/hf_client/bta_hf_client_sco.c b/components/bt/host/bluedroid/bta/hf_client/bta_hf_client_sco.c index a519eeebe5..a6c2e45cb2 100644 --- a/components/bt/host/bluedroid/bta/hf_client/bta_hf_client_sco.c +++ b/components/bt/host/bluedroid/bta/hf_client/bta_hf_client_sco.c @@ -212,7 +212,7 @@ static void bta_hf_client_sco_conn_rsp(tBTM_ESCO_CONN_REQ_EVT_DATA *p_data) #if (BTM_SCO_HCI_INCLUDED == TRUE ) /******************************************************************************* ** -** Function bta_ag_ci_sco_data +** Function bta_hf_client_ci_sco_data ** ** Description Process the SCO data ready callin event ** @@ -337,7 +337,7 @@ static void bta_hf_client_sco_disc_cback(UINT16 sco_idx) /******************************************************************************* ** -** Function bta_hf_client_create_sco +** Function bta_hf_client_sco_create ** ** Description ** diff --git a/components/bt/host/bluedroid/btc/profile/std/hf_client/btc_hf_client.c b/components/bt/host/bluedroid/btc/profile/std/hf_client/btc_hf_client.c index d3ccd66997..b8c4cf6b4c 100644 --- a/components/bt/host/bluedroid/btc/profile/std/hf_client/btc_hf_client.c +++ b/components/bt/host/bluedroid/btc/profile/std/hf_client/btc_hf_client.c @@ -203,7 +203,6 @@ bt_status_t btc_hf_client_connect( bt_bdaddr_t *bd_addr ) BTC_TRACE_EVENT("HFP Client version is %s", btc_hf_client_version); CHECK_HF_CLIENT_INIT(); return btc_queue_connect(UUID_SERVCLASS_HF_HANDSFREE, bd_addr, connect_int); - } /******************************************************************************* diff --git a/components/bt/host/bluedroid/stack/btm/include/btm_int.h b/components/bt/host/bluedroid/stack/btm/include/btm_int.h index b30e0f0aec..e82516b199 100644 --- a/components/bt/host/bluedroid/stack/btm/include/btm_int.h +++ b/components/bt/host/bluedroid/stack/btm/include/btm_int.h @@ -370,7 +370,7 @@ typedef struct { typedef struct { tBTM_ESCO_INFO esco; /* Current settings */ #if BTM_SCO_HCI_INCLUDED == TRUE -#define BTM_SCO_XMIT_QUEUE_THRS 20 +#define BTM_SCO_XMIT_QUEUE_THRS 20 fixed_queue_t *xmit_data_q; /* SCO data transmitting queue */ INT16 sent_not_acked; #endif @@ -380,7 +380,6 @@ typedef struct { UINT16 hci_handle; /* HCI Handle */ BOOLEAN is_orig; /* TRUE if the originator */ BOOLEAN rem_bd_known; /* TRUE if remote BD addr known */ - } tSCO_CONN; /* SCO Management control block */ diff --git a/components/bt/host/bluedroid/stack/include/stack/avrc_defs.h b/components/bt/host/bluedroid/stack/include/stack/avrc_defs.h index 41d87759c3..4dcf38f69b 100644 --- a/components/bt/host/bluedroid/stack/include/stack/avrc_defs.h +++ b/components/bt/host/bluedroid/stack/include/stack/avrc_defs.h @@ -47,22 +47,19 @@ /* command type codes */ #define AVRC_CMD_CTRL 0 /* Instruct a target to perform an operation */ -#define AVRC_CMD_STATUS 1 /* Check a device’s current status */ -#define AVRC_CMD_SPEC_INQ 2 /* Check whether a target supports a particular - control command; all operands are included */ -#define AVRC_CMD_NOTIF 3 /* Used for receiving notification of a change in a device’s state */ -#define AVRC_CMD_GEN_INQ 4 /* Check whether a target supports a particular - control command; operands are not included */ +#define AVRC_CMD_STATUS 1 /* Check a device's current status */ +#define AVRC_CMD_SPEC_INQ 2 /* Check whether a target supports a particular control command; all operands are included */ +#define AVRC_CMD_NOTIF 3 /* Used for receiving notification of a change in a device's state */ +#define AVRC_CMD_GEN_INQ 4 /* Check whether a target supports a particular control command; operands are not included */ /* response type codes */ -#define AVRC_RSP_NOT_IMPL 8 /* The target does not implement the command specified - by the opcode and operand, - or doesn’t implement the specified subunit */ +#define AVRC_RSP_NOT_IMPL 8 /* The target does not implement the command specified by the opcode and operand, + or doesn't implement the specified subunit */ #define AVRC_RSP_ACCEPT 9 /* The target executed or is executing the command */ #define AVRC_RSP_REJ 10 /* The target implements the command specified by the opcode but cannot respond because the current state - of the target doesn’t allow it */ -#define AVRC_RSP_IN_TRANS 11 /* The target implements the status command but it is + of the target doesn't allow it */ +#define AVRC_RSP_IN_TRANS 11 /* The target implements the status command but it is in a state of transition; the status command may be retried at a future time */ #define AVRC_RSP_IMPL_STBL 12 /* For specific inquiry or general inquiy commands, @@ -70,7 +67,7 @@ commands, the target returns stable and includes the status results */ #define AVRC_RSP_CHANGED 13 /* The response frame contains a notification that the - target device’s state has changed */ + target device's state has changed */ #define AVRC_RSP_INTERIM 15 /* For control commands, the target has accepted the request but cannot return information within 100 milliseconds; for notify commands, the target accepted diff --git a/examples/bluetooth/bluedroid/classic_bt/hfp_hf/main/bt_app_hf.c b/examples/bluetooth/bluedroid/classic_bt/hfp_hf/main/bt_app_hf.c index 27fbfe0f17..f984395ae1 100644 --- a/examples/bluetooth/bluedroid/classic_bt/hfp_hf/main/bt_app_hf.c +++ b/examples/bluetooth/bluedroid/classic_bt/hfp_hf/main/bt_app_hf.c @@ -172,7 +172,7 @@ const char *c_inband_ring_state_str[] = { // If you want to connect a specific device, add it's address here esp_bd_addr_t peer_addr = {0xb4, 0xe6, 0x2d, 0xeb, 0x09, 0x93}; -#if CONFIG_BTDM_CONTROLLER_BR_EDR_SCO_DATA_PATH_HCI +#if CONFIG_BTDM_CTRL_BR_EDR_SCO_DATA_PATH_HCI #define ESP_HFP_RINGBUF_SIZE 3600 static RingbufHandle_t m_rb = NULL; @@ -185,7 +185,7 @@ static void bt_app_hf_client_audio_open(void) static void bt_app_hf_client_audio_close(void) { if (!m_rb) { - return 0; + return ; } vRingbufferDelete(m_rb); @@ -224,7 +224,7 @@ static void bt_app_hf_client_incoming_cb(const uint8_t *buf, uint32_t sz) esp_hf_client_outgoing_data_ready(); } -#endif /* #if CONFIG_BTDM_CONTROLLER_BR_EDR_SCO_DATA_PATH_HCI */ +#endif /* #if CONFIG_BTDM_CTRL_BR_EDR_SCO_DATA_PATH_HCI */ /* callback for HF_CLIENT */ void bt_app_hf_client_cb(esp_hf_client_cb_event_t event, esp_hf_client_cb_param_t *param) @@ -250,7 +250,7 @@ void bt_app_hf_client_cb(esp_hf_client_cb_event_t event, esp_hf_client_cb_param_ { ESP_LOGI(BT_HF_TAG, "--audio state %s", c_audio_state_str[param->audio_stat.state]); - #if CONFIG_BTDM_CONTROLLER_BR_EDR_SCO_DATA_PATH_HCI + #if CONFIG_BTDM_CTRL_BR_EDR_SCO_DATA_PATH_HCI if (param->audio_stat.state == ESP_HF_CLIENT_AUDIO_STATE_CONNECTED || param->audio_stat.state == ESP_HF_CLIENT_AUDIO_STATE_CONNECTED_MSBC) { esp_hf_client_register_data_callback(bt_app_hf_client_incoming_cb, @@ -259,7 +259,7 @@ void bt_app_hf_client_cb(esp_hf_client_cb_event_t event, esp_hf_client_cb_param_ } else if (param->audio_stat.state == ESP_HF_CLIENT_AUDIO_STATE_DISCONNECTED) { bt_app_hf_client_audio_close(); } - #endif /* #if CONFIG_BTDM_CONTROLLER_BR_EDR_SCO_DATA_PATH_HCI */ + #endif /* #if CONFIG_BTDM_CTRL_BR_EDR_SCO_DATA_PATH_HCI */ break; }