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

Commit 0ef6375c authored by Jakub Pawlowski's avatar Jakub Pawlowski Committed by android-build-merger
Browse files

Fix Long Read during MTU change

am: 67a4fd55

Change-Id: I85fafb3048c1b490dfe6f3192489f38d6b07d3a1
parents f84f87fa 67a4fd55
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -708,6 +708,7 @@ tGATT_STATUS GATTC_Read(uint16_t conn_id, tGATT_READ_TYPE type,
  p_clcb->op_subtype = type;
  p_clcb->auth_req = p_read->by_handle.auth_req;
  p_clcb->counter = 0;
  p_clcb->read_req_current_mtu = p_tcb->payload_size;

  switch (type) {
    case GATT_READ_BY_TYPE:
+11 −4
Original line number Diff line number Diff line
@@ -913,11 +913,18 @@ void gatt_process_read_rsp(tGATT_TCB& tcb, tGATT_CLCB* p_clcb,

        memcpy(p_clcb->p_attr_buf + offset, p, len);

        /* send next request if needed  */
        /* full packet for read or read blob rsp */
        bool packet_is_full;
        if (tcb.payload_size == p_clcb->read_req_current_mtu) {
          packet_is_full = (len == (tcb.payload_size - 1));
        } else {
          packet_is_full = (len == (p_clcb->read_req_current_mtu - 1) ||
                            len == (tcb.payload_size - 1));
          p_clcb->read_req_current_mtu = tcb.payload_size;
        }

        if (len == (tcb.payload_size -
                    1) && /* full packet for read or read blob rsp */
            len + offset < GATT_MAX_ATTR_LEN) {
        /* send next request if needed  */
        if (packet_is_full && (len + offset < GATT_MAX_ATTR_LEN)) {
          VLOG(1) << StringPrintf(
              "full pkt issue read blob for remianing bytes old offset=%d "
              "len=%d new offset=%d",
+2 −0
Original line number Diff line number Diff line
@@ -323,6 +323,8 @@ struct tGATT_CLCB {
  bool in_use;
  alarm_t* gatt_rsp_timer_ent; /* peer response timer */
  uint8_t retry_count;
  uint16_t read_req_current_mtu; /* This is the MTU value that the read was
                                    initiated with */
};

typedef struct {