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

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

Re-log stack/gatt/gatt_api::GATTC_ConfigureMTU am: 24cc44f7 am: 5c68152d

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

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I5524cacd81896527202a5c042300aad8363c6936
parents ce2889b7 5c68152d
Loading
Loading
Loading
Loading
+12 −4
Original line number Diff line number Diff line
@@ -604,10 +604,13 @@ tGATT_STATUS GATTC_ConfigureMTU(uint16_t conn_id, uint16_t mtu) {
  tGATT_TCB* p_tcb = gatt_get_tcb_by_idx(tcb_idx);
  tGATT_REG* p_reg = gatt_get_regcb(gatt_if);

  VLOG(1) << __func__ << ": conn_id=" << loghex(conn_id) << ", mtu=" << +mtu;

  if ((p_tcb == NULL) || (p_reg == NULL) || (mtu < GATT_DEF_BLE_MTU_SIZE) ||
      (mtu > GATT_MAX_MTU_SIZE)) {
    LOG_WARN(
        "Unable to configure ATT mtu size illegal parameter conn_id:%hu "
        "mtu:%hu tcb:%s reg:%s",
        conn_id, mtu, (p_tcb == nullptr) ? "BAD" : "ok",
        (p_reg == nullptr) ? "BAD" : "ok");
    return GATT_ILLEGAL_PARAMETER;
  }

@@ -617,12 +620,15 @@ tGATT_STATUS GATTC_ConfigureMTU(uint16_t conn_id, uint16_t mtu) {
  }

  if (gatt_is_clcb_allocated(conn_id)) {
    LOG(ERROR) << "GATT_BUSY conn_id = " << +conn_id;
    LOG_WARN("Connection is already used conn_id:%hu", conn_id);
    return GATT_BUSY;
  }

  tGATT_CLCB* p_clcb = gatt_clcb_alloc(conn_id);
  if (!p_clcb) return GATT_NO_RESOURCES;
  if (!p_clcb) {
    LOG_WARN("Unable to allocate connection link control block");
    return GATT_NO_RESOURCES;
  }

  /* For this request only ATT CID is valid */
  p_clcb->cid = L2CAP_ATT_CID;
@@ -630,6 +636,8 @@ tGATT_STATUS GATTC_ConfigureMTU(uint16_t conn_id, uint16_t mtu) {
  p_clcb->operation = GATTC_OPTYPE_CONFIG;
  tGATT_CL_MSG gatt_cl_msg;
  gatt_cl_msg.mtu = mtu;
  LOG_DEBUG("Configuring ATT mtu size conn_id:%hu mtu:%hu", conn_id, mtu);

  return attp_send_cl_msg(*p_clcb->p_tcb, p_clcb, GATT_REQ_MTU, &gatt_cl_msg);
}