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

Commit e1e4894e authored by Josh Wu's avatar Josh Wu Committed by Thomas Girardier
Browse files

RootCanal: Secure Connections controller support

Extend LMP feature to page 2 and enable SC controller support by
default.

Tag: #feature
Bug: 235777894
Test: atest bluetooth_test_gd
Ignore-AOSP-First: Cherry-picked from AOSP
Merged-In: I1229e5452ad9e8107aee40040b91be46bbf79960
Change-Id: I1229e5452ad9e8107aee40040b91be46bbf79960
parent ece087fa
Loading
Loading
Loading
Loading
+14 −2
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@ using ::bluetooth::hci::EventCode;
using ::bluetooth::hci::LLFeaturesBits;
using ::bluetooth::hci::LMPFeaturesPage0Bits;
using ::bluetooth::hci::LMPFeaturesPage1Bits;
using ::bluetooth::hci::LMPFeaturesPage2Bits;

static constexpr uint64_t Page0LmpFeatures() {
  LMPFeaturesPage0Bits features[] = {
@@ -103,6 +104,17 @@ static constexpr uint64_t Page1LmpFeatures() {
  return value;
}

static constexpr uint64_t Page2LmpFeatures() {
  LMPFeaturesPage2Bits features[] = {
      LMPFeaturesPage2Bits::SECURE_CONNECTIONS_CONTROLLER_SUPPORT,
  };

  uint64_t value = 0;
  for (unsigned i = 0; i < sizeof(features) / sizeof(*features); i++)
    value |= static_cast<uint64_t>(features[i]);
  return value;
}

static constexpr uint64_t LlFeatures() {
  LLFeaturesBits features[] = {
      LLFeaturesBits::LE_ENCRYPTION,
@@ -452,8 +464,8 @@ class DeviceProperties {
  std::vector<uint8_t> supported_codecs_;
  std::vector<uint32_t> vendor_specific_codecs_;
  std::array<uint8_t, 64> supported_commands_;
  std::array<uint64_t, 2> extended_features_{
      {Page0LmpFeatures(), Page1LmpFeatures()}};
  std::array<uint64_t, 3> extended_features_{
      {Page0LmpFeatures(), Page1LmpFeatures(), Page2LmpFeatures()}};
  ClassOfDevice class_of_device_{{0, 0, 0}};
  std::vector<uint8_t> extended_inquiry_data_;
  std::array<uint8_t, 248> name_{};