alsa-mixer: add mixer handling to the fallback stereo case
authorTanu Kaskinen <tanuk@iki.fi>
Fri, 8 Sep 2017 12:10:41 +0000 (15:10 +0300)
committerArun Raghavan <arun@arunraghavan.net>
Wed, 13 Sep 2017 02:50:05 +0000 (08:20 +0530)
Some sound cards don't have any alsa-lib configuration, but they used to
work well enough up to PulseAudio 10. PulseAudio 11 stopped using "hw:0"
for the analog-stereo mapping, and instead defined it as a fallback
mapping without any mixer handling. As a result, switching between
headphones and speakers stopped working without changing the mixer
settings manually at least on Toshiba Chromebook 2. This patch adds the
mixer handling back to the fallback mapping.

I also renamed "unknown-stereo" to "stereo-fallback", because I like
that name more.

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=102560
src/modules/alsa/alsa-mixer.c
src/modules/alsa/mixer/profile-sets/default.conf

index f59cad3..986cc7d 100644 (file)
@@ -3989,6 +3989,7 @@ static int mapping_verify(pa_alsa_mapping *m, const pa_channel_map *bonus) {
     static const struct description_map well_known_descriptions[] = {
         { "analog-mono",            N_("Analog Mono") },
         { "analog-stereo",          N_("Analog Stereo") },
+        { "stereo-fallback",        N_("Stereo") },
         /* Note: Not translated to "Analog Stereo Input", because the source
          * name gets "Input" appended to it automatically, so adding "Input"
          * here would lead to the source name to become "Analog Stereo Input
@@ -4016,7 +4017,6 @@ static int mapping_verify(pa_alsa_mapping *m, const pa_channel_map *bonus) {
         { "iec958-dts-surround-51", N_("Digital Surround 5.1 (IEC958/DTS)") },
         { "hdmi-stereo",            N_("Digital Stereo (HDMI)") },
         { "hdmi-surround-51",       N_("Digital Surround 5.1 (HDMI)") },
-        { "unknown-stereo",         N_("Stereo") },
     };
 
     pa_assert(m);
index f412058..c360e77 100644 (file)
@@ -115,6 +115,15 @@ paths-output = analog-output analog-output-lineout analog-output-speaker analog-
 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 = 10
 
+# If everything else fails, try to use hw:0 as a stereo device.
+[Mapping stereo-fallback]
+device-strings = hw:%f
+fallback = yes
+channel-map = front-left,front-right
+paths-output = analog-output analog-output-lineout analog-output-speaker 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 = 1
+
 [Mapping analog-surround-21]
 device-strings = surround21:%f
 channel-map = front-left,front-right,lfe
@@ -460,12 +469,6 @@ priority = 1
 direction = input
 paths-input = multichannel-input
 
-[Mapping unknown-stereo]
-device-strings = hw:%f
-channel-map = front-left,front-right
-fallback = yes
-priority = 1
-
 ; An example for defining multiple-sink profiles
 #[Profile output:analog-stereo+output:iec958-stereo+input:analog-stereo]
 #description = Foobar