Skip to content

Commit 893e326

Browse files
author
Jiang Jiang Jian
committed
Merge branch 'bugfix/remove_unused_sco_state' into 'master'
Bugfix/remove unused sco state See merge request espressif/esp-idf!36285
2 parents 895bb2a + f39d121 commit 893e326

File tree

4 files changed

+6
-55
lines changed

4 files changed

+6
-55
lines changed

components/bt/host/bluedroid/stack/btm/btm_acl.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ void btm_acl_created (BD_ADDR bda, DEV_CLASS dc, UINT8 bdn[BTM_MAX_REM_BD_NAME_L
335335
#if (CLASSIC_BT_INCLUDED == TRUE)
336336
const UINT8 req_pend = (p_dev_rec->sm4 & BTM_SM4_REQ_PEND);
337337
#endif ///CLASSIC_BT_INCLUDED == TRUE
338-
/* Store the Peer Security Capabilites (in SM4 and rmt_sec_caps) */
338+
/* Store the Peer Security Capabilities (in SM4 and rmt_sec_caps) */
339339
#if (SMP_INCLUDED == TRUE)
340340
btm_sec_set_peer_sec_caps(p, p_dev_rec);
341341
#endif ///SMP_INCLUDED == TRUE
@@ -350,7 +350,7 @@ void btm_acl_created (BD_ADDR bda, DEV_CLASS dc, UINT8 bdn[BTM_MAX_REM_BD_NAME_L
350350
return;
351351
}
352352
} else {
353-
/* If remote features indicated secure connection (SC) mode, check the remote feautres again*/
353+
/* If remote features indicated secure connection (SC) mode, check the remote features again*/
354354
/* this is to prevent from BIAS attack where attacker can downgrade SC mode*/
355355
btm_read_remote_features (p->hci_handle);
356356
}
@@ -474,7 +474,7 @@ void btm_acl_removed (BD_ADDR bda, tBT_TRANSPORT transport)
474474
BTM_TRACE_DEBUG("Bonded\n");
475475
}
476476
} else {
477-
BTM_TRACE_DEBUG("Bletooth link down\n");
477+
BTM_TRACE_DEBUG("Bluetooth link down\n");
478478
p_dev_rec->sec_flags &= ~(BTM_SEC_AUTHORIZED | BTM_SEC_AUTHENTICATED
479479
| BTM_SEC_ENCRYPTED | BTM_SEC_ROLE_SWITCHED);
480480
}
@@ -1016,7 +1016,7 @@ void btm_process_remote_ext_features (tACL_CONN *p_acl_cb, UINT8 num_read_pages)
10161016

10171017
const UINT8 req_pend = (p_dev_rec->sm4 & BTM_SM4_REQ_PEND);
10181018
#if (SMP_INCLUDED == TRUE)
1019-
/* Store the Peer Security Capabilites (in SM4 and rmt_sec_caps) */
1019+
/* Store the Peer Security Capabilities (in SM4 and rmt_sec_caps) */
10201020
btm_sec_set_peer_sec_caps(p_acl_cb, p_dev_rec);
10211021
#endif ///SMP_INCLUDED == TRUE
10221022
BTM_TRACE_API("%s: pend:%d\n", __FUNCTION__, req_pend);
@@ -1455,7 +1455,7 @@ void btm_process_clk_off_comp_evt (UINT16 hci_handle, UINT16 clock_offset)
14551455
**
14561456
** Function btm_acl_role_changed
14571457
**
1458-
** Description This function is called whan a link's master/slave role change
1458+
** Description This function is called when a link's master/slave role change
14591459
** event or command status event (with error) is received.
14601460
** It updates the link control block, and calls
14611461
** the registered callback with status and role (if registered).
@@ -2705,7 +2705,7 @@ void btm_acl_connected(BD_ADDR bda, UINT16 handle, UINT8 link_type, UINT8 enc_mo
27052705
l2c_link_hci_conn_comp(status, handle, bda);
27062706
}
27072707
#if BTM_SCO_INCLUDED == TRUE
2708-
else {
2708+
else if (link_type == HCI_LINK_TYPE_SCO) {
27092709
memset(&esco_data, 0, sizeof(tBTM_ESCO_DATA));
27102710
esco_data.link_type = HCI_LINK_TYPE_SCO;
27112711
memcpy (esco_data.bd_addr, bda, BD_ADDR_LEN);

components/bt/host/bluedroid/stack/btm/btm_sco.c

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,6 @@ void btm_sco_init (void)
117117
}
118118
#endif
119119
/* Initialize nonzero defaults */
120-
btm_cb.sco_cb.sco_disc_reason = BTM_INVALID_SCO_DISC_REASON;
121-
122120
btm_cb.sco_cb.def_esco_parms = btm_esco_defaults; /* Initialize with defaults */
123121
btm_cb.sco_cb.desired_sco_mode = BTM_DEFAULT_SCO_MODE;
124122
}
@@ -1048,7 +1046,6 @@ void btm_sco_connected (UINT8 hci_status, BD_ADDR bda, UINT16 hci_handle,
10481046
tBTM_CHG_ESCO_PARAMS parms;
10491047
#endif
10501048

1051-
btm_cb.sco_cb.sco_disc_reason = hci_status;
10521049
BTM_TRACE_API("%s, handle %x", __FUNCTION__, hci_handle);
10531050
#if (BTM_MAX_SCO_LINKS>0)
10541051
for (xx = 0; xx < BTM_MAX_SCO_LINKS; xx++, p++) {
@@ -1224,16 +1221,11 @@ void btm_sco_removed (UINT16 hci_handle, UINT8 reason)
12241221
#if (BTM_MAX_SCO_LINKS>0)
12251222
tSCO_CONN *p = &btm_cb.sco_cb.sco_db[0];
12261223
UINT16 xx;
1227-
#endif
12281224

1229-
btm_cb.sco_cb.sco_disc_reason = reason;
1230-
1231-
#if (BTM_MAX_SCO_LINKS>0)
12321225
p = &btm_cb.sco_cb.sco_db[0];
12331226
for (xx = 0; xx < BTM_MAX_SCO_LINKS; xx++, p++) {
12341227
if ((p->state != SCO_ST_UNUSED) && (p->state != SCO_ST_LISTENING) && (p->hci_handle == hci_handle)) {
12351228
btm_sco_flush_sco_data(xx);
1236-
12371229
p->state = SCO_ST_UNUSED;
12381230
#if BTM_SCO_HCI_INCLUDED == TRUE
12391231
btm_cb.sco_cb.xmit_window_size += p->sent_not_acked;
@@ -1375,24 +1367,6 @@ UINT16 BTM_ReadScoPacketTypes (UINT16 sco_inx)
13751367
#endif
13761368
}
13771369

1378-
/*******************************************************************************
1379-
**
1380-
** Function BTM_ReadScoDiscReason
1381-
**
1382-
** Description This function is returns the reason why an (e)SCO connection
1383-
** has been removed. It contains the value until read, or until
1384-
** another (e)SCO connection has disconnected.
1385-
**
1386-
** Returns HCI reason or BTM_INVALID_SCO_DISC_REASON if not set.
1387-
**
1388-
*******************************************************************************/
1389-
UINT16 BTM_ReadScoDiscReason (void)
1390-
{
1391-
UINT16 res = btm_cb.sco_cb.sco_disc_reason;
1392-
btm_cb.sco_cb.sco_disc_reason = BTM_INVALID_SCO_DISC_REASON;
1393-
return (res);
1394-
}
1395-
13961370
/*******************************************************************************
13971371
**
13981372
** Function BTM_ReadDeviceScoPacketTypes
@@ -1894,10 +1868,6 @@ UINT8 *BTM_ReadScoBdAddr(UINT16 sco_inx)
18941868
{
18951869
return ((UINT8 *) NULL);
18961870
}
1897-
UINT16 BTM_ReadScoDiscReason (void)
1898-
{
1899-
return (BTM_INVALID_SCO_DISC_REASON);
1900-
}
19011871
tBTM_STATUS BTM_SetEScoMode (tBTM_SCO_TYPE sco_mode, tBTM_ESCO_PARAMS *p_parms)
19021872
{
19031873
return (BTM_MODE_UNSUPPORTED);

components/bt/host/bluedroid/stack/btm/include/btm_int.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,6 @@ typedef struct {
470470
tSCO_CONN sco_db[BTM_MAX_SCO_LINKS];
471471
tBTM_ESCO_PARAMS def_esco_parms;
472472
BD_ADDR xfer_addr;
473-
UINT16 sco_disc_reason;
474473
BOOLEAN esco_supported; /* TRUE if 1.2 cntlr AND supports eSCO links */
475474
tBTM_SCO_TYPE desired_sco_mode;
476475
tBTM_SCO_TYPE xfer_sco_type;

components/bt/host/bluedroid/stack/include/stack/btm_api.h

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1028,9 +1028,6 @@ typedef void (tBTM_ACL_DB_CHANGE_CB) (BD_ADDR p_bda, DEV_CLASS p_dc,
10281028
#define BTM_INVALID_SCO_INDEX 0xFFFF
10291029
#define BTM_INVALID_HCI_HANDLE 0xFFFF
10301030

1031-
/* Define an invalid SCO disconnect reason */
1032-
#define BTM_INVALID_SCO_DISC_REASON 0xFFFF
1033-
10341031
/* Define first active SCO index */
10351032
#define BTM_FIRST_ACTIVE_SCO_INDEX BTM_MAX_SCO_LINKS
10361033

@@ -3261,21 +3258,6 @@ UINT16 BTM_ReadScoHandle (UINT16 sco_inx);
32613258
UINT8 *BTM_ReadScoBdAddr (UINT16 sco_inx);
32623259

32633260

3264-
/*******************************************************************************
3265-
**
3266-
** Function BTM_ReadScoDiscReason
3267-
**
3268-
** Description This function is returns the reason why an (e)SCO connection
3269-
** has been removed. It contains the value until read, or until
3270-
** another (e)SCO connection has disconnected.
3271-
**
3272-
** Returns HCI reason or BTM_INVALID_SCO_DISC_REASON if not set.
3273-
**
3274-
*******************************************************************************/
3275-
//extern
3276-
UINT16 BTM_ReadScoDiscReason (void);
3277-
3278-
32793261
/*******************************************************************************
32803262
**
32813263
** Function BTM_SetEScoMode

0 commit comments

Comments
 (0)