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

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

Profile services have const MTU size now

For GAP, the value comes from
`btsock_l2cap_listen_or_connect`. For classic dynamic channel, we use
L2CAP_SDU_LENGTH_MAX for now.

For GATT, we use GATT_MAX_MTU_SIZE, which was used when we send
config request.

Bug: 159815595
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: I93b82c718866f09c4c209311c93b65f2dc74b193
parent 56021096
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -92,7 +92,7 @@ tBNEP_RESULT bnep_register_with_l2cap(void) {

  /* Now, register with L2CAP */
  if (!L2CA_Register2(BT_PSM_BNEP, bnep_cb.reg_info, false /* enable_snoop */,
                      nullptr, bnep_cb.l2cap_my_cfg.mtu,
                      nullptr, BNEP_MTU_SIZE,
                      BTA_SEC_AUTHENTICATE | BTA_SEC_ENCRYPT)) {
    BNEP_TRACE_ERROR("BNEP - Registration failed");
    return BNEP_SECURITY_FAIL;
+3 −2
Original line number Diff line number Diff line
@@ -239,8 +239,9 @@ uint16_t GAP_ConnOpen(const char* p_serv_name, uint8_t service_id,

  /* Register the PSM with L2CAP */
  if (transport == BT_TRANSPORT_BR_EDR) {
    p_ccb->psm = L2CA_Register2(psm, conn.reg_info, false /* enable_snoop */,
                                &p_ccb->ertm_info, L2CAP_MTU_SIZE, security);
    p_ccb->psm =
        L2CA_Register2(psm, conn.reg_info, false /* enable_snoop */,
                       &p_ccb->ertm_info, L2CAP_SDU_LENGTH_MAX, security);
    if (p_ccb->psm == 0) {
      LOG(ERROR) << StringPrintf("%s: Failure registering PSM 0x%04x", __func__,
                                 psm);
+0 −1
Original line number Diff line number Diff line
@@ -373,7 +373,6 @@ typedef struct {
  fixed_queue_t* srv_chg_clt_q; /* service change clients queue */
  tGATT_REG cl_rcb[GATT_MAX_APPS];
  tGATT_CLCB clcb[GATT_CL_MAX_LCB]; /* connection link control block*/
  uint16_t def_mtu_size;

#if (GATT_CONFORMANCE_TESTING == TRUE)
  bool enable_err_rsp;
+1 −2
Original line number Diff line number Diff line
@@ -102,7 +102,6 @@ void gatt_init(void) {
  connection_manager::reset(true);
  memset(&fixed_reg, 0, sizeof(tL2CAP_FIXED_CHNL_REG));

  gatt_cb.def_mtu_size = GATT_DEF_BLE_MTU_SIZE;
  gatt_cb.sign_op_queue = fixed_queue_new(SIZE_MAX);
  gatt_cb.srv_chg_clt_q = fixed_queue_new(SIZE_MAX);
  /* First, register fixed L2CAP channel for ATT over BLE */
@@ -115,7 +114,7 @@ void gatt_init(void) {

  /* Now, register with L2CAP for ATT PSM over BR/EDR */
  if (!L2CA_Register2(BT_PSM_ATT, dyn_info, false /* enable_snoop */, nullptr,
                      gatt_cb.def_mtu_size, BTM_SEC_NONE)) {
                      GATT_MAX_MTU_SIZE, BTM_SEC_NONE)) {
    LOG(ERROR) << "ATT Dynamic Registration failed";
  }

+2 −2
Original line number Diff line number Diff line
@@ -742,14 +742,14 @@ tHID_STATUS hidd_conn_reg(void) {
  hd_cb.l2cap_intr_cfg.mtu = HID_DEV_MTU_SIZE;

  if (!L2CA_Register2(HID_PSM_CONTROL, dev_reg_info, false /* enable_snoop */,
                      nullptr, hd_cb.l2cap_cfg.mtu,
                      nullptr, HID_DEV_MTU_SIZE,
                      BTA_SEC_AUTHENTICATE | BTA_SEC_ENCRYPT)) {
    HIDD_TRACE_ERROR("HID Control (device) registration failed");
    return (HID_ERR_L2CAP_FAILED);
  }

  if (!L2CA_Register2(HID_PSM_INTERRUPT, dev_reg_info, false /* enable_snoop */,
                      nullptr, hd_cb.l2cap_intr_cfg.mtu,
                      nullptr, HID_DEV_MTU_SIZE,
                      BTA_SEC_AUTHENTICATE | BTA_SEC_ENCRYPT)) {
    L2CA_Deregister(HID_PSM_CONTROL);
    HIDD_TRACE_ERROR("HID Interrupt (device) registration failed");
Loading