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

Commit 28425227 authored by Hemant Gupta's avatar Hemant Gupta Committed by Myles Watson
Browse files

HIDD: Add support for HID Device Role

This patch adds support for HID Device role in bluedroid stack allowing
DUT to be used as Keyboard or Mouse.

Bug: 33011576
Change-Id: I45b581a54f6c7bbc1f25226715a7ea23e34255c0
parent b26c1b26
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -11,6 +11,7 @@ btaCommonIncludes := \
                   $(LOCAL_PATH)/sys \
                   $(LOCAL_PATH)/dm \
                   $(LOCAL_PATH)/hh \
                   $(LOCAL_PATH)/hd \
                   $(LOCAL_PATH)/closure \
                   $(LOCAL_PATH)/../btcore/include \
                   $(LOCAL_PATH)/../hci/include \
@@ -76,6 +77,9 @@ LOCAL_SRC_FILES:= \
    ./hh/bta_hh_le.cc \
    ./hh/bta_hh_main.cc \
    ./hh/bta_hh_utils.cc \
    ./hd/bta_hd_act.cc \
    ./hd/bta_hd_api.cc \
    ./hd/bta_hd_main.cc \
    ./hl/bta_hl_act.cc \
    ./hl/bta_hl_api.cc \
    ./hl/bta_hl_ci.cc \
+5 −0
Original line number Diff line number Diff line
@@ -64,6 +64,10 @@ static_library("bta") {
    "hh/bta_hh_le.cc",
    "hh/bta_hh_main.cc",
    "hh/bta_hh_utils.cc",
    "hd/bta_hd_utils.cc",
    "hd/bta_hd_act.cc",
    "hd/bta_hd_api.cc",
    "hd/bta_hd_main.cc",
    "hl/bta_hl_act.cc",
    "hl/bta_hl_api.cc",
    "hl/bta_hl_ci.cc",
@@ -95,6 +99,7 @@ static_library("bta") {
    "closure",
    "dm",
    "hh",
    "hd",
    "include",
    "sys",
    "//",
+16 −0
Original line number Diff line number Diff line
@@ -3902,6 +3902,22 @@ void bta_dm_set_encryption(tBTA_DM_MSG* p_data) {
  }
}

bool bta_dm_check_if_only_hd_connected(BD_ADDR peer_addr) {
  APPL_TRACE_DEBUG("%s: count(%d)", __func__, bta_dm_conn_srvcs.count);

  for (uint8_t j = 0; j < bta_dm_conn_srvcs.count; j++) {
    // Check if profiles other than hid are connected
    if ((bta_dm_conn_srvcs.conn_srvc[j].id != BTA_ID_HD) &&
        !bdcmp(bta_dm_conn_srvcs.conn_srvc[j].peer_bdaddr, peer_addr)) {
      APPL_TRACE_DEBUG("%s: Another profile (id=%d) is connected", __func__,
                       bta_dm_conn_srvcs.conn_srvc[j].id);
      return FALSE;
    }
  }

  return TRUE;
}

/*******************************************************************************
 *
 * Function         bta_dm_observe_results_cb
+6 −6
Original line number Diff line number Diff line
@@ -557,12 +557,12 @@ tBTA_DM_PM_TYPE_QUALIFIER tBTM_PM_PWR_MD bta_dm_pm_md[] = {
tBTA_DM_SSR_SPEC bta_dm_ssr_spec[] = {
    /*max_lat, min_rmt_to, min_loc_to*/
    {0, 0, 0}, /* BTA_DM_PM_SSR0 - do not use SSR */
    {0, 0,
     2}, /* BTA_DM_PM_SSR1 - HH, can NOT share entry with any other profile,
            seting default max latency and min remote timeout as 0,
            and always read individual device preference from HH module */
    /* BTA_DM_PM_SSR1 - HH, can NOT share entry with any other profile, seting
       default max latency and min remote timeout as 0, and always read
       individual device preference from HH module */
    {0, 0, 2},
    {1200, 2, 2},    /* BTA_DM_PM_SSR2 - others (as long as sniff is allowed)*/
    {360, 160, 2} /* BTA_DM_PM_SSR3 - HD */
    {360, 160, 1600} /* BTA_DM_PM_SSR3 - HD */
};

tBTA_DM_SSR_SPEC* p_bta_dm_ssr_spec = (tBTA_DM_SSR_SPEC*)&bta_dm_ssr_spec;
+2 −2
Original line number Diff line number Diff line
@@ -257,8 +257,8 @@ void bta_gattc_deregister(tBTA_GATTC_RCB* p_clreg) {
    } else
      bta_gattc_deregister_cmpl(p_clreg);
  } else {
    APPL_TRACE_ERROR(
        "bta_gattc_deregister Deregister Failedm unknown client cif");
    APPL_TRACE_ERROR("%s: Deregister Failed unknown client cif", __func__);
    bta_hh_cleanup_disable(BTA_HH_OK);
  }
}
/*******************************************************************************
Loading