ubuntu – Pulseaudio wants to use HDMI upon wakeup instead of previous selected output

  • OS: Ubuntu 22.04.4 LTS
  • Kernel: 6.4.11-060411-generic

I believe sound is managed by PulseAudio on these systems. Please correct me if I’m wrong.

I wish to use SPDIF as default sound output all the time (as this computer doesn’t have any other sound output).

I added these below line to ~/.config/pulse/daemon.conf:

log-level = debug

I have two problems:

After system reboot, onboard SPDIF is selected for output:

enter image description here

But there is NO sound until I manually select something else, then reselect this option.

Maybe caused by the same root cause: after this computer goes to sleep and then wakes up, a different output device is selected automatically.

So I have to reselect the SPDIF every single time when this computer wakes up from suspend:

enter image description here

I tried searching in every common place:

  • /etc/init.d
  • systemd services
  • rc.local
  • bash_rc
  • profile

But none of these contains any paths to this “change-on-wakeup”.

I however noticed somthing in logs:

jul 07 21:37:50 daniel-main pulseaudio[2787]: Monitor name in ELD info is 'DELL S2340L' (for device=3)
jul 07 21:37:50 daniel-main pulseaudio[2787]: Jack 'HDMI/DP,pcm=3 Jack' is now plugged in
jul 07 21:37:50 daniel-main pulseaudio[2787]: Setting port hdmi-output-0 to status yes
jul 07 21:37:50 daniel-main pulseaudio[2787]: Dropped redundant event due to change event.
jul 07 21:37:50 daniel-main pulseaudio[2787]: Trying to switch to port hdmi-output-0
jul 07 21:37:50 daniel-main pulseaudio[2787]: Finding best profile for port hdmi-output-0, preferred = hdmi-stereo
jul 07 21:37:50 daniel-main pulseaudio[2787]: Sink alsa_output.pci-0000_00_1b.0.iec958-stereo becomes idle, timeout in 5 seconds.
jul 07 21:37:50 daniel-main pulseaudio[2787]: Starting to move sink input 6 from 'alsa_output.pci-0000_00_1b.0.iec958-stereo'

It seems pulseaudio detects the monitor on HDMI, and thinks it was hotplugged on wakeup, and wants to default the output audio to HDMI. How can I prevent this?

Read more here: Source link