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

Commit 5083da02 authored by Rahul Arya's avatar Rahul Arya Committed by Thomas Girardier
Browse files

[Rootcanal] Miscellaneous bugfixes for SCO

Fix an inequality sign, and mask out the air coding bits from the voice
setting, since the spec says they don't have to match.

Bug: 245578454
Test: atest pts-bot:HFP
Ignore-AOSP-First: Cherry-picked from AOSP
Merged-In: I5627e28430f03f3978039485228a5abacf62ae58
Change-Id: I5627e28430f03f3978039485228a5abacf62ae58
parent dc631d83
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -843,7 +843,8 @@ void DualModeController::EnhancedSetupSynchronousConnection(
  if (status == ErrorCode::SUCCESS) {
    status = link_layer_controller_.SetupSynchronousConnection(
        command_view.GetConnectionHandle(), transmit_bandwidth,
        receive_bandwidth, command_view.GetMaxLatency(), 0 /* Voice_Setting */,
        receive_bandwidth, command_view.GetMaxLatency(),
        link_layer_controller_.GetVoiceSetting(),
        static_cast<uint8_t>(command_view.GetRetransmissionEffort()),
        command_view.GetPacketType(), datapath);
  }
@@ -988,7 +989,7 @@ void DualModeController::EnhancedAcceptSynchronousConnection(
  if (status == ErrorCode::SUCCESS) {
    status = link_layer_controller_.AcceptSynchronousConnection(
        command_view.GetBdAddr(), transmit_bandwidth, receive_bandwidth,
        command_view.GetMaxLatency(), 0 /* Voice_Setting */,
        command_view.GetMaxLatency(), link_layer_controller_.GetVoiceSetting(),
        static_cast<uint8_t>(command_view.GetRetransmissionEffort()),
        command_view.GetPacketType());
  }
+3 −7
Original line number Diff line number Diff line
@@ -185,14 +185,8 @@ std::optional<ScoLinkParameters> ScoConnectionParameters::GetLinkParameters() {

  uint8_t transmission_interval;
  uint16_t packet_length;
  unsigned latency = 1250;
  uint8_t air_coding = voice_setting & 0x3;

  if (max_latency != 0xffff && max_latency < latency) {
    LOG_WARN("SCO Max latency must be less than 1250 us");
    return {};
  }

  if (packet_type & (uint16_t)SynchronousPacketTypeBits::HV3_ALLOWED) {
    transmission_interval = 6;
    packet_length = 30;
@@ -233,7 +227,9 @@ bool ScoConnection::NegotiateLinkParameters(
    return false;
  }

  if (peer.voice_setting != parameters_.voice_setting) {
  // mask out the air coding format bits before comparison, as per 5.3 Vol
  // 4E 6.12
  if ((peer.voice_setting & ~0x3) != (parameters_.voice_setting & ~0x3)) {
    LOG_WARN("Voice setting requirements cannot be met");
    LOG_WARN("Remote voice setting: 0x%04x",
             static_cast<unsigned>(parameters_.voice_setting));