Loading system/device/include/interop_database.h +13 −3 Original line number Diff line number Diff line Loading @@ -153,9 +153,6 @@ static const interop_addr_entry_t interop_addr_database[] = { // AirPods 2 - unacceptably loud volume {{{0x9c, 0x64, 0x8b, 0, 0, 0}}, 3, INTEROP_DISABLE_ABSOLUTE_VOLUME}, // Phonak AG - volume level not change {{{0x00, 0x0f, 0x59, 0, 0, 0}}, 3, INTEROP_DISABLE_ABSOLUTE_VOLUME}, // for skip name request, // because BR/EDR address and ADV random address are the same {{{0xd4, 0x7a, 0xe2, 0, 0, 0}}, 3, INTEROP_DISABLE_NAME_REQUEST}, Loading Loading @@ -195,6 +192,19 @@ static const interop_addr_entry_t interop_addr_database[] = { {{{0x00, 0x0a, 0x08, 0, 0, 0}}, 3, INTEROP_AVRCP_1_3_ONLY}, }; typedef struct { RawAddress addr_start; RawAddress addr_end; interop_feature_t feature; } interop_addr_range_entry_t; static const interop_addr_range_entry_t interop_addr_range_database[] = { // Phonak AG - volume level not change {{{0x00, 0x0f, 0x59, 0x50, 0x00, 0x00}}, {{0x00, 0x0f, 0x59, 0x6f, 0xff, 0xff}}, INTEROP_DISABLE_ABSOLUTE_VOLUME}, }; typedef struct { char name[20]; size_t length; Loading system/device/src/interop.cc +21 −1 Original line number Diff line number Diff line Loading @@ -44,6 +44,8 @@ static bool interop_match_fixed_(const interop_feature_t feature, const RawAddress* addr); static bool interop_match_dynamic_(const interop_feature_t feature, const RawAddress* addr); static bool interop_match_range_(const interop_feature_t feature, const RawAddress* addr); // Interface functions Loading @@ -52,7 +54,8 @@ bool interop_match_addr(const interop_feature_t feature, CHECK(addr); if (interop_match_fixed_(feature, addr) || interop_match_dynamic_(feature, addr)) { interop_match_dynamic_(feature, addr) || interop_match_range_(feature, addr)) { LOG_INFO("%s() Device %s is a match for interop workaround %s.", __func__, addr->ToString().c_str(), interop_feature_string_(feature)); return true; Loading Loading @@ -190,3 +193,20 @@ static bool interop_match_fixed_(const interop_feature_t feature, return false; } static bool interop_match_range_(const interop_feature_t feature, const RawAddress* addr) { CHECK(addr); const size_t db_size = sizeof(interop_addr_range_database) / sizeof(interop_addr_range_entry_t); for (size_t i = 0; i != db_size; ++i) { if (feature == interop_addr_range_database[i].feature && *addr >= interop_addr_range_database[i].addr_start && *addr <= interop_addr_range_database[i].addr_end) { return true; } } return false; } system/device/test/interop_test.cc +23 −0 Original line number Diff line number Diff line Loading @@ -82,3 +82,26 @@ TEST(InteropTest, test_name_miss) { EXPECT_FALSE(interop_match_name(INTEROP_DISABLE_AUTO_PAIRING, "audi")); EXPECT_FALSE(interop_match_name(INTEROP_AUTO_RETRY_PAIRING, "BMW M3")); } TEST(InteropTest, test_range_hit) { RawAddress test_address; RawAddress::FromString("00:0f:59:50:00:00", test_address); ASSERT_TRUE( interop_match_addr(INTEROP_DISABLE_ABSOLUTE_VOLUME, &test_address)); RawAddress::FromString("00:0f:59:59:12:34", test_address); ASSERT_TRUE( interop_match_addr(INTEROP_DISABLE_ABSOLUTE_VOLUME, &test_address)); RawAddress::FromString("00:0f:59:6f:ff:ff", test_address); ASSERT_TRUE( interop_match_addr(INTEROP_DISABLE_ABSOLUTE_VOLUME, &test_address)); } TEST(InteropTest, test_range_miss) { RawAddress test_address; RawAddress::FromString("00:0f:59:49:12:34", test_address); ASSERT_FALSE( interop_match_addr(INTEROP_DISABLE_ABSOLUTE_VOLUME, &test_address)); RawAddress::FromString("00:0f:59:70:12:34", test_address); ASSERT_FALSE( interop_match_addr(INTEROP_DISABLE_ABSOLUTE_VOLUME, &test_address)); } Loading
system/device/include/interop_database.h +13 −3 Original line number Diff line number Diff line Loading @@ -153,9 +153,6 @@ static const interop_addr_entry_t interop_addr_database[] = { // AirPods 2 - unacceptably loud volume {{{0x9c, 0x64, 0x8b, 0, 0, 0}}, 3, INTEROP_DISABLE_ABSOLUTE_VOLUME}, // Phonak AG - volume level not change {{{0x00, 0x0f, 0x59, 0, 0, 0}}, 3, INTEROP_DISABLE_ABSOLUTE_VOLUME}, // for skip name request, // because BR/EDR address and ADV random address are the same {{{0xd4, 0x7a, 0xe2, 0, 0, 0}}, 3, INTEROP_DISABLE_NAME_REQUEST}, Loading Loading @@ -195,6 +192,19 @@ static const interop_addr_entry_t interop_addr_database[] = { {{{0x00, 0x0a, 0x08, 0, 0, 0}}, 3, INTEROP_AVRCP_1_3_ONLY}, }; typedef struct { RawAddress addr_start; RawAddress addr_end; interop_feature_t feature; } interop_addr_range_entry_t; static const interop_addr_range_entry_t interop_addr_range_database[] = { // Phonak AG - volume level not change {{{0x00, 0x0f, 0x59, 0x50, 0x00, 0x00}}, {{0x00, 0x0f, 0x59, 0x6f, 0xff, 0xff}}, INTEROP_DISABLE_ABSOLUTE_VOLUME}, }; typedef struct { char name[20]; size_t length; Loading
system/device/src/interop.cc +21 −1 Original line number Diff line number Diff line Loading @@ -44,6 +44,8 @@ static bool interop_match_fixed_(const interop_feature_t feature, const RawAddress* addr); static bool interop_match_dynamic_(const interop_feature_t feature, const RawAddress* addr); static bool interop_match_range_(const interop_feature_t feature, const RawAddress* addr); // Interface functions Loading @@ -52,7 +54,8 @@ bool interop_match_addr(const interop_feature_t feature, CHECK(addr); if (interop_match_fixed_(feature, addr) || interop_match_dynamic_(feature, addr)) { interop_match_dynamic_(feature, addr) || interop_match_range_(feature, addr)) { LOG_INFO("%s() Device %s is a match for interop workaround %s.", __func__, addr->ToString().c_str(), interop_feature_string_(feature)); return true; Loading Loading @@ -190,3 +193,20 @@ static bool interop_match_fixed_(const interop_feature_t feature, return false; } static bool interop_match_range_(const interop_feature_t feature, const RawAddress* addr) { CHECK(addr); const size_t db_size = sizeof(interop_addr_range_database) / sizeof(interop_addr_range_entry_t); for (size_t i = 0; i != db_size; ++i) { if (feature == interop_addr_range_database[i].feature && *addr >= interop_addr_range_database[i].addr_start && *addr <= interop_addr_range_database[i].addr_end) { return true; } } return false; }
system/device/test/interop_test.cc +23 −0 Original line number Diff line number Diff line Loading @@ -82,3 +82,26 @@ TEST(InteropTest, test_name_miss) { EXPECT_FALSE(interop_match_name(INTEROP_DISABLE_AUTO_PAIRING, "audi")); EXPECT_FALSE(interop_match_name(INTEROP_AUTO_RETRY_PAIRING, "BMW M3")); } TEST(InteropTest, test_range_hit) { RawAddress test_address; RawAddress::FromString("00:0f:59:50:00:00", test_address); ASSERT_TRUE( interop_match_addr(INTEROP_DISABLE_ABSOLUTE_VOLUME, &test_address)); RawAddress::FromString("00:0f:59:59:12:34", test_address); ASSERT_TRUE( interop_match_addr(INTEROP_DISABLE_ABSOLUTE_VOLUME, &test_address)); RawAddress::FromString("00:0f:59:6f:ff:ff", test_address); ASSERT_TRUE( interop_match_addr(INTEROP_DISABLE_ABSOLUTE_VOLUME, &test_address)); } TEST(InteropTest, test_range_miss) { RawAddress test_address; RawAddress::FromString("00:0f:59:49:12:34", test_address); ASSERT_FALSE( interop_match_addr(INTEROP_DISABLE_ABSOLUTE_VOLUME, &test_address)); RawAddress::FromString("00:0f:59:70:12:34", test_address); ASSERT_FALSE( interop_match_addr(INTEROP_DISABLE_ABSOLUTE_VOLUME, &test_address)); }