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

Commit fe233305 authored by Abhishek Pandit-Subedi's avatar Abhishek Pandit-Subedi
Browse files

floss: Add sysprop for LeGetVendorCapabilities

An existing controller incorrectly responds to LeGetVendorCapabilities
with the wrong OGF resulting in a stack crash. Add this sysprop to
allow temporarily disabling querying these capabilities until the
firmware is fixed.

Bug: 257423916
Tag: #floss
Test: Manual test on ChromeOS with sysprop set to false
Change-Id: I8c18ade9753f40693fd3e79ce1a72bdd7030a09c
parent 40e353a7
Loading
Loading
Loading
Loading
+16 −2
Original line number Diff line number Diff line
@@ -25,12 +25,18 @@
#include "hci/hci_layer.h"
#include "hci_controller_generated.h"
#include "os/metrics.h"
#include "os/system_properties.h"
#include "sysprops/sysprops_module.h"

namespace bluetooth {
namespace hci {

constexpr uint8_t kMinEncryptionKeySize = 7;  // #define MIN_ENCRYPTION_KEY_SIZE 7

constexpr bool kDefaultVendorCapabilitiesEnabled = true;
static const std::string kPropertyVendorCapabilitiesEnabled =
    "bluetooth.core.le.vendor_capabilities.enabled";

using os::Handler;

struct Controller::impl {
@@ -172,8 +178,15 @@ struct Controller::impl {
          handler->BindOnceOn(this, &Controller::impl::le_set_host_feature_handler));
    }

    hci_->EnqueueCommand(LeGetVendorCapabilitiesBuilder::Create(),
    // Skip vendor capabilities check if configured.
    if (os::GetSystemPropertyBool(
            kPropertyVendorCapabilitiesEnabled, kDefaultVendorCapabilitiesEnabled)) {
      hci_->EnqueueCommand(
          LeGetVendorCapabilitiesBuilder::Create(),
          handler->BindOnceOn(this, &Controller::impl::le_get_vendor_capabilities_handler));
    } else {
      vendor_capabilities_.is_supported_ = 0x00;
    }

    // We only need to synchronize the last read. Make BD_ADDR to be the last one.
    std::promise<void> promise;
@@ -1238,6 +1251,7 @@ const ModuleFactory Controller::Factory = ModuleFactory([]() { return new Contro

void Controller::ListDependencies(ModuleList* list) const {
  list->add<hci::HciLayer>();
  list->add<sysprops::SyspropsModule>();
}

void Controller::Start() {
+1 −0
Original line number Diff line number Diff line
@@ -97,6 +97,7 @@ void SyspropsModule::parse_config(std::string file_path) {
      "bluetooth.core.le.connection_scan_window_slow",
      "bluetooth.core.le.inquiry_scan_interval",
      "bluetooth.core.le.inquiry_scan_window",
      "bluetooth.core.le.vendor_capabilities.enabled",
      // SCO
      "bluetooth.sco.disable_enhanced_connection",
      // Profile