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

Commit 75470d1d authored by Henri Chataing's avatar Henri Chataing
Browse files

RootCanal: Supports LE Get Vendor Capabilities by default

Required by the bluetooth stack when vendor support is enabled.

Bug: 275847929
Test: atest CtsRootBluetoothTestCases
Change-Id: Ic2c8b4c694c31a44665cabb85b2dbac3a8b8dc3c
parent 1045f6a1
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -68,6 +68,9 @@ struct ControllerProperties {
  // Local Supported Commands (Vol 4, Part E § 7.4.2).
  std::array<uint8_t, 64> supported_commands;

  // Vendor Supported Commands.
  bool supports_le_get_vendor_capabilities_command{true};

  // Local Supported Features (Vol 4, Part E § 7.4.3) and
  // Local Extended Features (Vol 4, Part E § 7.4.3).
  std::array<uint64_t, 3> lmp_features;
+9 −3
Original line number Diff line number Diff line
@@ -2458,16 +2458,22 @@ void DualModeController::LeGetVendorCapabilities(CommandView command) {
  auto command_view = bluetooth::hci::LeGetVendorCapabilitiesView::Create(
      bluetooth::hci::VendorCommandView::Create(command));
  ASSERT(command_view.IsValid());
  vector<uint8_t> caps = properties_.le_vendor_capabilities;
  if (caps.empty()) {

  if (!properties_.supports_le_get_vendor_capabilities_command) {
    SendCommandCompleteUnknownOpCodeEvent(OpCode::LE_GET_VENDOR_CAPABILITIES);
    return;
  }

  // Ensure a minimal size for vendor capabilities.
  vector<uint8_t> vendor_capabilities = properties_.le_vendor_capabilities;
  if (vendor_capabilities.size() < 8) {
    vendor_capabilities.resize(8);
  }

  std::unique_ptr<bluetooth::packet::RawBuilder> raw_builder_ptr =
      std::make_unique<bluetooth::packet::RawBuilder>();
  raw_builder_ptr->AddOctets1(static_cast<uint8_t>(ErrorCode::SUCCESS));
  raw_builder_ptr->AddOctets(properties_.le_vendor_capabilities);
  raw_builder_ptr->AddOctets(vendor_capabilities);

  send_event_(bluetooth::hci::CommandCompleteBuilder::Create(
      kNumCommandPackets, OpCode::LE_GET_VENDOR_CAPABILITIES,