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

Commit c8f161b2 authored by Hansong Zhang's avatar Hansong Zhang
Browse files

GATT: Fix data length parameter

Should also account for L2CAP header size (4)

Bug: 199009840
Tag: #feature
Test: NRF connect
Change-Id: I6b51a8ef046d81836a4ca4850d052b68e0f4dd46
parent ad62b8c5
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -46,6 +46,8 @@
#define GATT_MTU_RSP_MIN_LEN 2
#define GATT_READ_BY_TYPE_RSP_MIN_LEN 1

#define L2CAP_PKT_OVERHEAD 4

using base::StringPrintf;
using bluetooth::Uuid;
using bluetooth::eatt::EattExtension;
@@ -1052,7 +1054,7 @@ void gatt_process_mtu_rsp(tGATT_TCB& tcb, tGATT_CLCB* p_clcb, uint16_t len,
      tcb.payload_size = mtu;
  }

  BTM_SetBleDataLength(tcb.peer_bda, tcb.payload_size);
  BTM_SetBleDataLength(tcb.peer_bda, tcb.payload_size + L2CAP_PKT_OVERHEAD);

  gatt_end_operation(p_clcb, status, NULL);
}
+2 −1
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@
#include "stack/eatt/eatt.h"
#include "stack/l2cap/l2c_int.h"
#define GATT_MTU_REQ_MIN_LEN 2
#define L2CAP_PKT_OVERHEAD 4

using base::StringPrintf;
using bluetooth::Uuid;
@@ -814,7 +815,7 @@ static void gatts_process_mtu_req(tGATT_TCB& tcb, uint16_t cid, uint16_t len,

  LOG(INFO) << "MTU request PDU with MTU size " << +tcb.payload_size;

  BTM_SetBleDataLength(tcb.peer_bda, tcb.payload_size);
  BTM_SetBleDataLength(tcb.peer_bda, tcb.payload_size + L2CAP_PKT_OVERHEAD);

  tGATT_SR_MSG gatt_sr_msg;
  gatt_sr_msg.mtu = tcb.payload_size;