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

Commit efb960bd authored by Henri Chataing's avatar Henri Chataing Committed by Automerger Merge Worker
Browse files

Merge "RootCanal: Fix the implementation of the Reset command" am: d9a0f42b

parents 85112929 d9a0f42b
Loading
Loading
Loading
Loading
+54 −13
Original line number Diff line number Diff line
@@ -6054,33 +6054,74 @@ ErrorCode LinkLayerController::LeLongTermKeyRequestNegativeReply(
}

void LinkLayerController::Reset() {
  host_supported_features_ = 0;
  le_host_support_ = false;
  secure_simple_pairing_host_support_ = false;
  secure_connections_host_support_ = false;
  le_host_supported_features_ = 0;
  connected_isochronous_stream_host_support_ = false;
  connection_subrating_host_support_ = false;
  random_address_ = Address::kEmpty;
  page_scan_enable_ = false;
  inquiry_scan_enable_ = false;
  inquiry_scan_interval_ = 0x1000;
  inquiry_scan_window_ = 0x0012;
  page_timeout_ = 0x2000;
  connection_accept_timeout_ = 0x1FA0;
  page_scan_interval_ = 0x0800;
  page_scan_window_ = 0x0012;
  voice_setting_ = 0x0060;
  authentication_enable_ = AuthenticationEnable::NOT_REQUIRED;
  default_link_policy_settings_ = 0x0000;
  sco_flow_control_enable_ = false;
  local_name_.fill(0);
  extended_inquiry_response_.fill(0);
  class_of_device_ = ClassOfDevice({0, 0, 0});
  min_encryption_key_size_ = 16;
  event_mask_ = 0x00001fffffffffff;
  event_mask_page_2_ = 0x0;
  le_event_mask_ = 0x01f;
  le_suggested_max_tx_octets_ = 0x001b;
  le_suggested_max_tx_time_ = 0x0148;
  resolvable_private_address_timeout_ = std::chrono::seconds(0x0384);
  page_scan_repetition_mode_ = PageScanRepetitionMode::R0;
  connections_ = AclConnectionHandler();
  oob_id_ = 1;
  key_id_ = 1;
  le_filter_accept_list_.clear();
  le_resolving_list_.clear();
  le_resolving_list_enabled_ = false;
  if (inquiry_timer_task_id_ != kInvalidTaskId) {
    CancelScheduledTask(inquiry_timer_task_id_);
    inquiry_timer_task_id_ = kInvalidTaskId;
  }
  legacy_advertising_in_use_ = false;
  extended_advertising_in_use_ = false;
  legacy_advertiser_ = LegacyAdvertiser{};
  extended_advertisers_.clear();
  scanner_ = Scanner{};
  initiator_ = Initiator{};
  last_inquiry_ = steady_clock::now();
  page_scan_enable_ = false;
  inquiry_scan_enable_ = false;
  inquiry_mode_ = InquiryType::STANDARD;
  inquiry_lap_ = 0;
  inquiry_max_responses_ = 0;

  bluetooth::hci::Lap general_iac;
  general_iac.lap_ = 0x33;  // 0x9E8B33
  current_iac_lap_list_.clear();
  current_iac_lap_list_.emplace_back(general_iac);

  if (inquiry_timer_task_id_ != kInvalidTaskId) {
    CancelScheduledTask(inquiry_timer_task_id_);
    inquiry_timer_task_id_ = kInvalidTaskId;
  }

  if (page_timeout_task_id_ != kInvalidTaskId) {
    CancelScheduledTask(page_timeout_task_id_);
    page_timeout_task_id_ = kInvalidTaskId;
  }

#ifdef ROOTCANAL_LMP
  lm_.reset(link_manager_create(ops_));
#else
  security_manager_ = SecurityManager(10);
#endif
  legacy_advertising_in_use_ = false;
  extended_advertising_in_use_ = false;

  extended_advertisers_.clear();
  legacy_advertiser_ = LegacyAdvertiser{};
  scanner_ = Scanner{};
  initiator_ = Initiator{};
}

void LinkLayerController::StartInquiry(milliseconds timeout) {
+7 −6
Original line number Diff line number Diff line
@@ -773,14 +773,14 @@ class LinkLayerController {

  // Host Supported Features (Vol 2, Part C § 3.3 Feature Mask Definition).
  // Page 1 of the LMP feature mask.
  uint64_t host_supported_features_{};
  uint64_t host_supported_features_{0};
  bool le_host_support_{false};
  bool secure_simple_pairing_host_support_{false};
  bool secure_connections_host_support_{false};

  // Le Host Supported Features (Vol 4, Part E § 7.8.3).
  // Specifies the bits indicating Host support.
  uint64_t le_host_supported_features_{};
  uint64_t le_host_supported_features_{0};
  bool connected_isochronous_stream_host_support_{false};
  bool connection_subrating_host_support_{false};

@@ -816,10 +816,11 @@ class LinkLayerController {
  uint16_t voice_setting_{0x0060};

  // Authentication Enable (Vol 4, Part E § 6.16).
  AuthenticationEnable authentication_enable_;
  AuthenticationEnable authentication_enable_{
      AuthenticationEnable::NOT_REQUIRED};

  // Default Link Policy Settings (Vol 4, Part E § 6.18).
  uint8_t default_link_policy_settings_;
  uint8_t default_link_policy_settings_{0x0000};

  // Synchronous Flow Control Enable (Vol 4, Part E § 6.22).
  bool sco_flow_control_enable_{false};
@@ -881,8 +882,8 @@ class LinkLayerController {
                     Phy::Type phy_type)>
      send_to_remote_;

  uint32_t oob_id_ = 1;
  uint32_t key_id_ = 1;
  uint32_t oob_id_{1};
  uint32_t key_id_{1};

  struct FilterAcceptListEntry {
    FilterAcceptListAddressType address_type;