Explorar o código

Merge branch 'bugfix/hfp_github_issues_v4.1' into 'release/v4.1'

Bugfix for HFP and some Github issue. v4.1

See merge request espressif/esp-idf!7975
Jiang Jiang Jian %!s(int64=5) %!d(string=hai) anos
pai
achega
71ffae5d6e

+ 2 - 3
components/bt/host/bluedroid/bta/hf_ag/bta_ag_sco.c

@@ -316,7 +316,7 @@ static void bta_ag_sco_read_cback(UINT16 sco_inx, BT_HDR *p_data, tBTM_SCO_DATA_
 {
     if (status != BTM_SCO_DATA_CORRECT)
     {
-        ets_printf("bta_ag_sco_read_cback: status(%d)", status);
+        APPL_TRACE_WARNING("bta_ag_sco_read_cback: status(%d)", status);
     }
 
     /* Callout function must free the data. */
@@ -760,7 +760,6 @@ static void bta_ag_sco_event(tBTA_AG_SCB *p_scb, UINT8 event)
             p_buf->offset = pkt_offset;
             len_to_send = bta_ag_sco_co_out_data(p_buf->data + pkt_offset);
             p_buf->len = len_to_send;
-            
             if (len_to_send == p_scb->out_pkt_len)
             {
                 if (p_sco->state == BTA_AG_SCO_OPEN_ST) {
@@ -777,8 +776,8 @@ static void bta_ag_sco_event(tBTA_AG_SCB *p_scb, UINT8 event)
                     break;
                 }
             }
-            return;
         }
+        return;
     }
 #endif
 

+ 2 - 2
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
 **

+ 0 - 1
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);
-
 }
 
 /*******************************************************************************

+ 1 - 2
components/bt/host/bluedroid/stack/btm/include/btm_int.h

@@ -380,7 +380,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
@@ -390,7 +390,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 */

+ 9 - 12
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

+ 3 - 5
examples/bluetooth/bluedroid/classic_bt/hfp_ag/main/bt_app_hf.c

@@ -162,11 +162,9 @@ void bt_app_hf_cb(esp_hf_cb_event_t event, esp_hf_cb_param_t *param)
         {
             ESP_LOGI(BT_HF_TAG, "--Audio State %s", c_audio_state_str[param->audio_stat.state]);
 #if CONFIG_BTDM_CTRL_BR_EDR_SCO_DATA_PATH_HCI
-            if (param->audio_stat.state == ESP_HF_AUDIO_STATE_CONNECTED
-#if (BTM_WBS_INCLUDED == TRUE)
-                || param->audio_stat.state == ESP_HF_AUDIO_STATE_CONNECTED_MSBC
-#endif
-            ) {
+            if (param->audio_stat.state == ESP_HF_AUDIO_STATE_CONNECTED ||
+                param->audio_stat.state == ESP_HF_AUDIO_STATE_CONNECTED_MSBC)
+            {
                 esp_bt_hf_register_data_callback(bt_app_hf_incoming_cb, bt_app_hf_outgoing_cb);
             } else if (param->audio_stat.state == ESP_HF_AUDIO_STATE_DISCONNECTED) {
                 ESP_LOGI(BT_HF_TAG, "--ESP AG Audio Connection Disconnected.");

+ 5 - 5
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;
         }