From 592e743dad1bba8e1f326e330a964080921f223a Mon Sep 17 00:00:00 2001 From: WebDust21 Date: Wed, 31 Jul 2024 21:40:03 -0400 Subject: [PATCH] fix(bt): Enable use of RESERVED bits in COD (GitHub PR) --- components/bt/host/bluedroid/btc/profile/std/gap/btc_gap_bt.c | 2 ++ components/bt/host/bluedroid/stack/include/stack/btm_api.h | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/components/bt/host/bluedroid/btc/profile/std/gap/btc_gap_bt.c b/components/bt/host/bluedroid/btc/profile/std/gap/btc_gap_bt.c index f43e96390c..deb362fb79 100644 --- a/components/bt/host/bluedroid/btc/profile/std/gap/btc_gap_bt.c +++ b/components/bt/host/bluedroid/btc/profile/std/gap/btc_gap_bt.c @@ -586,6 +586,7 @@ static void btc_gap_bt_set_cod(btc_gap_bt_args_t *arg) tBTA_UTL_COD p_cod; esp_bt_cod_t *cod = &(arg->set_cod.cod); p_cod.minor = cod->minor << 2; + p_cod.minor |= cod->reserved_2; p_cod.major = cod->major; p_cod.service = cod->service << 5; bool ret = utl_set_device_class(&p_cod, arg->set_cod.mode); @@ -603,6 +604,7 @@ esp_err_t btc_gap_bt_get_cod(esp_bt_cod_t *cod) return ESP_BT_STATUS_FAIL; } cod->minor = p_cod.minor >> 2; + cod->reserved_2 = p_cod.minor & 0x03; cod->major = p_cod.major; cod->service = p_cod.service >> 5; return ESP_BT_STATUS_SUCCESS; diff --git a/components/bt/host/bluedroid/stack/include/stack/btm_api.h b/components/bt/host/bluedroid/stack/include/stack/btm_api.h index c3910614e7..9eaff6f77e 100644 --- a/components/bt/host/bluedroid/stack/include/stack/btm_api.h +++ b/components/bt/host/bluedroid/stack/include/stack/btm_api.h @@ -447,7 +447,7 @@ typedef void (tBTM_ADD_DEV_TO_RESOLVING_LIST_CMPL_CBACK) (UINT8 status); /* the COD masks */ #define BTM_COD_FORMAT_TYPE_MASK 0x03 -#define BTM_COD_MINOR_CLASS_MASK 0xFC +#define BTM_COD_MINOR_CLASS_MASK 0xFF #define BTM_COD_MAJOR_CLASS_MASK 0x1F #define BTM_COD_SERVICE_CLASS_LO_B 0x00E0 #define BTM_COD_SERVICE_CLASS_MASK 0xFFE0