Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7d101f58 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Disable sniff for faulty remotes"

parents 9ddba41d 3afebb00
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -102,7 +102,12 @@ typedef enum {
  INTEROP_DISABLE_NAME_REQUEST,

  // Respond AVRCP profile version only 1.4 for some device.
  INTEROP_AVRCP_1_4_ONLY
  INTEROP_AVRCP_1_4_ONLY,

  // Disable sniff mode for headsets/car-kits
  // Some car kits supports sniff mode but when DUT initiates sniff req
  // Remote will go to bad state and its leads to LMP time out.
  INTEROP_DISABLE_SNIFF
} interop_feature_t;

// Check if a given |addr| matches a known interoperability workaround as
+1 −0
Original line number Diff line number Diff line
@@ -132,6 +132,7 @@ static const char* interop_feature_string_(const interop_feature_t feature) {
    CASE_RETURN_STR(INTEROP_HID_HOST_LIMIT_SNIFF_INTERVAL)
    CASE_RETURN_STR(INTEROP_DISABLE_NAME_REQUEST)
    CASE_RETURN_STR(INTEROP_AVRCP_1_4_ONLY)
    CASE_RETURN_STR(INTEROP_DISABLE_SNIFF)
  }

  return "UNKNOWN";
+4 −0
Original line number Diff line number Diff line
@@ -624,6 +624,10 @@ static void check_link_policy(uint16_t* settings) {
static void btm_set_link_policy(tACL_CONN* conn, uint16_t policy) {
  conn->link_policy = policy;
  check_link_policy(&conn->link_policy);
  if ((conn->link_policy & HCI_ENABLE_CENTRAL_PERIPHERAL_SWITCH) &&
      interop_match_addr(INTEROP_DISABLE_SNIFF, &(conn->remote_addr))) {
    conn->link_policy &= (~HCI_ENABLE_SNIFF_MODE);
  }
  btsnd_hcic_write_policy_set(conn->hci_handle, conn->link_policy);
}

+3 −1
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@
#include "btm_int.h"
#include "btm_int_types.h"
#include "device/include/controller.h"
#include "device/include/interop.h"
#include "hcidefs.h"
#include "hcimsgs.h"
#include "osi/include/log.h"
@@ -160,7 +161,8 @@ tBTM_STATUS BTM_SetPowerMode(uint8_t pm_id, const RawAddress& remote_bda,
    const controller_t* controller = controller_get_interface();
    if ((mode == BTM_PM_MD_HOLD && !controller->supports_hold_mode()) ||
        (mode == BTM_PM_MD_SNIFF && !controller->supports_sniff_mode()) ||
        (mode == BTM_PM_MD_PARK && !controller->supports_park_mode())) {
        (mode == BTM_PM_MD_PARK && !controller->supports_park_mode()) ||
        interop_match_addr(INTEROP_DISABLE_SNIFF, &remote_bda)) {
      LOG_ERROR("pm_id %u mode %u is not supported for %s", pm_id, mode,
                remote_bda.ToString().c_str());
      return BTM_MODE_UNSUPPORTED;