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

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

Merge changes I61791e5b,If25a7f34,I2949e99a,Ie70a5fec

* changes:
  Re-log stack/sdp::process_service_search_attr_rsp
  Re-log stack/gatt/gatt_attr::gatt_disc_cmpl_cback
  Re-log stack/smp/smp_act::smp_send_app_cback
  Check power mode only on classic links
parents 91215df8 417159a8
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -146,8 +146,11 @@ tBTM_STATUS BTM_SetPowerMode(uint8_t pm_id, const RawAddress& remote_bda,

  int acl_ind = btm_pm_find_acl_ind(remote_bda);
  if (acl_ind == MAX_L2CAP_LINKS) {
    LOG_ERROR("addr %s is unknown", remote_bda.ToString().c_str());
    return (BTM_UNKNOWN_ADDR);
    if (btm_pm_is_le_link(remote_bda)) {
      return BTM_MODE_UNSUPPORTED;
    }
    LOG_ERROR("br_edr acl addr %s is unknown", remote_bda.ToString().c_str());
    return BTM_UNKNOWN_ADDR;
  }

  // per ACL link
+12 −5
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@

#include "gatt_api.h"
#include "gatt_int.h"
#include "osi/include/log.h"
#include "osi/include/osi.h"

using base::StringPrintf;
@@ -459,12 +460,18 @@ static void gatt_disc_res_cback(uint16_t conn_id, tGATT_DISC_TYPE disc_type,
static void gatt_disc_cmpl_cback(uint16_t conn_id, tGATT_DISC_TYPE disc_type,
                                 tGATT_STATUS status) {
  tGATT_PROFILE_CLCB* p_clcb = gatt_profile_find_clcb_by_conn_id(conn_id);
  if (p_clcb == NULL) {
    LOG_WARN("Unable to find gatt profile after discovery complete");
    return;
  }

  if (p_clcb == NULL) return;

  if (status != GATT_SUCCESS || p_clcb->ccc_result == 0) {
    LOG(WARNING) << __func__
                 << ": Unable to register for service changed indication";
  if (status != GATT_SUCCESS) {
    LOG_WARN("Gatt discovery completed with errors status:%u", status);
    return;
  }
  if (p_clcb->ccc_result == 0) {
    LOG_WARN("Gatt discovery completed but connection was idle id:%hu",
             conn_id);
    return;
  }

+4 −4
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@
#include "hcimsgs.h"
#include "l2cdefs.h"
#include "log/log.h"
#include "osi/include/log.h"
#include "sdp_api.h"
#include "sdpint.h"

@@ -629,9 +630,8 @@ static void process_service_search_attr_rsp(tCONN_CB* p_ccb, uint8_t* p_reply,
/*******************************************************************/

#if (SDP_RAW_DATA_INCLUDED == TRUE)
  SDP_TRACE_WARNING("process_service_search_attr_rsp");
  if (!sdp_copy_raw_data(p_ccb, true)) {
    SDP_TRACE_ERROR("sdp_copy_raw_data failed");
    LOG_ERROR("sdp_copy_raw_data failed");
    sdp_disconnect(p_ccb, SDP_ILLEGAL_PARAMETER);
    return;
  }
@@ -643,12 +643,12 @@ static void process_service_search_attr_rsp(tCONN_CB* p_ccb, uint8_t* p_reply,
  type = *p++;

  if ((type >> 3) != DATA_ELE_SEQ_DESC_TYPE) {
    SDP_TRACE_WARNING("SDP - Wrong type: 0x%02x in attr_rsp", type);
    LOG_WARN("Wrong element in attr_rsp type:0x%02x", type);
    return;
  }
  p = sdpu_get_len_from_type(p, p + p_ccb->list_len, type, &seq_len);
  if (p == NULL || (p + seq_len) > (p + p_ccb->list_len)) {
    SDP_TRACE_WARNING("%s: bad length", __func__);
    LOG_WARN("Illegal search attribute length");
    sdp_disconnect(p_ccb, SDP_ILLEGAL_PARAMETER);
    return;
  }
+9 −15
Original line number Diff line number Diff line
@@ -96,7 +96,6 @@ static void smp_update_key_mask(tSMP_CB* p_cb, uint8_t key_type, bool recv) {
void smp_send_app_cback(tSMP_CB* p_cb, tSMP_INT_DATA* p_data) {
  tSMP_EVT_DATA cb_data;
  tSMP_STATUS callback_rc;
  SMP_TRACE_DEBUG("%s p_cb->cb_evt=%d", __func__, p_cb->cb_evt);
  if (p_cb->p_callback && p_cb->cb_evt != 0) {
    switch (p_cb->cb_evt) {
      case SMP_IO_CAP_REQ_EVT:
@@ -106,7 +105,7 @@ void smp_send_app_cback(tSMP_CB* p_cb, tSMP_INT_DATA* p_data) {
        cb_data.io_req.max_key_size = SMP_MAX_ENC_KEY_SIZE;
        cb_data.io_req.init_keys = p_cb->local_i_key;
        cb_data.io_req.resp_keys = p_cb->local_r_key;
        SMP_TRACE_WARNING("io_cap = %d", cb_data.io_req.io_cap);
        LOG_DEBUG("Notify app io_cap = %hhu", cb_data.io_req.io_cap);
        break;

      case SMP_NC_REQ_EVT:
@@ -135,9 +134,6 @@ void smp_send_app_cback(tSMP_CB* p_cb, tSMP_INT_DATA* p_data) {
    callback_rc =
        (*p_cb->p_callback)(p_cb->cb_evt, p_cb->pairing_bda, &cb_data);

    SMP_TRACE_DEBUG("%s: callback_rc=%d  p_cb->cb_evt=%d", __func__,
                    callback_rc, p_cb->cb_evt);

    if (callback_rc == SMP_SUCCESS) {
      switch (p_cb->cb_evt) {
        case SMP_IO_CAP_REQ_EVT:
@@ -149,14 +145,14 @@ void smp_send_app_cback(tSMP_CB* p_cb, tSMP_INT_DATA* p_data) {
          p_cb->local_r_key = cb_data.io_req.resp_keys;

          if (!(p_cb->loc_auth_req & SMP_AUTH_BOND)) {
            SMP_TRACE_WARNING("Non bonding: No keys will be exchanged");
            LOG_INFO("Non bonding: No keys will be exchanged");
            p_cb->local_i_key = 0;
            p_cb->local_r_key = 0;
          }

          SMP_TRACE_WARNING(
              "rcvd auth_req: 0x%02x, io_cap: %d "
              "loc_oob_flag: %d loc_enc_size: %d, "
          LOG_DEBUG(
              "Remote request IO capabilities precondition auth_req: 0x%02x,"
              " io_cap: %d loc_oob_flag: %d loc_enc_size: %d, "
              "local_i_key: 0x%02x, local_r_key: 0x%02x",
              p_cb->loc_auth_req, p_cb->local_io_capability, p_cb->loc_oob_flag,
              p_cb->loc_enc_size, p_cb->local_i_key, p_cb->local_r_key);
@@ -183,8 +179,9 @@ void smp_send_app_cback(tSMP_CB* p_cb, tSMP_INT_DATA* p_data) {
            p_cb->loc_auth_req &= ~SMP_H7_SUPPORT_BIT;
          }

          SMP_TRACE_WARNING(
              "set auth_req: 0x%02x, local_i_key: 0x%02x, local_r_key: 0x%02x",
          LOG_DEBUG(
              "Remote request IO capabilities postcondition auth_req: 0x%02x,"
              " local_i_key: 0x%02x, local_r_key: 0x%02x",
              p_cb->loc_auth_req, p_cb->local_i_key, p_cb->local_r_key);

          smp_sm_event(p_cb, SMP_IO_RSP_EVT, NULL);
@@ -199,7 +196,7 @@ void smp_send_app_cback(tSMP_CB* p_cb, tSMP_INT_DATA* p_data) {
          p_cb->local_i_key &= ~SMP_SEC_KEY_TYPE_LK;
          p_cb->local_r_key &= ~SMP_SEC_KEY_TYPE_LK;

          SMP_TRACE_WARNING(
          LOG_DEBUG(
              "for SMP over BR max_key_size: 0x%02x, local_i_key: 0x%02x, "
              "local_r_key: 0x%02x, p_cb->loc_auth_req: 0x%02x",
              p_cb->loc_enc_size, p_cb->local_i_key, p_cb->local_r_key,
@@ -215,8 +212,6 @@ void smp_send_app_cback(tSMP_CB* p_cb, tSMP_INT_DATA* p_data) {
    p_cb->discard_sec_req = false;
    smp_sm_event(p_cb, SMP_DISCARD_SEC_REQ_EVT, NULL);
  }

  SMP_TRACE_DEBUG("%s: return", __func__);
}

/*******************************************************************************
@@ -377,7 +372,6 @@ void smp_send_id_info(tSMP_CB* p_cb, tSMP_INT_DATA* p_data) {
      (p_cb->loc_auth_req & SMP_AUTH_BOND))
    btm_sec_save_le_key(p_cb->pairing_bda, BTM_LE_KEY_LID, &le_key, true);

  SMP_TRACE_WARNING("%s", __func__);
  smp_key_distribution_by_transport(p_cb, NULL);
}