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

Commit ff074ec1 authored by Michael Sun's avatar Michael Sun Committed by Automerger Merge Worker
Browse files

Merge "interop: allow hid host to connect to not-first HOG service" into main am: af3f35a9

parents 3698446c af3f35a9
Loading
Loading
Loading
Loading
+17 −1
Original line number Diff line number Diff line
@@ -66,6 +66,8 @@ constexpr bool kBTA_HH_LE_RECONN = false;

#define BTA_LE_HID_RTP_UUID_MAX 5

#define HID_PREFERRED_SERVICE_INDEX_3 3

namespace {

constexpr char kBtmLogTag[] = "LE HIDH";
@@ -1512,13 +1514,27 @@ static void bta_hh_le_srvc_search_cmpl(tBTA_GATTC_SEARCH_CMPL* p_data) {
  const gatt::Service* gap_service = nullptr;
  const gatt::Service* scp_service = nullptr;

  int num_hid_service = 0;
  bool have_hid = false;
  for (const gatt::Service& service : *services) {
    if (service.uuid == Uuid::From16Bit(UUID_SERVCLASS_LE_HID) &&
        service.is_primary && !have_hid) {
      have_hid = true;
      // TODO(b/286413526): The current implementation connects to the first HID
      // service, in the case of multiple HID services being present. As a
      // temporary mitigation, connect to the third HID service for some
      // particular devices. The long-term fix should refactor HID stack to
      // connect to multiple HID services simultaneously.
      if (interop_match_vendor_product_ids(
              INTEROP_MULTIPLE_HOGP_SERVICE_CHOOSE_THIRD,
              p_dev_cb->dscp_info.vendor_id, p_dev_cb->dscp_info.product_id)) {
        num_hid_service++;
        if (num_hid_service < HID_PREFERRED_SERVICE_INDEX_3) {
          continue;
        }
      }

      /* found HID primamry service */
      have_hid = true;
      p_dev_cb->hid_srvc.state = BTA_HH_SERVICE_DISCOVERED;
      p_dev_cb->hid_srvc.srvc_inst_id = service.handle;
      p_dev_cb->hid_srvc.proto_mode_handle = 0;
+6 −0
Original line number Diff line number Diff line
@@ -857,3 +857,9 @@ fc:3f:a6 = Address_Based
[INTEROP_SUSPEND_ATT_TRAFFIC_DURING_PAIRING]
ORN = Name_Based
EPG = Name_Based

# Some HID devices have more than one HID services, this rule ask the stack to connect to the
# specify one.
# 0X046D-0XBB01 - Logitech CASA Pop-Up Touch
[INTEROP_MULTIPLE_HOGP_SERVICE_CHOOSE_THIRD]
0X046D-0XBB01 = Vndr_Prdt_Based
+3 −0
Original line number Diff line number Diff line
@@ -347,6 +347,9 @@ typedef enum {
  // collision.
  INTEROP_DELAY_AUTH,

  // Some LE HID devices contain more than one HOGP service.
  INTEROP_MULTIPLE_HOGP_SERVICE_CHOOSE_THIRD,

  END_OF_INTEROP_LIST
} interop_feature_t;

+1 −0
Original line number Diff line number Diff line
@@ -395,6 +395,7 @@ static const char* interop_feature_string_(const interop_feature_t feature) {
    CASE_RETURN_STR(INTEROP_SUSPEND_ATT_TRAFFIC_DURING_PAIRING);
    CASE_RETURN_STR(INTEROP_INSERT_CALL_WHEN_SCO_START);
    CASE_RETURN_STR(INTEROP_DELAY_AUTH);
    CASE_RETURN_STR(INTEROP_MULTIPLE_HOGP_SERVICE_CHOOSE_THIRD);
  }
  return UNKNOWN_INTEROP_FEATURE;
}