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

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

Merge changes Ie94f7b5a,I7f8cc5a1,I87148e3c

* changes:
  Add Api stack/acl/::btm_pm_is_le_link
  Re-log stack/acl/btm_acl::lmp_version_below
  Re-log stack/btm/btm_ble::BTM_SetBleDataLength
parents f6506775 e269172c
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -174,6 +174,7 @@ typedef struct {
  friend bool BTM_ReadPowerMode(const RawAddress& remote_bda,
                                tBTM_PM_MODE* p_mode);
  friend bool acl_is_role_switch_allowed();
  friend bool btm_pm_is_le_link(const RawAddress& remote_bda);
  friend const RawAddress acl_address_from_handle(uint16_t hci_handle);
  friend int btm_pm_find_acl_ind(const RawAddress& remote_bda);
  friend tACL_CONN* btm_bda_to_acl(const RawAddress& bda,
+20 −4
Original line number Diff line number Diff line
@@ -2375,12 +2375,17 @@ void btm_acl_chk_peer_pkt_type_support(tACL_CONN* p, uint16_t* p_pkt_type) {
}

bool lmp_version_below(const RawAddress& bda, uint8_t version) {
  tACL_CONN* acl = internal_.btm_bda_to_acl(bda, BT_TRANSPORT_LE);
  if (acl == NULL || acl->lmp_version == 0) {
    LOG_WARN("Unable to find active acl");
  const tACL_CONN* acl = internal_.btm_bda_to_acl(bda, BT_TRANSPORT_LE);
  if (acl == nullptr) {
    LOG_INFO("Unable to get LMP version as no le acl exists to device");
    return false;
  }
  if (acl->lmp_version == 0) {
    LOG_INFO("Unable to get LMP version as value has not been set");
    return false;
  }
  LOG_DEBUG("LMP version %d < %d", acl->lmp_version, version);
  LOG_DEBUG("Requested LMP version:%hhu acl_version:%hhu", version,
            acl->lmp_version);
  return acl->lmp_version < version;
}

@@ -2544,6 +2549,17 @@ int btm_pm_find_acl_ind(const RawAddress& remote_bda) {
  return xx;
}

bool btm_pm_is_le_link(const RawAddress& remote_bda) {
  const tACL_CONN* p_acl = &btm_cb.acl_cb_.acl_db[0];
  for (uint8_t xx = 0; xx < MAX_L2CAP_LINKS; xx++, p_acl++) {
    if (p_acl->in_use && p_acl->remote_addr == remote_bda &&
        p_acl->transport == BT_TRANSPORT_LE) {
      return true;
    }
  }
  return false;
}

/*******************************************************************************
 *
 * Function         btm_ble_refresh_local_resolvable_private_addr
+4 −15
Original line number Diff line number Diff line
@@ -667,15 +667,6 @@ bool BTM_UseLeLink(const RawAddress& bd_addr) {
  return (dev_type == BT_DEVICE_TYPE_BLE);
}

/*******************************************************************************
 *
 * Function         BTM_SetBleDataLength
 *
 * Description      This function is to set maximum BLE transmission packet size
 *
 * Returns          BTM_SUCCESS if success; otherwise failed.
 *
 ******************************************************************************/
tBTM_STATUS BTM_SetBleDataLength(const RawAddress& bd_addr,
                                 uint16_t tx_pdu_length) {
  if (bluetooth::shim::is_gd_shim_enabled()) {
@@ -684,22 +675,20 @@ tBTM_STATUS BTM_SetBleDataLength(const RawAddress& bd_addr,
  uint16_t tx_time = BTM_BLE_DATA_TX_TIME_MAX_LEGACY;

  if (!BTM_IsAclConnectionUp(bd_addr, BT_TRANSPORT_LE)) {
    BTM_TRACE_ERROR("%s: Wrong mode: no LE link exist or LE not supported",
                    __func__);
    LOG_INFO(
        "Unable to set data length because no le acl link connected to device");
    return BTM_WRONG_MODE;
  }

  BTM_TRACE_DEBUG("%s: tx_pdu_length =%d", __func__, tx_pdu_length);

  if (!controller_get_interface()->supports_ble_packet_extension()) {
    BTM_TRACE_ERROR("%s failed, request not supported", __func__);
    LOG_INFO("Local controller unable to support le packet extension");
    return BTM_ILLEGAL_VALUE;
  }

  uint16_t hci_handle = acl_get_hci_handle_for_hcif(bd_addr, BT_TRANSPORT_LE);

  if (!acl_peer_supports_ble_packet_extension(hci_handle)) {
    BTM_TRACE_ERROR("%s failed, peer does not support request", __func__);
    LOG_INFO("Remote device unable to support le packet extension");
    return BTM_ILLEGAL_VALUE;
  }

+1 −0
Original line number Diff line number Diff line
@@ -273,6 +273,7 @@ bool BTM_IsBleConnection(uint16_t hci_handle);
const RawAddress acl_address_from_handle(uint16_t hci_handle);
tBTM_PM_MCB* acl_power_mode_from_handle(uint16_t hci_handle);
int btm_pm_find_acl_ind(const RawAddress& remote_bda);
bool btm_pm_is_le_link(const RawAddress& remote_bda);

void btm_ble_refresh_local_resolvable_private_addr(
    const RawAddress& pseudo_addr, const RawAddress& local_rpa);