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

Commit 93344f85 authored by Łukasz Rymanowski's avatar Łukasz Rymanowski
Browse files

leaudio: Fix setting target PHY

If prefered PHY has not common bits with available PHYs, target PHY
would end up with 0x00

Bug: 246519817
Test: atest BluetoothInstrumentationTests
Tag: #feature

Change-Id: I4b2f6179e0b1a6a99031632dede6054e39de3370
parent a80d0f65
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -642,7 +642,17 @@ uint8_t LeAudioDeviceGroup::GetPhyBitmask(uint8_t direction) {
        phy_bitfield &= leAudioDevice->GetPhyBitmask();

        // A value of 0x00 denotes no preference
        if (ase->preferred_phy) phy_bitfield &= ase->preferred_phy;
        if (ase->preferred_phy && (phy_bitfield & ase->preferred_phy)) {
          phy_bitfield &= ase->preferred_phy;
          LOG_DEBUG("Using ASE preferred phy 0x%02x",
                    static_cast<int>(phy_bitfield));
        } else {
          LOG_WARN(
              "ASE preferred 0x%02x has nothing common with phy_bitfield "
              "0x%02x ",
              static_cast<int>(ase->preferred_phy),
              static_cast<int>(phy_bitfield));
        }
      }
    } while ((ase = leAudioDevice->GetNextActiveAseWithSameDirection(ase)));
  } while ((leAudioDevice = GetNextActiveDevice(leAudioDevice)));