diff options
author | 2025-01-30 08:47:14 -0800 | |
---|---|---|
committer | 2025-01-30 08:47:14 -0800 | |
commit | 39c9e10673df96c8cc5e7673e05083074a176fce (patch) | |
tree | 509ac2a403ed10c94e8a9351b1a53b7d7c483508 | |
parent | 8701f554b1ad70d5edb4292a82b31b0021ca14d4 (diff) | |
parent | 5dc50bc754f84ba52cab8082105130c8903fe12b (diff) |
Merge "Only one CSIP earbud connected after pairing" into main
-rw-r--r-- | system/conf/interop_database.conf | 10 | ||||
-rw-r--r-- | system/device/include/interop.h | 3 | ||||
-rw-r--r-- | system/device/src/interop.cc | 1 | ||||
-rw-r--r-- | system/stack/gatt/gatt_attr.cc | 28 |
4 files changed, 38 insertions, 4 deletions
diff --git a/system/conf/interop_database.conf b/system/conf/interop_database.conf index 344a7be347..94ef06e885 100644 --- a/system/conf/interop_database.conf +++ b/system/conf/interop_database.conf @@ -105,6 +105,16 @@ C8:FD:19 = Address_Based 0C:A6:94 = Address_Based 00:0f:59:50:00:00-00:0f:59:6f:ff:ff = Address_Range_Based +# Some devices only respond to read SIRK request via GATT_READ_CHAR_VALUE +# disabling GATT_READ_BY_TYPE for SIRK read for those devices. +# 48:73:CB ==> Name: Redmi buds +# 00:02:3C ==> Name: Zen Air Pro +# 14:0A:29 ==> Name: Redmi Buds 5 Pro +[INTEROP_DISABLE_SIRK_READ_BY_TYPE] +48:73:CB = Address_Based +00:02:3C = Address_Based +14:0A:29 = Address_Based + # Disable automatic pairing with headsets/car-kits # Some car kits do not react kindly to a failed pairing attempt and # do not allow immediate re-pairing. Denylist these so that the initial diff --git a/system/device/include/interop.h b/system/device/include/interop.h index e5d9940d10..a19c5fbaae 100644 --- a/system/device/include/interop.h +++ b/system/device/include/interop.h @@ -48,6 +48,9 @@ typedef enum { // levels or general lack of controlability. INTEROP_DISABLE_ABSOLUTE_VOLUME, + // Devices requiring this read characteristics via GATT_READ_CHAR_VALUE + INTEROP_DISABLE_SIRK_READ_BY_TYPE, + // Disable automatic pairing with headsets/car-kits // Some car kits do not react kindly to a failed pairing attempt and // do not allow immediate re-pairing. Rejectlist these so that the initial diff --git a/system/device/src/interop.cc b/system/device/src/interop.cc index 0f2f83f0d1..614e3c8981 100644 --- a/system/device/src/interop.cc +++ b/system/device/src/interop.cc @@ -327,6 +327,7 @@ static const char* interop_feature_string_(const interop_feature_t feature) { CASE_RETURN_STR(INTEROP_DISABLE_LE_SECURE_CONNECTIONS) CASE_RETURN_STR(INTEROP_AUTO_RETRY_PAIRING) CASE_RETURN_STR(INTEROP_DISABLE_ABSOLUTE_VOLUME) + CASE_RETURN_STR(INTEROP_DISABLE_SIRK_READ_BY_TYPE) CASE_RETURN_STR(INTEROP_DISABLE_AUTO_PAIRING) CASE_RETURN_STR(INTEROP_KEYBOARD_REQUIRES_FIXED_PIN) CASE_RETURN_STR(INTEROP_2MBPS_LINK_ONLY) diff --git a/system/stack/gatt/gatt_attr.cc b/system/stack/gatt/gatt_attr.cc index a9d9e12b66..7b629e18e2 100644 --- a/system/stack/gatt/gatt_attr.cc +++ b/system/stack/gatt/gatt_attr.cc @@ -33,10 +33,12 @@ #include "eatt/eatt.h" #include "gatt_api.h" #include "gatt_int.h" +#include "device/include/interop.h" #include "internal_include/bt_target.h" #include "stack/include/bt_types.h" #include "stack/include/bt_uuid16.h" #include "stack/include/btm_sec_api.h" +#include "stack/include/btm_ble_addr.h" #include "types/bluetooth/uuid.h" #include "types/raw_address.h" @@ -847,6 +849,7 @@ static bool read_sr_sirk_req(tCONN_ID conn_id, uint8_t sirk_type, Octet16& sirk)> cb) { tGATT_READ_PARAM param = {}; + tBLE_ADDR_TYPE address_type = BLE_ADDR_PUBLIC; param.service.s_handle = 1; param.service.e_handle = 0xFFFF; @@ -854,10 +857,27 @@ static bool read_sr_sirk_req(tCONN_ID conn_id, param.service.uuid = bluetooth::Uuid::From16Bit(GATT_UUID_CSIS_SIRK); - if (GATTC_Read(conn_id, GATT_READ_BY_TYPE, ¶m) != GATT_SUCCESS) { - log::error("Read GATT Support features GATT_Read Failed, conn_id: {}", - static_cast<int>(conn_id)); - return false; + uint8_t tcb_idx = gatt_get_tcb_idx(conn_id); + tGATT_TCB& tcb = gatt_cb.tcb[tcb_idx]; + + RawAddress identity_address = tcb.peer_bda; + + btm_random_pseudo_to_identity_addr(&identity_address, &address_type); + + if (address_type == BLE_ADDR_PUBLIC && + interop_match_addr(INTEROP_DISABLE_SIRK_READ_BY_TYPE, &identity_address)) { + if (GATTC_Read(conn_id, GATT_READ_CHAR_VALUE, ¶m) != GATT_SUCCESS) { + log::error("Read GATT Support features GATT_Read Failed, conn_id: {}", + static_cast<int>(conn_id)); + return false; + } + } + else{ + if (GATTC_Read(conn_id, GATT_READ_BY_TYPE, ¶m) != GATT_SUCCESS) { + log::error("Read GATT Support features GATT_Read Failed, conn_id: {}", + static_cast<int>(conn_id)); + return false; + } } gatt_op_cb_data cb_data; |