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

Commit d809d07a authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "RootCanal: Add ignore reasons for list busy"

parents a302040d 321e548f
Loading
Loading
Loading
Loading
+24 −8
Original line number Diff line number Diff line
@@ -3301,21 +3301,37 @@ ErrorCode LinkLayerController::SetLeExtendedAdvertisingEnable(
  return ErrorCode::SUCCESS;
}

bool LinkLayerController::ConnectListBusy() {
  if (le_connect_) LOG_INFO("le_connect_");
  if (le_scan_enable_ != bluetooth::hci::OpCode::NONE)
bool LinkLayerController::ListBusy(uint16_t ignore) {
  if (le_connect_) {
    LOG_INFO("le_connect_");
    if (!(ignore & DeviceProperties::kLeListIgnoreConnections)) {
      return true;
    }
  }
  if (le_scan_enable_ != bluetooth::hci::OpCode::NONE) {
    LOG_INFO("le_scan_enable");
  for (auto advertiser : advertisers_)
    if (!(ignore & DeviceProperties::kLeListIgnoreScanEnable)) {
      return true;
    }
  }
  for (auto advertiser : advertisers_) {
    if (advertiser.IsEnabled()) {
      LOG_INFO("Advertising");
      if (!(ignore & DeviceProperties::kLeListIgnoreAdvertising)) {
        return true;
      }
  return le_connect_ || le_scan_enable_ != bluetooth::hci::OpCode::NONE;
    }
  }
  // TODO: Add HCI_LE_Periodic_Advertising_Create_Sync
  return false;
}

bool LinkLayerController::ConnectListBusy() {
  return ListBusy(properties_.GetLeConnectListIgnoreReasons());
}

bool LinkLayerController::ResolvingListBusy() {
  return ConnectListBusy();  // TODO: Add
                             // HCI_LE_Periodic_Advertising_Create_Sync
  return ListBusy(properties_.GetLeResolvingListIgnoreReasons());
}

ErrorCode LinkLayerController::LeConnectListRemoveDevice(Address addr,
+2 −0
Original line number Diff line number Diff line
@@ -174,6 +174,8 @@ class LinkLayerController {
                              uint16_t connection_latency,
                              uint16_t supervision_timeout);

  bool ListBusy(uint16_t ignore_mask);

  bool ConnectListBusy();
  ErrorCode LeConnectListClear();
  ErrorCode LeConnectListAddDevice(Address addr, uint8_t addr_type);
+4 −0
Original line number Diff line number Diff line
@@ -117,6 +117,10 @@ DeviceProperties::DeviceProperties(const std::string& file_name)
    }
  }
  ParseHex64(root["LeSupportedFeatures"], &le_supported_features_);
  ParseUint16t(root["LeConnectListIgnoreReasons"],
               &le_connect_list_ignore_reasons_);
  ParseUint16t(root["LeResolvingListIgnoreReasons"],
               &le_resolving_list_ignore_reasons_);
}

}  // namespace test_vendor_lib
+16 −0
Original line number Diff line number Diff line
@@ -368,6 +368,18 @@ class DeviceProperties {
  // Specification Version 4.2, Volume 2, Part E, Section 7.8.41
  uint8_t GetLeResolvingListSize() const { return le_resolving_list_size_; }

  // Workaround for misbehaving stacks
  static constexpr uint8_t kLeListIgnoreScanEnable = 0x1;
  static constexpr uint8_t kLeListIgnoreConnections = 0x2;
  static constexpr uint8_t kLeListIgnoreAdvertising = 0x4;

  uint16_t GetLeResolvingListIgnoreReasons() const {
    return le_resolving_list_ignore_reasons_;
  }
  uint16_t GetLeConnectListIgnoreReasons() const {
    return le_connect_list_ignore_reasons_;
  }

  // Vendor-specific commands
  const std::vector<uint8_t>& GetLeVendorCap() const {
    return le_vendor_cap_;
@@ -426,6 +438,10 @@ class DeviceProperties {
  std::vector<uint8_t> le_advertisement_;
  std::vector<uint8_t> le_scan_response_;

  // LE Workarounds
  uint16_t le_connect_list_ignore_reasons_{0};
  uint16_t le_resolving_list_ignore_reasons_{0};

  // ISO
  uint16_t iso_data_packet_length_{1021};
  uint8_t num_iso_data_packets_{12};