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

Commit 64e4d490 authored by Jack He's avatar Jack He
Browse files

GD-Controller: Do not register NumberOfCompletedPacket without ACL layer

* Only register it when ACL layer is enabled
* Also hci layer event is only registered by HCI lyaer when HCI layer
  is enabled

Test: make, pair and connect Bluetooth devices
Bug: 170603745
Tag: #gd-refactor
Change-Id: Icc94d239c28ba58ceffebee1061b4f8042afecc5
parent 34d8584b
Loading
Loading
Loading
Loading
+4 −2
Original line number Original line Diff line number Diff line
@@ -35,8 +35,10 @@ struct Controller::impl {
  void Start(hci::HciLayer* hci) {
  void Start(hci::HciLayer* hci) {
    hci_ = hci;
    hci_ = hci;
    Handler* handler = module_.GetHandler();
    Handler* handler = module_.GetHandler();
    if (common::InitFlags::GdAclEnabled()) {
      hci_->RegisterEventHandler(
      hci_->RegisterEventHandler(
          EventCode::NUMBER_OF_COMPLETED_PACKETS, handler->BindOn(this, &Controller::impl::NumberOfCompletedPackets));
          EventCode::NUMBER_OF_COMPLETED_PACKETS, handler->BindOn(this, &Controller::impl::NumberOfCompletedPackets));
    }


    le_set_event_mask(kDefaultLeEventMask);
    le_set_event_mask(kDefaultLeEventMask);
    set_event_mask(kDefaultEventMask);
    set_event_mask(kDefaultEventMask);
+2 −2
Original line number Original line Diff line number Diff line
@@ -223,7 +223,7 @@ static bool event_already_registered_in_hci_layer(
    case bluetooth::hci::EventCode::PAGE_SCAN_REPETITION_MODE_CHANGE:
    case bluetooth::hci::EventCode::PAGE_SCAN_REPETITION_MODE_CHANGE:
    case bluetooth::hci::EventCode::MAX_SLOTS_CHANGE:
    case bluetooth::hci::EventCode::MAX_SLOTS_CHANGE:
    case bluetooth::hci::EventCode::VENDOR_SPECIFIC:
    case bluetooth::hci::EventCode::VENDOR_SPECIFIC:
      return true;
      return bluetooth::shim::is_gd_hci_enabled();
    case bluetooth::hci::EventCode::LE_META_EVENT:
    case bluetooth::hci::EventCode::LE_META_EVENT:
    case bluetooth::hci::EventCode::DISCONNECTION_COMPLETE:
    case bluetooth::hci::EventCode::DISCONNECTION_COMPLETE:
      return bluetooth::shim::is_gd_shim_enabled();
      return bluetooth::shim::is_gd_shim_enabled();
@@ -236,7 +236,7 @@ static bool event_already_registered_in_controller_layer(
    bluetooth::hci::EventCode event_code) {
    bluetooth::hci::EventCode event_code) {
  switch (event_code) {
  switch (event_code) {
    case bluetooth::hci::EventCode::NUMBER_OF_COMPLETED_PACKETS:
    case bluetooth::hci::EventCode::NUMBER_OF_COMPLETED_PACKETS:
      return bluetooth::shim::is_gd_controller_enabled();
      return bluetooth::shim::is_gd_acl_enabled();
    default:
    default:
      return false;
      return false;
  }
  }