fix(ble/bluedroid): disable bluedroid role_change
(cherry picked from commit 250553c50d333600a948a8dca8ad05d773b3fc22) Co-authored-by: zhiweijian <zhiweijian@espressif.com>
This commit is contained in:
@@ -292,7 +292,9 @@ void btm_acl_created (BD_ADDR bda, DEV_CLASS dc, UINT8 bdn[BTM_MAX_REM_BD_NAME_L
|
||||
p->conn_addr[0], p->conn_addr[1], p->conn_addr[2], p->conn_addr[3], p->conn_addr[4], p->conn_addr[5]);
|
||||
#endif
|
||||
#endif
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
p->switch_role_state = BTM_ACL_SWKEY_STATE_IDLE;
|
||||
#endif // (CLASSIC_BT_INCLUDED == TRUE)
|
||||
|
||||
p->p_pm_mode_db = btm_pm_sm_alloc();
|
||||
#if BTM_PM_DEBUG == TRUE
|
||||
@@ -384,7 +386,7 @@ void btm_acl_created (BD_ADDR bda, DEV_CLASS dc, UINT8 bdn[BTM_MAX_REM_BD_NAME_L
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function btm_acl_report_role_change
|
||||
@@ -408,6 +410,7 @@ void btm_acl_report_role_change (UINT8 hci_status, BD_ADDR bda)
|
||||
btm_cb.devcb.p_switch_role_cb = NULL;
|
||||
}
|
||||
}
|
||||
#endif // (CLASSIC_BT_INCLUDED == TRUE)
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
@@ -432,8 +435,10 @@ void btm_acl_removed (BD_ADDR bda, tBT_TRANSPORT transport)
|
||||
if (p != (tACL_CONN *)NULL) {
|
||||
p->in_use = FALSE;
|
||||
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
/* if the disconnected channel has a pending role switch, clear it now */
|
||||
btm_acl_report_role_change(HCI_ERR_NO_CONNECTION, bda);
|
||||
#endif // (CLASSIC_BT_INCLUDED == TRUE)
|
||||
|
||||
/* Only notify if link up has had a chance to be issued */
|
||||
if (p->link_up_issued) {
|
||||
@@ -646,7 +651,7 @@ tBTM_STATUS BTM_GetRole (BD_ADDR remote_bd_addr, UINT8 *p_role)
|
||||
return (BTM_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTM_SwitchRole
|
||||
@@ -865,6 +870,7 @@ void btm_acl_encrypt_change (UINT16 handle, UINT8 status, UINT8 encr_enable)
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#endif // (CLASSIC_BT_INCLUDED == TRUE)
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTM_SetLinkPolicy
|
||||
@@ -1472,6 +1478,7 @@ void btm_process_clk_off_comp_evt (UINT16 hci_handle, UINT16 clock_offset)
|
||||
|
||||
}
|
||||
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function btm_acl_role_changed
|
||||
@@ -1571,6 +1578,7 @@ void btm_acl_role_changed (UINT8 hci_status, BD_ADDR bd_addr, UINT8 new_role)
|
||||
#endif
|
||||
|
||||
}
|
||||
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
@@ -2599,6 +2607,7 @@ UINT8 BTM_SetTraceLevel (UINT8 new_level)
|
||||
return (btm_cb.trace_level);
|
||||
}
|
||||
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function btm_cont_rswitch
|
||||
@@ -2653,6 +2662,7 @@ void btm_cont_rswitch (tACL_CONN *p, tBTM_SEC_DEV_REC *p_dev_rec,
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // (CLASSIC_BT_INCLUDED == TRUE)
|
||||
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
/*******************************************************************************
|
||||
|
||||
@@ -820,9 +820,10 @@ void btm_pm_proc_mode_change (UINT8 hci_status, UINT16 hci_handle, UINT8 mode, U
|
||||
(*btm_cb.pm_reg_db[yy].cback)( p->remote_addr, mode, interval, hci_status);
|
||||
}
|
||||
}
|
||||
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
/* If mode change was because of an active role switch or change link key */
|
||||
btm_cont_rswitch(p, btm_find_dev(p->remote_addr), hci_status);
|
||||
#endif // (CLASSIC_BT_INCLUDED == TRUE)
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
|
||||
@@ -140,7 +140,10 @@ UINT8 legacy_auth_state;
|
||||
#define BTM_ACL_SWKEY_STATE_SWITCHING 3
|
||||
#define BTM_ACL_SWKEY_STATE_ENCRYPTION_ON 4
|
||||
#define BTM_ACL_SWKEY_STATE_IN_PROGRESS 5
|
||||
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
UINT8 switch_role_state;
|
||||
#endif // (CLASSIC_BT_INCLUDED == TRUE)
|
||||
|
||||
#define BTM_ACL_ENCRYPT_STATE_IDLE 0
|
||||
#define BTM_ACL_ENCRYPT_STATE_ENCRYPT_OFF 1 /* encryption turning off */
|
||||
@@ -207,9 +210,11 @@ tBTM_CMPL_CB *p_qossu_cmpl_cb; /* Callback function to be called when
|
||||
/* qos setup function completes */
|
||||
#endif // (CLASSIC_BT_INCLUDED == TRUE)
|
||||
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
tBTM_ROLE_SWITCH_CMPL switch_role_ref_data;
|
||||
tBTM_CMPL_CB *p_switch_role_cb; /* Callback function to be called when */
|
||||
/* requested switch role is completed */
|
||||
#endif // (CLASSIC_BT_INCLUDED == TRUE)
|
||||
|
||||
#if (BLE_HOST_READ_TX_POWER_EN == TRUE)
|
||||
TIMER_LIST_ENT tx_power_timer;
|
||||
|
||||
@@ -1025,8 +1025,9 @@ static void btu_hcif_encryption_change_evt (UINT8 *p)
|
||||
STREAM_TO_UINT8 (status, p);
|
||||
STREAM_TO_UINT16 (handle, p);
|
||||
STREAM_TO_UINT8 (encr_enable, p);
|
||||
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
btm_acl_encrypt_change (handle, status, encr_enable);
|
||||
#endif // (CLASSIC_BT_INCLUDED == TRUE)
|
||||
btm_sec_encrypt_change (handle, status, encr_enable);
|
||||
}
|
||||
#endif ///SMP_INCLUDED == TRUE
|
||||
@@ -1711,6 +1712,7 @@ static void btu_hcif_hdl_command_status (UINT16 opcode, UINT8 status, UINT8 *p_c
|
||||
case HCI_SWITCH_ROLE:
|
||||
/* Tell BTM that the command failed */
|
||||
/* read bd addr out of stored command */
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
if (p_cmd != NULL) {
|
||||
p_cmd++;
|
||||
STREAM_TO_BDADDR (bd_addr, p_cmd);
|
||||
@@ -1719,6 +1721,7 @@ static void btu_hcif_hdl_command_status (UINT16 opcode, UINT8 status, UINT8 *p_c
|
||||
btm_acl_role_changed(status, NULL, BTM_ROLE_UNDEFINED);
|
||||
}
|
||||
l2c_link_role_changed (NULL, BTM_ROLE_UNDEFINED, HCI_ERR_COMMAND_DISALLOWED);
|
||||
#endif // (CLASSIC_BT_INCLUDED == TRUE)
|
||||
break;
|
||||
|
||||
case HCI_CREATE_CONNECTION:
|
||||
|
||||
@@ -2274,8 +2274,11 @@ BOOLEAN l2cu_create_conn (tL2C_LCB *p_lcb, tBT_TRANSPORT transport)
|
||||
#if BTM_SCO_INCLUDED == TRUE
|
||||
BOOLEAN is_sco_active;
|
||||
#endif
|
||||
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
list_node_t *p_node = NULL;
|
||||
tL2C_LCB *p_lcb_cur = NULL;
|
||||
#endif // (CLASSIC_BT_INCLUDED == TRUE)
|
||||
|
||||
#if (BLE_INCLUDED == TRUE)
|
||||
tBT_DEVICE_TYPE dev_type;
|
||||
@@ -2298,6 +2301,7 @@ BOOLEAN l2cu_create_conn (tL2C_LCB *p_lcb, tBT_TRANSPORT transport)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
/* If there is a connection where we perform as a slave, try to switch roles
|
||||
for this connection */
|
||||
for (p_node = list_begin(l2cb.p_lcb_pool); p_node; p_node = list_next(p_node)) {
|
||||
@@ -2341,6 +2345,8 @@ BOOLEAN l2cu_create_conn (tL2C_LCB *p_lcb, tBT_TRANSPORT transport)
|
||||
p_lcb->link_state = LST_CONNECTING;
|
||||
|
||||
return (l2cu_create_conn_after_switch (p_lcb));
|
||||
#endif // (CLASSIC_BT_INCLUDED == TRUE)
|
||||
return false;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
|
||||
Reference in New Issue
Block a user