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

Commit 2c2659e2 authored by Christine Hallstrom's avatar Christine Hallstrom
Browse files

Skip EATT connect for legacy devices

EATT was introduced in Bluetooth version 5.2. Some older devices
disconnect the link or otherwise misbehave when try to connect EATT.
Skip connecting EATT for peripherals with LMP version < 5.2.

Bug: 284511042
Test: m aosp_raven-userdebug
Manual; connect 5.2 device and check EATT connects. Connect legacy
device and check EATT doesn't connect.

Change-Id: I60a80431bab1615cee344c6a95dafaca9520d58c
parent 81450933
Loading
Loading
Loading
Loading
+14 −3
Original line number Diff line number Diff line
@@ -1589,10 +1589,21 @@ void btm_ble_link_encrypted(const RawAddress& bd_addr, uint8_t encr_enable) {
  }

  if (encr_enable) {
    /* Link is encrypted, start EATT */
    uint8_t remote_lmp_version = 0;
    if (!BTM_ReadRemoteVersion(p_dev_rec->ble.pseudo_addr, &remote_lmp_version,
                               nullptr, nullptr) ||
        remote_lmp_version == 0) {
      LOG_WARN("BLE Unable to determine remote version");
    }

    if (remote_lmp_version == 0 ||
        remote_lmp_version >= HCI_PROTO_VERSION_5_2) {
      /* Link is encrypted, start EATT if remote LMP version is unknown, or 5.2
       * or greater */
      bluetooth::eatt::EattExtension::GetInstance()->Connect(
          p_dev_rec->ble.pseudo_addr);
    }
  }

  /* to notify GATT to send data if any request is pending */
  gatt_notify_enc_cmpl(p_dev_rec->ble.pseudo_addr);
+1 −0
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@
#define HCI_PROTO_VERSION_4_1 0x07 /* Version for BT spec 4.1          */
#define HCI_PROTO_VERSION_4_2 0x08 /* Version for BT spec 4.2          */
#define HCI_PROTO_VERSION_5_0 0x09 /* Version for BT spec 5.0          */
#define HCI_PROTO_VERSION_5_2 0x0B /* Version for BT spec 5.2          */

/*
 *  Definitions for HCI groups