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

Commit 3f6f4402 authored by Myles Watson's avatar Myles Watson Committed by Gerrit Code Review
Browse files

Merge changes I97c51cad,I7872aaf5,Ida970f6d into main

* changes:
  Use GD for controller packet support
  Use GD for inquiry support
  Use GD for controller pairing support
parents 2fd04b64 fb8adcc1
Loading
Loading
Loading
Loading
+0 −22
Original line number Diff line number Diff line
@@ -36,30 +36,8 @@ typedef struct controller_t {

  const uint8_t* (*get_ble_supported_states)(void);

  bool (*SupportsSimplePairing)(void);
  bool (*SupportsSecureConnections)(void);
  bool (*SupportsSimultaneousLeBrEdr)(void);
  bool (*supports_reading_remote_extended_features)(void);
  bool (*SupportsInterlacedInquiryScan)(void);
  bool (*SupportsRssiWithInquiryResults)(void);
  bool (*SupportsExtendedInquiryResponse)(void);
  bool (*supports_enhanced_setup_synchronous_connection)(void);
  bool (*supports_enhanced_accept_synchronous_connection)(void);
  bool (*Supports3SlotPackets)(void);
  bool (*Supports5SlotPackets)(void);
  bool (*SupportsClassic2mPhy)(void);
  bool (*SupportsClassic3mPhy)(void);
  bool (*Supports3SlotEdrPackets)(void);
  bool (*Supports5SlotEdrPackets)(void);
  bool (*SupportsSco)(void);
  bool (*SupportsHv2Packets)(void);
  bool (*SupportsHv3Packets)(void);
  bool (*SupportsEv3Packets)(void);
  bool (*SupportsEv4Packets)(void);
  bool (*SupportsEv5Packets)(void);
  bool (*SupportsEsco2mPhy)(void);
  bool (*SupportsEsco3mPhy)(void);
  bool (*Supports3SlotEscoEdrPackets)(void);
  bool (*SupportsRoleSwitch)(void);
  bool (*SupportsHoldMode)(void);
  bool (*SupportsSniffMode)(void);
+1 −1
Original line number Diff line number Diff line
@@ -170,7 +170,7 @@ void Btm::SetInterlacedInquiryScan() { GetInquiry()->SetInterlacedScan(); }
void Btm::SetStandardInquiryScan() { GetInquiry()->SetStandardScan(); }

bool Btm::IsInterlacedScanSupported() const {
  return controller_get_interface()->SupportsInterlacedInquiryScan();
  return bluetooth::shim::GetController()->SupportsInterlacedInquiryScan();
}

/**
+0 −48
Original line number Diff line number Diff line
@@ -117,27 +117,6 @@ static const uint8_t* get_ble_supported_states(void) {
#define MAP_TO_GD(legacy, gd) \
  static bool legacy(void) { return GetController()->gd(); }

MAP_TO_GD(supports_simple_pairing, SupportsSimplePairing)
MAP_TO_GD(supports_secure_connections, SupportsSecureConnections)
MAP_TO_GD(supports_simultaneous_le_bredr, SupportsSimultaneousLeBrEdr)
MAP_TO_GD(supports_interlaced_inquiry_scan, SupportsInterlacedInquiryScan)
MAP_TO_GD(supports_rssi_with_inquiry_results, SupportsRssiWithInquiryResults)
MAP_TO_GD(supports_extended_inquiry_response, SupportsExtendedInquiryResponse)
MAP_TO_GD(supports_three_slot_packets, Supports3SlotPackets)
MAP_TO_GD(supports_five_slot_packets, Supports5SlotPackets)
MAP_TO_GD(supports_classic_2m_phy, SupportsClassic2mPhy)
MAP_TO_GD(supports_classic_3m_phy, SupportsClassic3mPhy)
MAP_TO_GD(supports_three_slot_edr_packets, Supports3SlotEdrPackets)
MAP_TO_GD(supports_five_slot_edr_packets, Supports5SlotEdrPackets)
MAP_TO_GD(supports_sco, SupportsSco)
MAP_TO_GD(supports_hv2_packets, SupportsHv2Packets)
MAP_TO_GD(supports_hv3_packets, SupportsHv3Packets)
MAP_TO_GD(supports_ev3_packets, SupportsEv3Packets)
MAP_TO_GD(supports_ev4_packets, SupportsEv4Packets)
MAP_TO_GD(supports_ev5_packets, SupportsEv5Packets)
MAP_TO_GD(supports_esco_2m_phy, SupportsEsco2mPhy)
MAP_TO_GD(supports_esco_3m_phy, SupportsEsco3mPhy)
MAP_TO_GD(supports_three_slot_esco_edr_packets, Supports3SlotEscoEdrPackets)
MAP_TO_GD(supports_role_switch, SupportsRoleSwitch)
MAP_TO_GD(supports_hold_mode, SupportsHoldMode)
MAP_TO_GD(supports_sniff_mode, SupportsSniffMode)
@@ -187,10 +166,6 @@ FORWARD(supports_read_encryption_key_size,
        GetController()->IsSupported(
            bluetooth::hci::OpCode::READ_ENCRYPTION_KEY_SIZE))

FORWARD(supports_reading_remote_extended_features,
        GetController()->IsSupported(
            bluetooth::hci::OpCode::READ_REMOTE_EXTENDED_FEATURES))

FORWARD(supports_enhanced_setup_synchronous_connection,
        GetController()->IsSupported(
            bluetooth::hci::OpCode::ENHANCED_SETUP_SYNCHRONOUS_CONNECTION))
@@ -327,33 +302,10 @@ static const controller_t interface = {

    .get_ble_supported_states = get_ble_supported_states,

    .SupportsSimplePairing = supports_simple_pairing,
    .SupportsSecureConnections = supports_secure_connections,
    .SupportsSimultaneousLeBrEdr = supports_simultaneous_le_bredr,
    .supports_reading_remote_extended_features =
        supports_reading_remote_extended_features,
    .SupportsInterlacedInquiryScan = supports_interlaced_inquiry_scan,
    .SupportsRssiWithInquiryResults = supports_rssi_with_inquiry_results,
    .SupportsExtendedInquiryResponse = supports_extended_inquiry_response,
    .supports_enhanced_setup_synchronous_connection =
        supports_enhanced_setup_synchronous_connection,
    .supports_enhanced_accept_synchronous_connection =
        supports_enhanced_accept_synchronous_connection,
    .Supports3SlotPackets = supports_three_slot_packets,
    .Supports5SlotPackets = supports_five_slot_packets,
    .SupportsClassic2mPhy = supports_classic_2m_phy,
    .SupportsClassic3mPhy = supports_classic_3m_phy,
    .Supports3SlotEdrPackets = supports_three_slot_edr_packets,
    .Supports5SlotEdrPackets = supports_five_slot_edr_packets,
    .SupportsSco = supports_sco,
    .SupportsHv2Packets = supports_hv2_packets,
    .SupportsHv3Packets = supports_hv3_packets,
    .SupportsEv3Packets = supports_ev3_packets,
    .SupportsEv4Packets = supports_ev4_packets,
    .SupportsEv5Packets = supports_ev5_packets,
    .SupportsEsco2mPhy = supports_esco_2m_phy,
    .SupportsEsco3mPhy = supports_esco_3m_phy,
    .Supports3SlotEscoEdrPackets = supports_three_slot_esco_edr_packets,
    .SupportsRoleSwitch = supports_role_switch,
    .SupportsHoldMode = supports_hold_mode,
    .SupportsSniffMode = supports_sniff_mode,
+12 −10
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@
 *
 *****************************************************************************/

#include "main/shim/entry.h"
#define LOG_TAG "btm_acl"

#include <base/logging.h>
@@ -44,6 +45,7 @@
#include "device/include/controller.h"
#include "device/include/device_iot_config.h"
#include "device/include/interop.h"
#include "hci/controller_interface.h"
#include "include/check.h"
#include "include/l2cap_hci_link_interface.h"
#include "internal_include/bt_target.h"
@@ -251,35 +253,35 @@ void BTM_acl_after_controller_started(const controller_t* controller) {
  uint16_t btm_acl_pkt_types_supported =
      (HCI_PKT_TYPES_MASK_DH1 + HCI_PKT_TYPES_MASK_DM1);

  if (controller->Supports3SlotPackets())
  if (bluetooth::shim::GetController()->Supports3SlotPackets())
    btm_acl_pkt_types_supported |=
        (HCI_PKT_TYPES_MASK_DH3 + HCI_PKT_TYPES_MASK_DM3);

  if (controller->Supports5SlotPackets())
  if (bluetooth::shim::GetController()->Supports5SlotPackets())
    btm_acl_pkt_types_supported |=
        (HCI_PKT_TYPES_MASK_DH5 + HCI_PKT_TYPES_MASK_DM5);

  /* Add in EDR related ACL types */
  if (!controller->SupportsClassic2mPhy()) {
  if (!bluetooth::shim::GetController()->SupportsClassic2mPhy()) {
    btm_acl_pkt_types_supported |=
        (HCI_PKT_TYPES_MASK_NO_2_DH1 + HCI_PKT_TYPES_MASK_NO_2_DH3 +
         HCI_PKT_TYPES_MASK_NO_2_DH5);
  }

  if (!controller->SupportsClassic3mPhy()) {
  if (!bluetooth::shim::GetController()->SupportsClassic3mPhy()) {
    btm_acl_pkt_types_supported |=
        (HCI_PKT_TYPES_MASK_NO_3_DH1 + HCI_PKT_TYPES_MASK_NO_3_DH3 +
         HCI_PKT_TYPES_MASK_NO_3_DH5);
  }

  /* Check to see if 3 and 5 slot packets are available */
  if (controller->SupportsClassic2mPhy() ||
      controller->SupportsClassic3mPhy()) {
    if (!controller->Supports3SlotEdrPackets())
  if (bluetooth::shim::GetController()->SupportsClassic2mPhy() ||
      bluetooth::shim::GetController()->SupportsClassic3mPhy()) {
    if (!bluetooth::shim::GetController()->Supports3SlotEdrPackets())
      btm_acl_pkt_types_supported |=
          (HCI_PKT_TYPES_MASK_NO_2_DH3 + HCI_PKT_TYPES_MASK_NO_3_DH3);

    if (!controller->Supports5SlotEdrPackets())
    if (!bluetooth::shim::GetController()->Supports5SlotEdrPackets())
      btm_acl_pkt_types_supported |=
          (HCI_PKT_TYPES_MASK_NO_2_DH5 + HCI_PKT_TYPES_MASK_NO_3_DH5);
  }
@@ -2740,8 +2742,8 @@ void acl_process_supported_features(uint16_t handle, uint64_t features) {
          .c_str());

  if ((HCI_LMP_EXTENDED_SUPPORTED(p_acl->peer_lmp_feature_pages[0])) &&
      (controller_get_interface()
           ->supports_reading_remote_extended_features())) {
      (bluetooth::shim::GetController()->IsSupported(
          bluetooth::hci::OpCode::READ_REMOTE_EXTENDED_FEATURES))) {
    LOG_DEBUG("Waiting for remote extended feature response to arrive");
  } else {
    LOG_DEBUG("No more remote features outstanding so notify upper layer");
+1 −1
Original line number Diff line number Diff line
@@ -1630,7 +1630,7 @@ void btm_ble_update_dmt_flag_bits(uint8_t* adv_flag_value,

  /* if local controller support, mark both controller and host support in flag
   */
  if (controller_get_interface()->SupportsSimultaneousLeBrEdr())
  if (bluetooth::shim::GetController()->SupportsSimultaneousLeBrEdr())
    *adv_flag_value |= (BTM_BLE_DMT_CONTROLLER_SPT | BTM_BLE_DMT_HOST_SPT);
  else
    *adv_flag_value &= ~(BTM_BLE_DMT_CONTROLLER_SPT | BTM_BLE_DMT_HOST_SPT);
Loading