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

Commit 351150e3 authored by Chris Manton's avatar Chris Manton Committed by Automerger Merge Worker
Browse files

Move lmp_version_below() into acl api am: a233fcf2 am: e9f0f31c am: 7de11f2d

Original change: https://android-review.googlesource.com/c/platform/system/bt/+/1393942

Change-Id: Ifcc92070e6b35fe01d12981b86f86f318a122266
parents 4a33af90 7de11f2d
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -2441,3 +2441,14 @@ void btm_pm_sm_alloc(uint8_t ind) {
  BTM_TRACE_DEBUG("btm_pm_sm_alloc ind:%d st:%d", ind, p_db->state);
#endif  // BTM_PM_DEBUG
}

bool lmp_version_below(const RawAddress& bda, uint8_t version) {
  tACL_CONN* acl = btm_bda_to_acl(bda, BT_TRANSPORT_LE);
  if (acl == NULL || acl->lmp_version == 0) {
    BTM_TRACE_WARNING("%s cannot retrieve LMP version...", __func__);
    return false;
  }
  BTM_TRACE_WARNING("%s LMP version %d < %d", __func__, acl->lmp_version,
                    version);
  return acl->lmp_version < version;
}
+2 −0
Original line number Diff line number Diff line
@@ -245,3 +245,5 @@ void btm_acl_role_changed(uint8_t hci_status, const RawAddress* bd_addr,
void btm_set_packet_types_from_address(const RawAddress& bda,
                                       tBT_TRANSPORT transport,
                                       uint16_t pkt_types);

bool lmp_version_below(const RawAddress& bda, uint8_t version);
+2 −11
Original line number Diff line number Diff line
@@ -25,9 +25,11 @@
#include "device/include/interop.h"
#include "internal_include/bt_target.h"
#include "stack/btm/btm_int.h"
#include "stack/include/acl_api.h"
#include "stack/include/l2c_api.h"
#include "stack/smp/p_256_ecc_pp.h"
#include "stack/smp/smp_int.h"
#include "types/raw_address.h"
#include "utils/include/bt_utils.h"

#define SMP_KEY_DIST_TYPE_MAX 4
@@ -39,17 +41,6 @@ const tSMP_ACT smp_distribute_act[] = {
    smp_set_derive_link_key /* SMP_SEC_KEY_TYPE_LK - '1' bit index */
};

static bool lmp_version_below(const RawAddress& bda, uint8_t version) {
  tACL_CONN* acl = btm_bda_to_acl(bda, BT_TRANSPORT_LE);
  if (acl == NULL || acl->lmp_version == 0) {
    SMP_TRACE_WARNING("%s cannot retrieve LMP version...", __func__);
    return false;
  }
  SMP_TRACE_WARNING("%s LMP version %d < %d", __func__, acl->lmp_version,
                    version);
  return acl->lmp_version < version;
}

static bool pts_test_send_authentication_complete_failure(tSMP_CB* p_cb) {
  uint8_t reason = p_cb->cert_failure;
  if (reason == SMP_PAIR_AUTH_FAIL || reason == SMP_PAIR_FAIL_UNKNOWN ||