From 378b708e15ff01bfffca3fbb2214d196bf0bfa6f Mon Sep 17 00:00:00 2001 From: Zhi Wei Jian Date: Wed, 7 Jan 2026 17:24:44 +0800 Subject: [PATCH] fix(ble/bluedroid): Delete BLE_HOST_ENABLE_TEST_MODE_EN (cherry picked from commit f08ff1448b4eb50a0d1f85f08c5b7b47f535000a) Co-authored-by: zhiweijian --- .../bt/host/bluedroid/bta/dm/bta_dm_act.c | 34 ----------- .../bt/host/bluedroid/bta/dm/bta_dm_api.c | 47 --------------- .../bt/host/bluedroid/bta/dm/bta_dm_main.c | 4 -- .../bluedroid/bta/dm/include/bta_dm_int.h | 4 -- .../common/include/common/bt_target.h | 4 -- .../bt/host/bluedroid/stack/btm/btm_devctl.c | 59 ------------------- 6 files changed, 152 deletions(-) diff --git a/components/bt/host/bluedroid/bta/dm/bta_dm_act.c b/components/bt/host/bluedroid/bta/dm/bta_dm_act.c index 4315077671..dfe1c952f4 100644 --- a/components/bt/host/bluedroid/bta/dm/bta_dm_act.c +++ b/components/bt/host/bluedroid/bta/dm/bta_dm_act.c @@ -4659,40 +4659,6 @@ void bta_dm_eir_update_uuid(tBT_UUID uuid, BOOLEAN adding) } #endif -#if (BLE_HOST_ENABLE_TEST_MODE_EN == TRUE) -/******************************************************************************* -** -** Function bta_dm_enable_test_mode -** -** Description enable test mode -** -** -** Returns void -** -*******************************************************************************/ -void bta_dm_enable_test_mode(tBTA_DM_MSG *p_data) -{ - UNUSED(p_data); - BTM_EnableTestMode(); -} - -/******************************************************************************* -** -** Function bta_dm_disable_test_mode -** -** Description disable test mode -** -** -** Returns void -** -*******************************************************************************/ -void bta_dm_disable_test_mode(tBTA_DM_MSG *p_data) -{ - UNUSED(p_data); - BTM_DeviceReset(NULL); -} -#endif // #if (BLE_HOST_ENABLE_TEST_MODE_EN == TRUE) - #if (BLE_HOST_EXECUTE_CBACK_EN == TRUE) /******************************************************************************* ** diff --git a/components/bt/host/bluedroid/bta/dm/bta_dm_api.c b/components/bt/host/bluedroid/bta/dm/bta_dm_api.c index c35abf2e97..e67dc84186 100644 --- a/components/bt/host/bluedroid/bta/dm/bta_dm_api.c +++ b/components/bt/host/bluedroid/bta/dm/bta_dm_api.c @@ -110,53 +110,6 @@ tBTA_STATUS BTA_DisableBluetooth(void) return BTA_SUCCESS; } -#if (BLE_HOST_ENABLE_TEST_MODE_EN == TRUE) -/******************************************************************************* -** -** Function BTA_EnableTestMode -** -** Description Enables bluetooth device under test mode -** -** -** Returns tBTA_STATUS -** -*******************************************************************************/ -tBTA_STATUS BTA_EnableTestMode(void) -{ - BT_HDR *p_msg; - - APPL_TRACE_API("BTA_EnableTestMode"); - - if ((p_msg = (BT_HDR *) osi_malloc(sizeof(BT_HDR))) != NULL) { - p_msg->event = BTA_DM_API_ENABLE_TEST_MODE_EVT; - bta_sys_sendmsg(p_msg); - return BTA_SUCCESS; - } - return BTA_FAILURE; -} - -/******************************************************************************* -** -** Function BTA_DisableTestMode -** -** Description Disable bluetooth device under test mode -** -** -** Returns None -** -*******************************************************************************/ -void BTA_DisableTestMode(void) -{ - BT_HDR *p_msg; - - APPL_TRACE_API("BTA_DisableTestMode"); - - if ((p_msg = (BT_HDR *) osi_malloc(sizeof(BT_HDR))) != NULL) { - p_msg->event = BTA_DM_API_DISABLE_TEST_MODE_EVT; - bta_sys_sendmsg(p_msg); - } -} -#endif // #if (BLE_HOST_ENABLE_TEST_MODE_EN == TRUE) /******************************************************************************* ** diff --git a/components/bt/host/bluedroid/bta/dm/bta_dm_main.c b/components/bt/host/bluedroid/bta/dm/bta_dm_main.c index b2734dcea8..cbcf05c0a9 100644 --- a/components/bt/host/bluedroid/bta/dm/bta_dm_main.c +++ b/components/bt/host/bluedroid/bta/dm/bta_dm_main.c @@ -183,10 +183,6 @@ const tBTA_DM_ACTION bta_dm_action[BTA_DM_MAX_EVT] = { #endif // #if (BLE_HOST_SETUP_STORAGE_EN == TRUE) bta_dm_ble_disconnect, /* BTA_DM_API_BLE_DISCONNECT_EVT */ #endif -#if (BLE_HOST_ENABLE_TEST_MODE_EN == TRUE) - bta_dm_enable_test_mode, /* BTA_DM_API_ENABLE_TEST_MODE_EVT */ - bta_dm_disable_test_mode, /* BTA_DM_API_DISABLE_TEST_MODE_EVT */ -#endif // #if (BLE_HOST_ENABLE_TEST_MODE_EN == TRUE) #if (BLE_HOST_EXECUTE_CBACK_EN == TRUE) bta_dm_execute_callback, /* BTA_DM_API_EXECUTE_CBACK_EVT */ #endif // #if (BLE_HOST_EXECUTE_CBACK_EN == TRUE) diff --git a/components/bt/host/bluedroid/bta/dm/include/bta_dm_int.h b/components/bt/host/bluedroid/bta/dm/include/bta_dm_int.h index c9fd1b1e88..88fd5dc159 100644 --- a/components/bt/host/bluedroid/bta/dm/include/bta_dm_int.h +++ b/components/bt/host/bluedroid/bta/dm/include/bta_dm_int.h @@ -169,10 +169,6 @@ enum { BTA_DM_API_BLE_DISCONNECT_EVT, #endif -#if (BLE_HOST_ENABLE_TEST_MODE_EN == TRUE) - BTA_DM_API_ENABLE_TEST_MODE_EVT, - BTA_DM_API_DISABLE_TEST_MODE_EVT, -#endif // #if (BLE_HOST_ENABLE_TEST_MODE_EN == TRUE) #if (BLE_HOST_EXECUTE_CBACK_EN == TRUE) BTA_DM_API_EXECUTE_CBACK_EVT, #endif // #if (BLE_HOST_EXECUTE_CBACK_EN == TRUE) diff --git a/components/bt/host/bluedroid/common/include/common/bt_target.h b/components/bt/host/bluedroid/common/include/common/bt_target.h index 7dfff46239..8da0544a37 100644 --- a/components/bt/host/bluedroid/common/include/common/bt_target.h +++ b/components/bt/host/bluedroid/common/include/common/bt_target.h @@ -1618,10 +1618,6 @@ #define BLE_INCLUDED FALSE #endif -#ifndef BLE_HOST_ENABLE_TEST_MODE_EN -#define BLE_HOST_ENABLE_TEST_MODE_EN FALSE -#endif - #ifndef BLE_HOST_EXECUTE_CBACK_EN #define BLE_HOST_EXECUTE_CBACK_EN FALSE #endif diff --git a/components/bt/host/bluedroid/stack/btm/btm_devctl.c b/components/bt/host/bluedroid/stack/btm/btm_devctl.c index c0163335ca..9698c439ab 100644 --- a/components/bt/host/bluedroid/stack/btm/btm_devctl.c +++ b/components/bt/host/bluedroid/stack/btm/btm_devctl.c @@ -1095,65 +1095,6 @@ tBTM_STATUS BTM_WriteVoiceSettings(UINT16 settings) return (BTM_NO_RESOURCES); } -#if (BLE_HOST_ENABLE_TEST_MODE_EN == TRUE) -/******************************************************************************* -** -** Function BTM_EnableTestMode -** -** Description Send HCI the enable device under test command. -** -** Note: Controller can only be taken out of this mode by -** resetting the controller. -** -** Returns -** BTM_SUCCESS Command sent. -** BTM_NO_RESOURCES If out of resources to send the command. -** -** -*******************************************************************************/ -tBTM_STATUS BTM_EnableTestMode(void) -{ - UINT8 cond; - - BTM_TRACE_EVENT ("BTM: BTM_EnableTestMode"); - - /* set auto accept connection as this is needed during test mode */ - /* Allocate a buffer to hold HCI command */ - cond = HCI_DO_AUTO_ACCEPT_CONNECT; - if (!btsnd_hcic_set_event_filter(HCI_FILTER_CONNECTION_SETUP, - HCI_FILTER_COND_NEW_DEVICE, - &cond, sizeof(cond))) { - return (BTM_NO_RESOURCES); - } - - /* put device to connectable mode */ - if (BTM_SetConnectability(BTM_CONNECTABLE, BTM_DEFAULT_CONN_WINDOW, - BTM_DEFAULT_CONN_INTERVAL) != BTM_SUCCESS) { - return BTM_NO_RESOURCES; - } - - /* put device to discoverable mode */ - if (BTM_SetDiscoverability(BTM_GENERAL_DISCOVERABLE, BTM_DEFAULT_DISC_WINDOW, - BTM_DEFAULT_DISC_INTERVAL) != BTM_SUCCESS) { - return BTM_NO_RESOURCES; - } - - /* mask off all of event from controller */ - hci_layer_get_interface()->transmit_command( - hci_packet_factory_get_interface()->make_set_event_mask((const bt_event_mask_t *)("\x00\x00\x00\x00\x00\x00\x00\x00")), - NULL, - NULL, - NULL); - - /* Send the HCI command */ - if (btsnd_hcic_enable_test_mode ()) { - return (BTM_SUCCESS); - } else { - return (BTM_NO_RESOURCES); - } -} -#endif // #if (BLE_HOST_ENABLE_TEST_MODE_EN == TRUE) - #if (CLASSIC_BT_INCLUDED == TRUE) /******************************************************************************* **