On Mon, 25 Jul 2022 08:03:46 -0500
Chris Adams <linux(a)cmadams.net> wrote:
I have a notebook (AMD chips) connected to a hub (via USB-C), with
two
monitors hooked up to the hub (via HDMI). The monitors have built-in
speakers, and I use one monitor's speakers for default audio. I'm
running Fedora 35 MATE desktop (with Pipewire). The problem is that
which monitor's speakers are which flips around.
I think this is a consequence of parallel boot. The order in which
devices are discovered is non-deterministic.
Right now, the main monitor is "Renoir Radeon High Definition
Audio
Controller HDMI / DisplayPort 1 Output" and the second monitor is
"<same> 4 Output". After a suspend/resume cycle though, they randomly
swap, so I have to go into Sound Preferences and change the default
output device.
I would guess that these monitors have the same sound hardware? Use
aplay -l
to check if there are two identical devices available. It sounds (heh)
like pipewire is just using the device that ends up in whatever slot it
considers default.
The video side always keeps the correct monitor mapped as the
correct
part of the display layout, so it seems either there's a unique ID or
something that keeps them in the right order. Is there something
similar to keep it right for audio?
Not sure how video works, probably it is discriminating based on the
connection. But audio is determined by alsa as it discovers sound
devices. It has been a long time since I investigated this, but I
think it is still possible to assign specific slots to devices using a
script in /etc/modprobe.d. Something like the one at this link:
https://gist.github.com/andering/801eb7fe79520036dff4a90340fac7f6
Unfortunately, my experience has been that the audio hardware on
graphics devices tend to ignore this because the video starts before
the other audio devices, and so always gets slot 0, the default sound
device position. But, you can try assigning names to the devices as
the above file demonstrates, and then assigning them positions, and
then setting that position as default. Since your competing audio
devices are both graphics device based, it might work. And it almost
surely will work if the audio hardware on the graphics device is
different for each video device.
Check the layout when it is good, and when it flips, and assign your
names to the devices based on that. Then, you can only try and see if
it works.
You might have to go down the rabbit hole to investigate further if
this is irritating enough to you. e.g. ask on the alsa mailing list,
web searches for people who have this exact problem and solved it, etc.