• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Keine Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

system/bt


Commit MetaInfo

Revisiona43e1304c2cbca16d583e08b63cb4c95a37b7b87 (tree)
Zeit2017-05-24 05:24:50
AutorJack He <siyuanh@goog...>
CommiterJack He

Log Message

eSCO: Format changes to original vendor patch (4/5)

* Format changes to original vendor patch
* Re-order part of SCO creation code to improve readability
* Make log more concise and usefull

Bug: 19540029
Test: make, HFP PTS test, testplans/86884, testplans/87103
Change-Id: Ie0199519afb30f56568c04fef728fce44a172063
(cherry picked from commit fe695a557a92053d4c44428ba08c0b8e945d4711)

Ändern Zusammenfassung

Diff

--- a/bta/ag/bta_ag_cmd.cc
+++ b/bta/ag/bta_ag_cmd.cc
@@ -828,15 +828,14 @@ void bta_ag_at_hfp_cback(tBTA_AG_SCB* p_scb, uint16_t cmd, uint8_t arg_type,
828828 tBTA_AG_SCB* ag_scb;
829829 uint32_t i, ind_id;
830830 uint32_t bia_masked_out;
831- tBTA_AG_PEER_CODEC codec_type, codec_sent;
832831 if (p_arg == NULL) {
833832 APPL_TRACE_ERROR("%s: p_arg is null, send error and return", __func__);
834833 bta_ag_send_error(p_scb, BTA_AG_ERR_INV_CHAR_IN_TSTR);
835834 return;
836835 }
837836
838- APPL_TRACE_DEBUG("HFP AT cmd:%d arg_type:%d arg:%d arg:%s", cmd, arg_type,
839- int_arg, p_arg);
837+ APPL_TRACE_DEBUG("%s: AT command %d, arg_type %d, int_arg %d, arg %s",
838+ __func__, cmd, arg_type, int_arg, p_arg);
840839
841840 memset(&val, 0, sizeof(tBTA_AG_VAL));
842841 val.hdr.handle = bta_ag_scb_to_idx(p_scb);
@@ -1204,7 +1203,8 @@ void bta_ag_at_hfp_cback(tBTA_AG_SCB* p_scb, uint16_t cmd, uint8_t arg_type,
12041203 }
12051204 break;
12061205
1207- case BTA_AG_AT_BCS_EVT:
1206+ case BTA_AG_AT_BCS_EVT: {
1207+ tBTA_AG_PEER_CODEC codec_type, codec_sent;
12081208 bta_ag_send_ok(p_scb);
12091209 alarm_cancel(p_scb->codec_negotiation_timer);
12101210
@@ -1234,7 +1234,7 @@ void bta_ag_at_hfp_cback(tBTA_AG_SCB* p_scb, uint16_t cmd, uint8_t arg_type,
12341234 /* send final codec info to callback */
12351235 val.num = codec_sent;
12361236 break;
1237-
1237+ }
12381238 case BTA_AG_LOCAL_EVT_BCC:
12391239 bta_ag_send_ok(p_scb);
12401240 bta_ag_sco_open(p_scb, NULL);
--- a/bta/ag/bta_ag_sco.cc
+++ b/bta/ag/bta_ag_sco.cc
@@ -217,7 +217,7 @@ static void bta_ag_sco_disc_cback(uint16_t sco_idx) {
217217 static void bta_ag_sco_read_cback(uint16_t sco_inx, BT_HDR* p_data,
218218 tBTM_SCO_DATA_FLAG status) {
219219 if (status != BTM_SCO_DATA_CORRECT) {
220- APPL_TRACE_DEBUG("bta_ag_sco_read_cback: status(%d)", status);
220+ APPL_TRACE_DEBUG("%s: status %d", __func__, status);
221221 }
222222
223223 /* Callout function must free the data. */
@@ -232,33 +232,26 @@ static void bta_ag_sco_read_cback(uint16_t sco_inx, BT_HDR* p_data,
232232 * If only_active is true, then SCO is only removed if
233233 * connected
234234 *
235- * Returns bool - true if Sco removal was started
235+ * Returns bool - true if SCO removal was started
236236 *
237237 ******************************************************************************/
238238 static bool bta_ag_remove_sco(tBTA_AG_SCB* p_scb, bool only_active) {
239- bool removed_started = false;
240- tBTM_STATUS status;
241-
242239 if (p_scb->sco_idx != BTM_INVALID_SCO_INDEX) {
243240 if (!only_active || p_scb->sco_idx == bta_ag_cb.sco.cur_idx) {
244- status = BTM_RemoveSco(p_scb->sco_idx);
245-
246- APPL_TRACE_DEBUG("%s: inx 0x%04x, status:0x%x", __func__, p_scb->sco_idx,
247- status);
248-
241+ tBTM_STATUS status = BTM_RemoveSco(p_scb->sco_idx);
242+ APPL_TRACE_DEBUG("%s: SCO index 0x%04x, status %d", __func__,
243+ p_scb->sco_idx, status);
249244 if (status == BTM_CMD_STARTED) {
250- /* Sco is connected; set current control block */
245+ /* SCO is connected; set current control block */
251246 bta_ag_cb.sco.p_curr_scb = p_scb;
252-
253- removed_started = true;
254- }
255- /* If no connection reset the sco handle */
256- else if ((status == BTM_SUCCESS) || (status == BTM_UNKNOWN_ADDR)) {
247+ return true;
248+ } else if ((status == BTM_SUCCESS) || (status == BTM_UNKNOWN_ADDR)) {
249+ /* If no connection reset the SCO handle */
257250 p_scb->sco_idx = BTM_INVALID_SCO_INDEX;
258251 }
259252 }
260253 }
261- return removed_started;
254+ return false;
262255 }
263256
264257 /*******************************************************************************
@@ -292,8 +285,8 @@ static void bta_ag_esco_connreq_cback(tBTM_ESCO_EVT event,
292285 bta_ag_cb.sco.state = BTA_AG_SCO_OPENING_ST;
293286 bta_ag_cb.sco.p_curr_scb = p_scb;
294287 bta_ag_cb.sco.cur_idx = p_scb->sco_idx;
295- } else /* Begin a transfer: Close current SCO before responding */
296- {
288+ } else {
289+ /* Begin a transfer: Close current SCO before responding */
297290 APPL_TRACE_DEBUG("bta_ag_esco_connreq_cback: Begin XFER");
298291 bta_ag_cb.sco.p_xfer_scb = p_scb;
299292 bta_ag_cb.sco.conn_data = p_data->conn_evt;
@@ -309,17 +302,15 @@ static void bta_ag_esco_connreq_cback(tBTM_ESCO_EVT event,
309302 bta_ag_sco_conn_rsp(p_scb, &p_data->conn_evt);
310303 }
311304 }
312- }
313- /* If error occurred send reject response immediately */
314- else {
305+ } else {
306+ /* If error occurred send reject response immediately */
315307 APPL_TRACE_WARNING(
316308 "no scb for bta_ag_esco_connreq_cback or no resources");
317309 BTM_EScoConnRsp(p_data->conn_evt.sco_inx, HCI_ERR_HOST_REJECT_RESOURCES,
318310 (enh_esco_params_t*)NULL);
319311 }
320- }
321- /* Received a change in the esco link */
322- else if (event == BTM_ESCO_CHG_EVT) {
312+ } else if (event == BTM_ESCO_CHG_EVT) {
313+ /* Received a change in the esco link */
323314 APPL_TRACE_EVENT(
324315 "%s: eSCO change event (inx %d): rtrans %d, "
325316 "rxlen %d, txlen %d, txint %d",
@@ -565,6 +556,7 @@ bool bta_ag_attempt_msbc_safe_settings(tBTA_AG_SCB* p_scb) {
565556 *
566557 ******************************************************************************/
567558 static void bta_ag_codec_negotiation_timer_cback(void* data) {
559+ APPL_TRACE_DEBUG("%s", __func__);
568560 tBTA_AG_SCB* p_scb = (tBTA_AG_SCB*)data;
569561
570562 /* Announce that codec negotiation failed. */
@@ -585,11 +577,12 @@ static void bta_ag_codec_negotiation_timer_cback(void* data) {
585577 *
586578 ******************************************************************************/
587579 void bta_ag_codec_negotiate(tBTA_AG_SCB* p_scb) {
580+ APPL_TRACE_DEBUG("%s", __func__);
588581 bta_ag_cb.sco.p_curr_scb = p_scb;
589582
590583 if ((p_scb->codec_updated || p_scb->codec_fallback) &&
591584 (p_scb->peer_features & BTA_AG_PEER_FEAT_CODEC)) {
592- /* Change the power mode to Active until sco open is completed. */
585+ /* Change the power mode to Active until SCO open is completed. */
593586 bta_sys_busy(BTA_ID_AG, p_scb->app_id, p_scb->peer_addr);
594587
595588 /* Send +BCS to the peer */
@@ -624,20 +617,19 @@ static void bta_ag_sco_event(tBTA_AG_SCB* p_scb, uint8_t event) {
624617 BT_HDR* p_buf;
625618 #endif
626619
627-#if BTA_AG_SCO_DEBUG == TRUE
620+#if (BTA_AG_SCO_DEBUG == TRUE)
628621 uint8_t in_state = p_sco->state;
629622
630623 if (event != BTA_AG_SCO_CI_DATA_E) {
631- APPL_TRACE_EVENT(
632- "%s: BTA ag sco evt (hdl 0x%04x): State %d (%s), Event %d (%s)",
633- __func__, p_scb->sco_idx, p_sco->state,
634- bta_ag_sco_state_str(p_sco->state), event, bta_ag_sco_evt_str(event));
624+ APPL_TRACE_EVENT("%s: SCO Index 0x%04x, State %d (%s), Event %d (%s)",
625+ __func__, p_scb->sco_idx, p_sco->state,
626+ bta_ag_sco_state_str(p_sco->state), event,
627+ bta_ag_sco_evt_str(event));
635628 }
636629 #else
637-
638630 if (event != BTA_AG_SCO_CI_DATA_E) {
639- APPL_TRACE_EVENT("%s: BTA ag sco evt (hdl 0x%04x): State %d, Event %d",
640- __func__, p_scb->sco_idx, p_sco->state, event);
631+ APPL_TRACE_EVENT("%s: SCO Index 0x%04x, State %d, Event %d", __func__,
632+ p_scb->sco_idx, p_sco->state, event);
641633 }
642634 #endif
643635
@@ -1246,12 +1238,16 @@ void bta_ag_sco_close(tBTA_AG_SCB* p_scb, UNUSED_ATTR tBTA_AG_DATA* p_data) {
12461238 ******************************************************************************/
12471239 void bta_ag_sco_codec_nego(tBTA_AG_SCB* p_scb, bool result) {
12481240 if (result == true) {
1249- /* Subsequent sco connection will skip codec negotiation */
1241+ /* Subsequent SCO connection will skip codec negotiation */
1242+ APPL_TRACE_DEBUG("%s: Succeeded for index 0x%04x", __func__,
1243+ p_scb->sco_idx);
12501244 p_scb->codec_updated = false;
1251-
12521245 bta_ag_sco_event(p_scb, BTA_AG_SCO_CN_DONE_E);
1253- } else /* codec negotiation failed */
1246+ } else {
1247+ /* codec negotiation failed */
1248+ APPL_TRACE_ERROR("%s: Failed for index 0x%04x", __func__, p_scb->sco_idx);
12541249 bta_ag_sco_event(p_scb, BTA_AG_SCO_CLOSE_E);
1250+ }
12551251 }
12561252
12571253 /*******************************************************************************
--- a/bta/dm/bta_dm_act.cc
+++ b/bta/dm/bta_dm_act.cc
@@ -3920,11 +3920,11 @@ bool bta_dm_check_if_only_hd_connected(BD_ADDR peer_addr) {
39203920 !bdcmp(bta_dm_conn_srvcs.conn_srvc[j].peer_bdaddr, peer_addr)) {
39213921 APPL_TRACE_DEBUG("%s: Another profile (id=%d) is connected", __func__,
39223922 bta_dm_conn_srvcs.conn_srvc[j].id);
3923- return FALSE;
3923+ return false;
39243924 }
39253925 }
39263926
3927- return TRUE;
3927+ return true;
39283928 }
39293929
39303930 /*******************************************************************************
--- a/bta/hf_client/bta_hf_client_sco.cc
+++ b/bta/hf_client/bta_hf_client_sco.cc
@@ -222,7 +222,6 @@ static void bta_hf_client_sco_create(tBTA_HF_CLIENT_CB* client_cb,
222222 bool is_orig) {
223223 tBTM_STATUS status;
224224 uint8_t* p_bd_addr = NULL;
225- enh_esco_params_t params;
226225
227226 APPL_TRACE_DEBUG("%s: %d", __func__, is_orig);
228227
@@ -233,7 +232,7 @@ static void bta_hf_client_sco_create(tBTA_HF_CLIENT_CB* client_cb,
233232 return;
234233 }
235234
236- params = esco_parameters_for_codec(ESCO_CODEC_MSBC_T1);
235+ enh_esco_params_t params = esco_parameters_for_codec(ESCO_CODEC_MSBC_T1);
237236
238237 /* if initiating set current scb and peer bd addr */
239238 if (is_orig) {
--- a/bta/sys/bta_sys_main.cc
+++ b/bta/sys/bta_sys_main.cc
@@ -462,7 +462,7 @@ void bta_sys_event(BT_HDR* p_msg) {
462462 uint8_t id;
463463 bool freebuf = true;
464464
465- APPL_TRACE_EVENT("BTA got event 0x%x", p_msg->event);
465+ APPL_TRACE_EVENT("%s: Event 0x%x", __func__, p_msg->event);
466466
467467 /* get subsystem id from event */
468468 id = (uint8_t)(p_msg->event >> 8);
@@ -471,7 +471,7 @@ void bta_sys_event(BT_HDR* p_msg) {
471471 if ((id < BTA_ID_MAX) && (bta_sys_cb.reg[id] != NULL)) {
472472 freebuf = (*bta_sys_cb.reg[id]->evt_hdlr)(p_msg);
473473 } else {
474- APPL_TRACE_WARNING("BTA got unregistered event id %d", id);
474+ APPL_TRACE_WARNING("%s: Received unregistered event id %d", __func__, id);
475475 }
476476
477477 if (freebuf) {
--- a/btif/src/btif_hf.cc
+++ b/btif/src/btif_hf.cc
@@ -547,14 +547,14 @@ static void btif_hf_upstreams_evt(uint16_t event, char* p_param) {
547547 break;
548548 case BTA_AG_AT_BAC_EVT:
549549 BTIF_TRACE_DEBUG("AG Bitmap of peer-codecs %d", p_data->val.num);
550- /* If the peer supports mSBC and the BTIF prefferred codec is also mSBC,
550+ /* If the peer supports mSBC and the BTIF preferred codec is also mSBC,
551551 then
552552 we should set the BTA AG Codec to mSBC. This would trigger a +BCS to mSBC
553553 at the time
554554 of SCO connection establishment */
555555 if ((btif_conf_hf_force_wbs == true) &&
556556 (p_data->val.num & BTA_AG_CODEC_MSBC)) {
557- BTIF_TRACE_EVENT("%s btif_hf override-Preferred Codec to MSBC",
557+ BTIF_TRACE_EVENT("%s: btif_hf override-Preferred Codec to MSBC",
558558 __func__);
559559 BTA_AgSetCodec(btif_hf_cb[idx].handle, BTA_AG_CODEC_MSBC);
560560 } else {
@@ -564,12 +564,13 @@ static void btif_hf_upstreams_evt(uint16_t event, char* p_param) {
564564 }
565565 break;
566566 case BTA_AG_AT_BCS_EVT:
567- BTIF_TRACE_DEBUG("AG final seleded codec is %d 1=CVSD 2=MSBC",
568- p_data->val.num);
569- /* no BTHF_WBS_NONE case, becuase HF1.6 supported device can send BCS */
567+ BTIF_TRACE_DEBUG("%s: AG final selected codec is 0x%02x 1=CVSD 2=MSBC",
568+ __func__, p_data->val.num);
569+ /* No BTHF_WBS_NONE case, because HF1.6 supported device can send BCS */
570+ /* Only CVSD is considered narrow band speech */
570571 HAL_CBACK(
571572 bt_hf_callbacks, wbs_cb,
572- (p_data->val.num == BTA_AG_CODEC_MSBC) ? BTHF_WBS_YES : BTHF_WBS_NO,
573+ (p_data->val.num == BTA_AG_CODEC_CVSD) ? BTHF_WBS_NO : BTHF_WBS_YES,
573574 &btif_hf_cb[idx].connected_bda);
574575 break;
575576
@@ -1297,7 +1298,7 @@ static bt_status_t phone_state_change(int num_active, int num_held,
12971298 ag_res.audio_handle = BTA_AG_HANDLE_SCO_NO_CHANGE;
12981299 /* Addition call setup with the Active call
12991300 ** CIND response should have been updated.
1300- ** just open SCO conenction.
1301+ ** just open SCO connection.
13011302 */
13021303 if (call_setup_state != BTHF_CALL_STATE_IDLE)
13031304 res = BTA_AG_MULTI_CALL_RES;
--- a/btif/src/btif_rc.cc
+++ b/btif/src/btif_rc.cc
@@ -1123,7 +1123,7 @@ bool btif_rc_get_connected_peer(BD_ADDR peer_addr) {
11231123 p_dev = get_connected_device(idx);
11241124 if (p_dev != NULL && (p_dev->rc_connected == TRUE)) {
11251125 bdcpy(peer_addr, p_dev->rc_addr);
1126- return TRUE;
1126+ return true;
11271127 }
11281128 }
11291129 return false;
--- a/btif/src/btif_sock_sco.cc
+++ b/btif/src/btif_sock_sco.cc
@@ -137,7 +137,6 @@ static sco_socket_t* sco_socket_establish_locked(bool is_listening,
137137 socket_t* socket = NULL;
138138 tBTM_STATUS status;
139139 enh_esco_params_t params;
140-
141140 if (socketpair(AF_LOCAL, SOCK_STREAM, 0, pair) == -1) {
142141 LOG_ERROR(LOG_TAG, "%s unable to allocate socket pair: %s", __func__,
143142 strerror(errno));
--- a/device/src/esco_parameters.cc
+++ b/device/src/esco_parameters.cc
@@ -140,6 +140,8 @@ static const enh_esco_params_t default_esco_parameters[ESCO_NUM_CODECS] = {
140140 .retransmission_effort = ESCO_RETRANSMISSION_QUALITY}};
141141
142142 enh_esco_params_t esco_parameters_for_codec(esco_codec_t codec) {
143- CHECK(codec >= 0 && codec < ESCO_NUM_CODECS);
143+ CHECK(codec >= 0) << "codec index " << (int)codec << "< 0";
144+ CHECK(codec < ESCO_NUM_CODECS) << "codec index " << (int)codec << " > "
145+ << ESCO_NUM_CODECS;
144146 return default_esco_parameters[codec];
145147 }
--- a/stack/btm/btm_sco.cc
+++ b/stack/btm/btm_sco.cc
@@ -134,21 +134,20 @@ static void btm_esco_conn_rsp(uint16_t sco_inx, uint8_t hci_status, BD_ADDR bda,
134134 p_sco->state = (p_sco->state == SCO_ST_W4_CONN_RSP) ? SCO_ST_LISTENING
135135 : SCO_ST_UNUSED;
136136 }
137-
138137 if (!btm_cb.sco_cb.esco_supported) {
139138 btsnd_hcic_reject_conn(bda, hci_status);
140139 } else {
141140 btsnd_hcic_reject_esco_conn(bda, hci_status);
142141 }
143- } else /* Connection is being accepted */
144- {
142+ } else {
143+ /* Connection is being accepted */
145144 p_sco->state = SCO_ST_CONNECTING;
146145 enh_esco_params_t* p_setup = &p_sco->esco.setup;
147146 /* If parameters not specified use the default */
148- if (p_parms)
147+ if (p_parms) {
149148 *p_setup = *p_parms;
150- else /* Use the last setup passed thru BTM_SetEscoMode (or defaults) */
151- {
149+ } else {
150+ /* Use the last setup passed thru BTM_SetEscoMode (or defaults) */
152151 *p_setup = btm_cb.sco_cb.def_esco_parms;
153152 }
154153
@@ -185,17 +184,16 @@ static void btm_esco_conn_rsp(uint16_t sco_inx, uint8_t hci_status, BD_ADDR bda,
185184 btm_cb.sco_cb.sco_route;
186185
187186 BTM_TRACE_DEBUG(
188- "%s: txbw 0x%x, rxbw 0x%x, "
189- "lat 0x%x, retrans 0x%02x, pkt 0x%04x, path %u",
187+ "%s: txbw 0x%x, rxbw 0x%x, lat 0x%x, retrans 0x%02x, "
188+ "pkt 0x%04x, path %u",
190189 __func__, p_setup->transmit_bandwidth, p_setup->receive_bandwidth,
191190 p_setup->max_latency_ms, p_setup->retransmission_effort,
192191 p_setup->packet_types, p_setup->input_data_path);
193192
194193 btsnd_hcic_enhanced_accept_synchronous_connection(bda, p_setup);
195194
196- } else /* Use older command */
197- {
198- /* needed if enhanced HCI cmds not supported */
195+ } else {
196+ /* Use legacy command if enhanced SCO setup is not supported */
199197 uint16_t voice_content_format = btm_sco_voice_settings_to_legacy(p_setup);
200198 btsnd_hcic_accept_esco_conn(
201199 bda, p_setup->transmit_bandwidth, p_setup->receive_bandwidth,
@@ -402,7 +400,7 @@ static tBTM_STATUS btm_send_connect_request(uint16_t acl_handle,
402400 if (BTM_BothEndsSupportSecureConnections(p_acl->remote_addr)) {
403401 temp_packet_types &= ~(BTM_SCO_PKT_TYPE_MASK);
404402 BTM_TRACE_DEBUG("%s: SCO Conn: pkt_types after removing SCO (0x%04x)",
405- __FUNCTION__, temp_packet_types);
403+ __func__, temp_packet_types);
406404
407405 /* Return error if no packet types left */
408406 if (temp_packet_types == 0) {
@@ -550,7 +548,6 @@ tBTM_STATUS BTM_CreateSco(BD_ADDR remote_bda, bool is_orig, uint16_t pkt_types,
550548 tSCO_CONN* p = &btm_cb.sco_cb.sco_db[0];
551549 uint16_t xx;
552550 uint16_t acl_handle = 0;
553- uint16_t temp_pkt_types;
554551 tACL_CONN* p_acl;
555552
556553 #if (BTM_SCO_WAKE_PARKED_LINK == TRUE)
@@ -563,10 +560,21 @@ tBTM_STATUS BTM_CreateSco(BD_ADDR remote_bda, bool is_orig, uint16_t pkt_types,
563560 *p_sco_inx = BTM_INVALID_SCO_INDEX;
564561
565562 /* If originating, ensure that there is an ACL connection to the BD Address */
563+
566564 if (is_orig) {
567- if ((!remote_bda) || ((acl_handle = BTM_GetHCIConnHandle(
568- remote_bda, BT_TRANSPORT_BR_EDR)) == 0xFFFF))
569- return (BTM_UNKNOWN_ADDR);
565+ if (!remote_bda) {
566+ BTM_TRACE_ERROR("%s: remote_bda is null", __func__);
567+ return BTM_ILLEGAL_VALUE;
568+ }
569+ acl_handle = BTM_GetHCIConnHandle(remote_bda, BT_TRANSPORT_BR_EDR);
570+ if (acl_handle == 0xFFFF) {
571+ BTM_TRACE_ERROR(
572+ "%s: cannot find ACL handle for remote device "
573+ "%02x:%02x:%02x:%02x:%02x:%02x",
574+ __func__, remote_bda[0], remote_bda[1], remote_bda[2], remote_bda[3],
575+ remote_bda[4], remote_bda[5]);
576+ return BTM_UNKNOWN_ADDR;
577+ }
570578 }
571579
572580 if (remote_bda) {
@@ -575,19 +583,17 @@ tBTM_STATUS BTM_CreateSco(BD_ADDR remote_bda, bool is_orig, uint16_t pkt_types,
575583 if (((p->state == SCO_ST_CONNECTING) || (p->state == SCO_ST_LISTENING) ||
576584 (p->state == SCO_ST_PEND_UNPARK)) &&
577585 (!memcmp(p->esco.data.bd_addr, remote_bda, BD_ADDR_LEN))) {
578- return (BTM_BUSY);
586+ return BTM_BUSY;
579587 }
580588 }
581589 } else {
582590 /* Support only 1 wildcard BD address at a time */
583591 for (xx = 0; xx < BTM_MAX_SCO_LINKS; xx++, p++) {
584- if ((p->state == SCO_ST_LISTENING) && (!p->rem_bd_known))
585- return (BTM_BUSY);
592+ if ((p->state == SCO_ST_LISTENING) && (!p->rem_bd_known)) return BTM_BUSY;
586593 }
587594 }
588595
589- /* Now, try to find an unused control block, and kick off the SCO
590- * establishment */
596+ /* Try to find an unused control block, and kick off the SCO establishment */
591597 for (xx = 0, p = &btm_cb.sco_cb.sco_db[0]; xx < BTM_MAX_SCO_LINKS;
592598 xx++, p++) {
593599 if (p->state == SCO_ST_UNUSED) {
@@ -620,21 +626,18 @@ tBTM_STATUS BTM_CreateSco(BD_ADDR remote_bda, bool is_orig, uint16_t pkt_types,
620626
621627 p_setup = &p->esco.setup;
622628 *p_setup = btm_cb.sco_cb.def_esco_parms;
623- p_setup->packet_types = pkt_types;
624-
625- temp_pkt_types = (p_setup->packet_types & BTM_SCO_SUPPORTED_PKTS_MASK &
626- btm_cb.btm_sco_pkt_types_supported);
627629
630+ /* Determine the packet types */
631+ p_setup->packet_types = pkt_types & BTM_SCO_SUPPORTED_PKTS_MASK &
632+ btm_cb.btm_sco_pkt_types_supported;
628633 /* OR in any exception packet types */
629634 if (controller_get_interface()->get_bt_version()->hci_version >=
630635 HCI_PROTO_VERSION_2_0) {
631- temp_pkt_types |=
632- ((p_setup->packet_types & BTM_SCO_EXCEPTION_PKTS_MASK) |
633- (btm_cb.btm_sco_pkt_types_supported &
634- BTM_SCO_EXCEPTION_PKTS_MASK));
636+ p_setup->packet_types |=
637+ (pkt_types & BTM_SCO_EXCEPTION_PKTS_MASK) |
638+ (btm_cb.btm_sco_pkt_types_supported & BTM_SCO_EXCEPTION_PKTS_MASK);
635639 }
636640
637- p_setup->packet_types = temp_pkt_types;
638641 p->p_conn_cb = p_conn_cb;
639642 p->p_disc_cb = p_disc_cb;
640643 p->hci_handle = BTM_INVALID_HCI_HANDLE;
@@ -670,13 +673,13 @@ tBTM_STATUS BTM_CreateSco(BD_ADDR remote_bda, bool is_orig, uint16_t pkt_types,
670673
671674 *p_sco_inx = xx;
672675
673- return (BTM_CMD_STARTED);
676+ return BTM_CMD_STARTED;
674677 }
675678 }
676679
677680 #endif
678681 /* If here, all SCO blocks in use */
679- return (BTM_NO_RESOURCES);
682+ return BTM_NO_RESOURCES;
680683 }
681684
682685 #if (BTM_SCO_WAKE_PARKED_LINK == TRUE)
@@ -1323,8 +1326,7 @@ tBTM_STATUS BTM_SetEScoMode(enh_esco_params_t* p_parms) {
13231326 p_def->packet_types &= BTM_SCO_LINK_ONLY_MASK;
13241327 p_def->retransmission_effort = ESCO_RETRANSMISSION_OFF;
13251328 p_def->max_latency_ms = 12;
1326- BTM_TRACE_WARNING("%s: BTM_SetEScoMode -> mode SCO (eSCO not supported)",
1327- __func__);
1329+ BTM_TRACE_WARNING("%s: eSCO not supported", __func__);
13281330 }
13291331
13301332 BTM_TRACE_API(
@@ -1333,7 +1335,7 @@ tBTM_STATUS BTM_SetEScoMode(enh_esco_params_t* p_parms) {
13331335 __func__, p_def->transmit_bandwidth, p_def->receive_bandwidth,
13341336 p_def->max_latency_ms, p_def->packet_types, p_def->retransmission_effort);
13351337
1336- return (BTM_SUCCESS);
1338+ return BTM_SUCCESS;
13371339 }
13381340
13391341 /*******************************************************************************
--- a/stack/hcic/hcicmds.cc
+++ b/stack/hcic/hcicmds.cc
@@ -1063,7 +1063,6 @@ void btsnd_hcic_enhanced_set_up_synchronous_connection(
10631063 void btsnd_hcic_enhanced_accept_synchronous_connection(
10641064 BD_ADDR bd_addr, enh_esco_params_t* p_params) {
10651065 BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE);
1066- ;
10671066 uint8_t* pp = (uint8_t*)(p + 1);
10681067
10691068 p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_ENH_ACC_ESCO_CONN;
--- a/stack/include/btm_api.h
+++ b/stack/include/btm_api.h
@@ -27,7 +27,7 @@
2727
2828 #include "bt_target.h"
2929 #include "device/include/esco_parameters.h"
30-#include "hcimsgs.h"
30+#include "hcidefs.h"
3131 #include "sdp_api.h"
3232
3333 #include "smp_api.h"
--- a/stack/include/btm_api_types.h
+++ b/stack/include/btm_api_types.h
@@ -21,7 +21,7 @@
2121
2222 #include "bt_target.h"
2323 #include "device/include/esco_parameters.h"
24-#include "hcimsgs.h"
24+#include "hcidefs.h"
2525 #include "smp_api_types.h"
2626
2727 /* Maximum number of bytes allowed for vendor specific command parameters */