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

Commit b930821c authored by Hansong Zhang's avatar Hansong Zhang Committed by Automerger Merge Worker
Browse files

SMP: Assume L2cap tx completes immediately am: 13b310b3

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

Change-Id: I257fd78f2b5413d0858ccd3f1c073297e61f70bd
parents 7e6a3594 13b310b3
Loading
Loading
Loading
Loading
+1 −18
Original line number Diff line number Diff line
@@ -208,24 +208,7 @@ static void smp_data_received(uint16_t channel, const RawAddress& bd_addr,
 * Description      SMP channel tx complete callback
 *
 ******************************************************************************/
static void smp_tx_complete_callback(uint16_t cid, uint16_t num_pkt) {
  tSMP_CB* p_cb = &smp_cb;

  if (p_cb->total_tx_unacked >= num_pkt)
    p_cb->total_tx_unacked -= num_pkt;
  else
    SMP_TRACE_ERROR("Unexpected %s: num_pkt = %d", __func__, num_pkt);

  if (p_cb->total_tx_unacked == 0 && p_cb->wait_for_authorization_complete) {
    tSMP_INT_DATA smp_int_data;
    smp_int_data.status = SMP_SUCCESS;
    if (cid == L2CAP_SMP_CID) {
      smp_sm_event(p_cb, SMP_AUTH_CMPL_EVT, &smp_int_data);
    } else {
      smp_br_state_machine_event(p_cb, SMP_BR_AUTH_CMPL_EVT, &smp_int_data);
    }
  }
}
static void smp_tx_complete_callback(uint16_t cid, uint16_t num_pkt) {}

/*******************************************************************************
 *
+13 −3
Original line number Diff line number Diff line
@@ -340,19 +340,29 @@ bool smp_send_msg_to_L2CAP(const RawAddress& rem_bda, BT_HDR* p_toL2CAP) {
  }

  SMP_TRACE_EVENT("%s", __func__);
  smp_cb.total_tx_unacked += 1;

  smp_log_metrics(rem_bda, true /* outgoing */,
                  p_toL2CAP->data + p_toL2CAP->offset, p_toL2CAP->len);

  l2cap_ret = L2CA_SendFixedChnlData(fixed_cid, rem_bda, p_toL2CAP);
  if (l2cap_ret == L2CAP_DW_FAILED) {
    smp_cb.total_tx_unacked -= 1;
    SMP_TRACE_ERROR("SMP failed to pass msg to L2CAP");
    return false;
  } else
  } else {
    tSMP_CB* p_cb = &smp_cb;

    if (p_cb->wait_for_authorization_complete) {
      tSMP_INT_DATA smp_int_data;
      smp_int_data.status = SMP_SUCCESS;
      if (fixed_cid == L2CAP_SMP_CID) {
        smp_sm_event(p_cb, SMP_AUTH_CMPL_EVT, &smp_int_data);
      } else {
        smp_br_state_machine_event(p_cb, SMP_BR_AUTH_CMPL_EVT, &smp_int_data);
      }
    }
    return true;
  }
}

/*******************************************************************************
 *