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

Commit f2d5e850 authored by Zach Johnson's avatar Zach Johnson Committed by Gerrit Code Review
Browse files

Merge changes Ie9676a91,I4edc2de1

* changes:
  Integrate GD controller
  Add EnhancedFlush command to PDL and shim
parents 2fa910e1 f7b03148
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -828,7 +828,7 @@ static const controller_t* controller_get_interface_legacy() {
}

const controller_t* controller_get_interface() {
  if (bluetooth::shim::is_gd_shim_enabled()) {
  if (bluetooth::shim::is_gd_controller_enabled()) {
    return bluetooth::shim::controller_get_interface();
  } else {
    return controller_get_interface_legacy();
+9 −3
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@
#include <string>
#include <utility>

#include "common/init_flags.h"
#include "hci/hci_layer.h"

namespace bluetooth {
@@ -34,8 +35,10 @@ struct Controller::impl {
  void Start(hci::HciLayer* hci) {
    hci_ = hci;
    Handler* handler = module_.GetHandler();
    hci_->RegisterEventHandler(EventCode::NUMBER_OF_COMPLETED_PACKETS,
                               handler->BindOn(this, &Controller::impl::NumberOfCompletedPackets));
    if (bluetooth::common::InitFlags::GdCoreEnabled()) {
      hci_->RegisterEventHandler(
          EventCode::NUMBER_OF_COMPLETED_PACKETS, handler->BindOn(this, &Controller::impl::NumberOfCompletedPackets));
    }

    set_event_mask(kDefaultEventMask);
    write_simple_pairing_mode(Enable::ENABLED);
@@ -130,7 +133,9 @@ struct Controller::impl {
  }

  void Stop() {
    if (bluetooth::common::InitFlags::GdCoreEnabled()) {
      hci_->UnregisterEventHandler(EventCode::NUMBER_OF_COMPLETED_PACKETS);
    }
    hci_ = nullptr;
  }

@@ -734,6 +739,7 @@ struct Controller::impl {
      OP_CODE_MAPPING(READ_LOCAL_SUPPORTED_CODEC_CAPABILITIES)
      OP_CODE_MAPPING(READ_LOCAL_SUPPORTED_CONTROLLER_DELAY)
      OP_CODE_MAPPING(CONFIGURE_DATA_PATH)
      OP_CODE_MAPPING(ENHANCED_FLUSH)

      // vendor specific
      case OpCode::LE_GET_VENDOR_CAPABILITIES:
+15 −0
Original line number Diff line number Diff line
@@ -195,6 +195,7 @@ enum OpCode : 16 {
  READ_LOCAL_OOB_DATA = 0x0C57,
  READ_INQUIRY_RESPONSE_TRANSMIT_POWER_LEVEL = 0x0C58,
  WRITE_INQUIRY_TRANSMIT_POWER_LEVEL = 0x0C59,
  ENHANCED_FLUSH = 0x0C5F,
  SEND_KEYPRESS_NOTIFICATION = 0x0C60,

  READ_LE_HOST_SUPPORT = 0x0C6C,
@@ -481,6 +482,7 @@ enum OpCodeIndex : 16 {
  USER_PASSKEY_REQUEST_NEGATIVE_REPLY = 193,
  REMOTE_OOB_DATA_REQUEST_REPLY = 194,
  WRITE_SIMPLE_PAIRING_DEBUG_MODE = 195,
  ENHANCED_FLUSH = 196,
  REMOTE_OOB_DATA_REQUEST_NEGATIVE_REPLY = 197,
  SEND_KEYPRESS_NOTIFICATION = 202,
  IO_CAPABILITY_REQUEST_NEGATIVE_REPLY = 203,
@@ -4186,6 +4188,19 @@ packet LinkSupervisionTimeoutChanged : EventPacket (event_code = LINK_SUPERVISIO
  link_supervision_timeout : 16, // 0x001-0xFFFF (0.625ms-40.9s)
}

enum FlushablePacketType : 8 {
  AUTOMATICALLY_FLUSHABLE_ONLY = 0,
}

packet EnhancedFlush : CommandPacket (op_code = ENHANCED_FLUSH){
  connection_handle : 12,
  _reserved_ : 4,
  packet_type : FlushablePacketType,
}

packet EnhancedFlushStatus : CommandStatus (command_op_code = ENHANCED_FLUSH){
}

packet EnhancedFlushComplete : EventPacket (event_code = ENHANCED_FLUSH_COMPLETE){
  connection_handle : 12,
  _reserved_ : 4,
+1 −0
Original line number Diff line number Diff line
@@ -94,6 +94,7 @@ bool IsCommandStatusOpcode(bluetooth::hci::OpCode op_code) {
    case bluetooth::hci::OpCode::LE_SET_PHY:
    case bluetooth::hci::OpCode::LE_EXTENDED_CREATE_CONNECTION:
    case bluetooth::hci::OpCode::LE_PERIODIC_ADVERTISING_CREATE_SYNC:
    case bluetooth::hci::OpCode::ENHANCED_FLUSH:
      return true;
    default:
      return false;
+4 −0
Original line number Diff line number Diff line
@@ -58,6 +58,10 @@ bool bluetooth::shim::is_gd_hci_enabled() {
  return bluetooth::common::InitFlags::GdHciEnabled();
}

bool bluetooth::shim::is_gd_controller_enabled() {
  return bluetooth::common::InitFlags::GdControllerEnabled();
}

bool bluetooth::shim::is_gd_shim_enabled() {
  return bluetooth::common::InitFlags::GdCoreEnabled();
}
Loading