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

Commit 60880791 authored by Rahul Arya's avatar Rahul Arya
Browse files

Fix Rootcanal extended inquiry response generation

Test: nope
Bug: 248574468
Change-Id: I114de4e5ad94539858048276ea92ccfa7f9efb80
parent cdd8c145
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -5420,6 +5420,23 @@ packet ExtendedInquiryResult : Event (event_code = EXTENDED_INQUIRY_RESULT) {
  _padding_[240],
}

packet ExtendedInquiryResultRaw : Event (event_code = EXTENDED_INQUIRY_RESULT) {
  _fixed_ = 0x01 : 8,
  address : Address,
  page_scan_repetition_mode : PageScanRepetitionMode,
  _reserved_ : 8,
  class_of_device : ClassOfDevice,
  clock_offset : 15,
  _reserved_ : 1,
  rssi : 8,
  extended_inquiry_response : 8[],
  // Extended inquiry Result is always 255 bytes long
  // padded GapData with zeroes as necessary
  // Refer to BLUETOOTH CORE SPECIFICATION Version 5.2 | Vol 3, Part C Section 8 on page 1340
  _padding_[240],
}


packet EncryptionKeyRefreshComplete : Event (event_code = ENCRYPTION_KEY_REFRESH_COMPLETE) {
  status : ErrorCode,
  connection_handle : 12,
+7 −19
Original line number Diff line number Diff line
@@ -1051,25 +1051,13 @@ void LinkLayerController::IncomingInquiryResponsePacket(
              basic_inquiry_response);
      ASSERT(inquiry_response.IsValid());

      std::unique_ptr<bluetooth::packet::RawBuilder> raw_builder_ptr =
          std::make_unique<bluetooth::packet::RawBuilder>();
      raw_builder_ptr->AddOctets1(kNumCommandPackets);
      raw_builder_ptr->AddAddress(inquiry_response.GetSourceAddress());
      raw_builder_ptr->AddOctets1(inquiry_response.GetPageScanRepetitionMode());
      raw_builder_ptr->AddOctets1(0x00);  // _reserved_
      auto class_of_device = inquiry_response.GetClassOfDevice();
      for (unsigned int i = 0; i < class_of_device.kLength; i++) {
        raw_builder_ptr->AddOctets1(class_of_device.cod[i]);
      }
      raw_builder_ptr->AddOctets2(inquiry_response.GetClockOffset());
      raw_builder_ptr->AddOctets1(inquiry_response.GetRssi());
      raw_builder_ptr->AddOctets(inquiry_response.GetExtendedData());

      if (IsEventUnmasked(EventCode::EXTENDED_INQUIRY_RESULT)) {
        send_event_(bluetooth::hci::EventBuilder::Create(
            bluetooth::hci::EventCode::EXTENDED_INQUIRY_RESULT,
            std::move(raw_builder_ptr)));
      }
      send_event_(bluetooth::hci::ExtendedInquiryResultRawBuilder::Create(
          inquiry_response.GetSourceAddress(),
          static_cast<bluetooth::hci::PageScanRepetitionMode>(
              inquiry_response.GetPageScanRepetitionMode()),
          inquiry_response.GetClassOfDevice(),
          inquiry_response.GetClockOffset(), inquiry_response.GetRssi(),
          inquiry_response.GetExtendedData()));
    } break;
    default:
      LOG_WARN("Unhandled Incoming Inquiry Response of type %d",