Hello,
I've been able to fix something that has been driving me crazy for days and wanted to share it with you.
I've a audio device that expose 2 different ports in Pulseaudio, Speaker and Headphone :
ports:
analog-output-speaker: Speakers (priority 10000, latency offset 0 usec, available: unknown)
properties:
device.icon_name = "audio-speakers"
analog-output-headphones: Headphones (priority 9900, latency offset 0 usec, available: unknown)
properties:
device.icon_name = "audio-headphones"
active port: <analog-output-headphones>
analog-output-speaker: Speakers (priority 10000, latency offset 0 usec, available: unknown)
properties:
device.icon_name = "audio-speakers"
analog-output-headphones: Headphones (priority 9900, latency offset 0 usec, available: unknown)
properties:
device.icon_name = "audio-headphones"
active port: <analog-output-headphones>
Unfortunately, this audio device itself does not have a Speaker 3.5mm jack, but only a Headphone 3.5mm jack.
Hence the default priority being higher for the Speaker port, a new user connected to this workstation will always miss sound and need to change the active port to be the Headphones manually.
Following is how I fixed this problem.
It's probably not the best way to do things, but my knowledge is limited in this subject, and it just works !
I would love to receive some feedback from the experts though.
First, I've created a udev rule to match my audio device and use a user-defined pulseaudio profile
SUBSYSTEM!="sound", GOTO="pulseaudio_end"
ACTION!="change", GOTO="pulseaudio_end"
KERNEL!="card*", GOTO="pulseaudio_end"
ATTRS{vendor}=="0x6549", ATTRS{device}=="0x2200", ENV{PULSE_PROFILE_SET}="teradici.conf"
LABEL="pulseaudio_end"
ACTION!="change", GOTO="pulseaudio_end"
KERNEL!="card*", GOTO="pulseaudio_end"
ATTRS{vendor}=="0x6549", ATTRS{device}=="0x2200", ENV{PULSE_PROFILE_SET}="teradici.conf"
LABEL="pulseaudio_end"
Then, I created this user-defined profile, teradici.conf, by copying /usr/share/pulseaudio/alsa-mixer/profile-sets/default.conf and removing analog-output-speaker from the paths-output.
--- default.conf 2020-11-23 17:33:37.000000000 +0100
+++ teradici.conf 2023-04-12 09:01:03.345338558 +0200
@@ -112,7 +112,7 @@
[Mapping analog-stereo]
device-strings = front:%f
channel-map = left,right
-paths-output = analog-output analog-output-lineout analog-output-speaker analog-output-headphones analog-output-headphones-2
+paths-output = analog-output analog-output-lineout analog-output-headphones analog-output-headphones-2
paths-input = analog-input-front-mic analog-input-rear-mic analog-input-internal-mic analog-input-dock-mic analog-input analog-input-mic analog-input-linein analog-input-aux analog-input-video analog-input-tvtuner analog-input-fm analog-input-mic-line analog-input-headphone-mic analog-input-headset-mic
priority = 15
+++ teradici.conf 2023-04-12 09:01:03.345338558 +0200
@@ -112,7 +112,7 @@
[Mapping analog-stereo]
device-strings = front:%f
channel-map = left,right
-paths-output = analog-output analog-output-lineout analog-output-speaker analog-output-headphones analog-output-headphones-2
+paths-output = analog-output analog-output-lineout analog-output-headphones analog-output-headphones-2
paths-input = analog-input-front-mic analog-input-rear-mic analog-input-internal-mic analog-input-dock-mic analog-input analog-input-mic analog-input-linein analog-input-aux analog-input-video analog-input-tvtuner analog-input-fm analog-input-mic-line analog-input-headphone-mic analog-input-headset-mic
priority = 15
After a reboot, this audio device no longer exposes the "missing" Speaker port and the Headphones port is always selected.
Cheers,