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

Commit 7db2e26f authored by Martin Brabham's avatar Martin Brabham
Browse files

Fail fast

When this function is called, it will set a bool true.
Later the ACL connection calls a function that checks
the bool and calls this function again now that the
remote features have been fetched.

Bug: 162984360
Tag: #refactor
Test: compiles and devices pair and work
Change-Id: I4ff8e81b93b93b144313a2d809b3cd6f501a4fad
parent f3fe2675
Loading
Loading
Loading
Loading
+10 −9
Original line number Diff line number Diff line
@@ -2733,6 +2733,16 @@ void btm_sec_rmt_host_support_feat_evt(uint8_t* p) {
void btm_io_capabilities_req(const RawAddress& p) {
  tBTM_SEC_DEV_REC* p_dev_rec = btm_find_or_alloc_dev(p);

  if ((btm_cb.security_mode == BTM_SEC_MODE_SC) &&
      (p_dev_rec->num_read_pages == 0)) {
    BTM_TRACE_EVENT("%s: Device security mode is SC only.",
                    "To continue need to know remote features.", __func__);

    // ACL calls back to btm_sec_set_peer_sec_caps after it gets data
    p_dev_rec->remote_features_needed = true;
    return;
  }

  tBTM_SP_IO_REQ evt_data;
  uint8_t err_code = 0;
  bool is_orig = true;
@@ -2753,15 +2763,6 @@ void btm_io_capabilities_req(const RawAddress& p) {
  BTM_TRACE_DEBUG("%s:Security mode: %d, Num Read Remote Feat pages: %d",
                  __func__, btm_cb.security_mode, p_dev_rec->num_read_pages);

  if ((btm_cb.security_mode == BTM_SEC_MODE_SC) &&
      (p_dev_rec->num_read_pages == 0)) {
    BTM_TRACE_EVENT("%s: Device security mode is SC only.",
                    "To continue need to know remote features.", __func__);

    p_dev_rec->remote_features_needed = true;
    return;
  }

  p_dev_rec->sm4 |= BTM_SM4_TRUE;

  BTM_TRACE_EVENT("%s: State: %s  Flags: 0x%04x  p_cur_service: 0x%08x",