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

Commit 72075dec authored by Henri Chataing's avatar Henri Chataing Committed by Gerrit Code Review
Browse files

Merge "RootCanal: Implement quirk to set a default LE random address"

parents 7f89fd22 491579dc
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -29,6 +29,18 @@ namespace rootcanal {
using bluetooth::hci::HciVersion;
using bluetooth::hci::LmpVersion;

// Local controller quirks.
struct ControllerQuirks {
  // The specification states that the Random Address is invalid until
  // explicitly set by the command LE Set Random Address. Certain HCI commands
  // check for this condition.
  //
  // This quirk configures a default value for the LE random address in order
  // to bypass this validation. The default random address will
  // be ba:db:ad:ba:db:ad.
  bool has_default_random_address{false};
};

// Local controller information.
//
// Provide the Informational Parameters returned by HCI commands
@@ -54,6 +66,9 @@ struct ControllerProperties {
  // specification.
  bool CheckSupportedCommands() const;

  // Enabled quirks.
  ControllerQuirks quirks{};

  // Local Version Information (Vol 4, Part E § 7.4.1).
  HciVersion hci_version{HciVersion::V_5_3};
  LmpVersion lmp_version{LmpVersion::V_5_3};
+6 −0
Original line number Diff line number Diff line
@@ -1803,6 +1803,12 @@ LinkLayerController::LinkLayerController(const Address& address,
    : address_(address),
      properties_(properties),
      lm_(nullptr, link_manager_destroy) {

  if (properties_.quirks.has_default_random_address) {
    LOG_WARN("Configuring a default random address for this controller");
    random_address_ = Address { 0xba, 0xdb, 0xad, 0xba, 0xdb, 0xad };
  }

  ops_ = {
      .user_pointer = this,
      .get_handle =