diff --git a/components/bt/host/bluedroid/Kconfig.in b/components/bt/host/bluedroid/Kconfig.in index a4659e9666..d7a69d2f09 100644 --- a/components/bt/host/bluedroid/Kconfig.in +++ b/components/bt/host/bluedroid/Kconfig.in @@ -192,6 +192,14 @@ config BT_HID_DEVICE_ENABLED help This enables the BT HID Device +config BT_HID_REMOVE_DEVICE_BONDING_ENABLED + bool "Remove Device Bonding Information when HID Virtual Cable Unplugging" + depends on BT_HID_ENABLED + default y + help + This enables the BT HID to remove device bonding information when virtual cable unplugging, + removing device bonding information is optional in HID 1.0 but mandatory in HID 1.1 + menuconfig BT_PBAC_ENABLED bool "PBAP Client" depends on BT_CLASSIC_ENABLED diff --git a/components/bt/host/bluedroid/btc/profile/std/hid/btc_hd.c b/components/bt/host/bluedroid/btc/profile/std/hid/btc_hd.c index 0d99c030b6..3bb4ff5c83 100644 --- a/components/bt/host/bluedroid/btc/profile/std/hid/btc_hd.c +++ b/components/bt/host/bluedroid/btc/profile/std/hid/btc_hd.c @@ -903,14 +903,10 @@ void btc_hd_cb_handler(btc_msg_t *msg) btc_hd_cb_to_app(ESP_HIDD_INTR_DATA_EVT, ¶m); break; case BTA_HD_VC_UNPLUG_EVT: { - bt_bdaddr_t *bd_addr = (bt_bdaddr_t *)&p_data->conn.bda; - if (bta_dm_check_if_only_hd_connected(p_data->conn.bda)) { - BTC_TRACE_DEBUG("%s: Removing bonding as only HID profile connected", __func__); - BTA_DmRemoveDevice((uint8_t *)&p_data->conn.bda, BT_TRANSPORT_BR_EDR); - } else { - BTC_TRACE_DEBUG("%s: Only removing HID data as some other profiles connected", __func__); - btc_hd_remove_device(*bd_addr); - } +#if BTC_HID_REMOVE_DEVICE_BONDING + BTC_TRACE_DEBUG("%s: Removing bonding information", __func__); + BTA_DmRemoveDevice((uint8_t *)&p_data->conn.bda, BT_TRANSPORT_BR_EDR); +#endif if (btc_hd_cb.status == BTC_HD_DISCONNECTING || btc_hd_cb.status == BTC_HD_CONNECTING || btc_hd_cb.status == BTC_HD_CONNECTED) { diff --git a/components/bt/host/bluedroid/btc/profile/std/hid/btc_hh.c b/components/bt/host/bluedroid/btc/profile/std/hid/btc_hh.c index 1d6f20201e..1b02b33286 100644 --- a/components/bt/host/bluedroid/btc/profile/std/hid/btc_hh.c +++ b/components/bt/host/bluedroid/btc/profile/std/hid/btc_hh.c @@ -1372,7 +1372,10 @@ void btc_hh_cb_handler(btc_msg_t *msg) */ if (p_dev->local_vup) { p_dev->local_vup = false; +#if BTC_HID_REMOVE_DEVICE_BONDING BTA_DmRemoveDevice(p_dev->bd_addr, BT_TRANSPORT_BR_EDR); +#endif + btc_hh_remove_device(p_dev->bd_addr); } btc_hh_cb.status = (BTC_HH_STATUS)BTC_HH_DEV_DISCONNECTED; @@ -1406,8 +1409,9 @@ void btc_hh_cb_handler(btc_msg_t *msg) // [boblane] if (p_dev->local_vup) { p_dev->local_vup = false; +#if BTC_HID_REMOVE_DEVICE_BONDING BTA_DmRemoveDevice(p_dev->bd_addr, BT_TRANSPORT_BR_EDR); - } else { +#endif btc_hh_remove_device(p_dev->bd_addr); } param.unplug.status = p_data->dev_status.status; diff --git a/components/bt/host/bluedroid/common/include/common/bluedroid_user_config.h b/components/bt/host/bluedroid/common/include/common/bluedroid_user_config.h index b3f48a1196..0b729e9e85 100644 --- a/components/bt/host/bluedroid/common/include/common/bluedroid_user_config.h +++ b/components/bt/host/bluedroid/common/include/common/bluedroid_user_config.h @@ -108,6 +108,13 @@ #define UC_BT_HID_DEVICE_ENABLED FALSE #endif +//HID remove device bonding option +#ifdef CONFIG_BT_HID_REMOVE_DEVICE_BONDING_ENABLED +#define UC_BT_HID_REMOVE_DEVICE_BONDING_ENABLED CONFIG_BT_HID_REMOVE_DEVICE_BONDING_ENABLED +#else +#define UC_BT_HID_REMOVE_DEVICE_BONDING_ENABLED FALSE +#endif + //BQB(BT) #ifdef CONFIG_BT_CLASSIC_BQB_ENABLED #define UC_BT_CLASSIC_BQB_ENABLED CONFIG_BT_CLASSIC_BQB_ENABLED 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 6716615df5..a3991101fa 100644 --- a/components/bt/host/bluedroid/common/include/common/bt_target.h +++ b/components/bt/host/bluedroid/common/include/common/bt_target.h @@ -176,6 +176,10 @@ #define BTC_HD_INCLUDED TRUE #endif /* UC_BT_HID_DEVICE_ENABLED */ +#if UC_BT_HID_REMOVE_DEVICE_BONDING_ENABLED +#define BTC_HID_REMOVE_DEVICE_BONDING TRUE +#endif + #if UC_BT_GOEPC_ENABLED #ifndef RFCOMM_INCLUDED #define RFCOMM_INCLUDED TRUE @@ -481,6 +485,10 @@ #define BTC_HD_INCLUDED FALSE #endif +#ifndef BTC_HID_REMOVE_DEVICE_BONDING +#define BTC_HID_REMOVE_DEVICE_BONDING FALSE +#endif + #ifndef SBC_DEC_INCLUDED #define SBC_DEC_INCLUDED FALSE #endif