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

Commit 694c1160 authored by Rahul Arya's avatar Rahul Arya Committed by Automerger Merge Worker
Browse files

Merge "Fix infinite L2CAP timeout when ATT is used without GATT clients" am: d8b02421

parents 40c78437 d8b02421
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -172,6 +172,7 @@ fn parse_hci_adapter(flags: &mut InitFlags, values: Vec<&str>) {
init_flags!(
    flags: {
        btaa_hci = true,
        finite_att_timeout = true,
        gatt_robust_caching_client = true,
        gatt_robust_caching_server,
        gd_core,
+1 −0
Original line number Diff line number Diff line
@@ -5,6 +5,7 @@ mod ffi {
        fn set_all_for_testing();

        fn btaa_hci_is_enabled() -> bool;
        fn finite_att_timeout_is_enabled() -> bool;
        fn gatt_robust_caching_client_is_enabled() -> bool;
        fn gatt_robust_caching_server_is_enabled() -> bool;
        fn gd_core_is_enabled() -> bool;
+7 −3
Original line number Diff line number Diff line
@@ -22,11 +22,14 @@
 *
 ******************************************************************************/

#include <base/logging.h>

#include "bt_target.h"
#include "bt_utils.h"
#include "btif/include/btif_storage.h"
#include "connection_manager.h"
#include "device/include/interop.h"
#include "gd/common/init_flags.h"
#include "internal_include/stack_config.h"
#include "l2c_api.h"
#include "osi/include/allocator.h"
@@ -40,8 +43,6 @@
#include "stack/include/l2cap_acl_interface.h"
#include "types/raw_address.h"

#include <base/logging.h>

using base::StringPrintf;
using bluetooth::eatt::EattExtension;

@@ -113,7 +114,10 @@ void gatt_init(void) {
  fixed_reg.pL2CA_FixedConn_Cb = gatt_le_connect_cback;
  fixed_reg.pL2CA_FixedData_Cb = gatt_le_data_ind;
  fixed_reg.pL2CA_FixedCong_Cb = gatt_le_cong_cback; /* congestion callback */
  fixed_reg.default_idle_tout = 0xffff; /* 0xffff default idle timeout */
  fixed_reg.default_idle_tout =
      bluetooth::common::init_flags::finite_att_timeout_is_enabled()
          ? 2 /* We allow 2s for GATT clients to connect once the link is up */
          : L2CAP_NO_IDLE_TIMEOUT;

  L2CA_RegisterFixedChannel(L2CAP_ATT_CID, &fixed_reg);

+2 −0
Original line number Diff line number Diff line
@@ -107,6 +107,8 @@ typedef uint8_t tL2CAP_CHNL_DATA_RATE;
#define L2C_IS_VALID_PSM(psm) (((psm)&0x0101) == 0x0001)
#define L2C_IS_VALID_LE_PSM(psm) (((psm) > 0x0000) && ((psm) < 0x0100))

#define L2CAP_NO_IDLE_TIMEOUT 0xFFFF

/*****************************************************************************
 *  Type Definitions
 ****************************************************************************/
+0 −1
Original line number Diff line number Diff line
@@ -49,7 +49,6 @@

constexpr uint16_t L2CAP_CREDIT_BASED_MIN_MTU = 64;
constexpr uint16_t L2CAP_CREDIT_BASED_MIN_MPS = 64;
#define L2CAP_NO_IDLE_TIMEOUT 0xFFFF

/*
 * Timeout values (in milliseconds).