From b47bf4e5aec0db5ac417482d11a83a9f2922b2b3 Mon Sep 17 00:00:00 2001 From: Srinu Jella Date: Wed, 7 Dec 2016 19:16:31 +0530 Subject: [PATCH] Don't initiate role switch for blacklisted devices Some devices always reject role switches and role switch retries from the DUT may lead to A2DP glitches and LMP timeouts. Test: manual Bug: 33000157 Change-Id: I535a2c45ced0e14cf5530f78f3367569b306b1f4 Merged-In: I535a2c45ced0e14cf5530f78f3367569b306b1f4 (cherry picked from commit 811200c8d120d987695445c28fda378677ba21c1) --- device/include/interop.h | 7 ++++++- device/include/interop_database.h | 18 ++++++++++++++++++ device/src/interop.cc | 1 + stack/btm/btm_acl.cc | 5 +++++ 4 files changed, 30 insertions(+), 1 deletion(-) diff --git a/device/include/interop.h b/device/include/interop.h index 5642a195e..ec2067a5f 100644 --- a/device/include/interop.h +++ b/device/include/interop.h @@ -84,7 +84,12 @@ typedef enum { // Some car kits indicate that role switch is supported, but then reject // role switch attempts. After rejecting several role switch attempts, // such car kits will go into bad state. - INTEROP_DYNAMIC_ROLE_SWITCH + INTEROP_DYNAMIC_ROLE_SWITCH, + + // Disable role switch for headsets/car-kits. + // Some car kits allow role switch but when the Phone initiates role switch, + // the Remote device will go into bad state that will lead to LMP time out. + INTEROP_DISABLE_ROLE_SWITCH } interop_feature_t; // Check if a given |addr| matches a known interoperability workaround as diff --git a/device/include/interop_database.h b/device/include/interop_database.h index 36a8ae2f9..cec6ef5fc 100644 --- a/device/include/interop_database.h +++ b/device/include/interop_database.h @@ -111,6 +111,24 @@ static const interop_addr_entry_t interop_addr_database[] = { // Kenwood KMM-BT518HD - no audio when A2DP codec sample rate is changed {{{0x00, 0x1d, 0x86, 0, 0, 0}}, 3, INTEROP_DISABLE_AVDTP_RECONFIGURE}, + + // NAC FORD-2013 - Lincoln + {{{0x00, 0x26, 0xb4, 0, 0, 0}}, 3, INTEROP_DISABLE_ROLE_SWITCH}, + + // Toyota Prius - 2015 + {{{0xfc, 0xc2, 0xde, 0, 0, 0}}, 3, INTEROP_DISABLE_ROLE_SWITCH}, + + // OBU II Bluetooth dongle + {{{0x00, 0x04, 0x3e, 0, 0, 0}}, 3, INTEROP_DISABLE_ROLE_SWITCH}, + + // Roman R9020 + {{{0x00, 0x23, 0x01, 0, 0, 0}}, 3, INTEROP_DISABLE_ROLE_SWITCH}, + + // Jabra Storm + {{{0x1c, 0x48, 0xf9, 0, 0, 0}}, 3, INTEROP_DISABLE_ROLE_SWITCH}, + + // Jeep Uconnect + {{{0x00, 0x54, 0xaf, 0, 0, 0}}, 3, INTEROP_DISABLE_ROLE_SWITCH}, }; typedef struct { diff --git a/device/src/interop.cc b/device/src/interop.cc index 275f1ad25..8e3618185 100644 --- a/device/src/interop.cc +++ b/device/src/interop.cc @@ -128,6 +128,7 @@ static const char* interop_feature_string_(const interop_feature_t feature) { CASE_RETURN_STR(INTEROP_GATTC_NO_SERVICE_CHANGED_IND) CASE_RETURN_STR(INTEROP_DISABLE_AVDTP_RECONFIGURE) CASE_RETURN_STR(INTEROP_DYNAMIC_ROLE_SWITCH) + CASE_RETURN_STR(INTEROP_DISABLE_ROLE_SWITCH) } return "UNKNOWN"; diff --git a/stack/btm/btm_acl.cc b/stack/btm/btm_acl.cc index d6d523d34..07a80fb06 100644 --- a/stack/btm/btm_acl.cc +++ b/stack/btm/btm_acl.cc @@ -571,6 +571,11 @@ tBTM_STATUS BTM_SwitchRole(BD_ADDR remote_bd_addr, uint8_t new_role, /* Finished if already in desired role */ if (p->link_role == new_role) return (BTM_SUCCESS); + if (interop_match_addr(INTEROP_DISABLE_ROLE_SWITCH, + (const bt_bdaddr_t*)&remote_bd_addr)) { + return BTM_DEV_BLACKLISTED; + } + #if (BTM_SCO_INCLUDED == TRUE) /* Check if there is any SCO Active on this BD Address */ is_sco_active = btm_is_sco_active_by_bdaddr(remote_bd_addr); -- 2.11.0