[pulseaudio-discuss] [PATCH v2 0/2] Handle two Headphone Jacks with the same name

Hui Wang hui.wang at canonical.com
Mon Jan 14 04:24:12 UTC 2019


Although the patchset tries to add index support, the objective is 100%
compatible with the past. If there is no kcontrols with "index != 0", we
don't need to change any conf files, the pulseaudio will work as before.

The name of "Front Headphone Surround" and "Front Headphone Front" are
not good, I plan to submit a patch to the kernel to change the name to
"Front Headphone" with index 0 and "Front Headphone" with index 1, since
the patch for the kernel is not submitted yet, here I don't send the patch
to change ${path}.conf, but to be easy to review, I paste an example of
changing the ${path}.conf after the kernel patch is merged:


--- a/src/modules/alsa/mixer/paths/analog-output-headphones-2.conf
+++ b/src/modules/alsa/mixer/paths/analog-output-headphones-2.conf
@@ -40,6 +40,18 @@ override-map.2 = all-left,all-right
 switch = off
 volume = off
 
+[Jack Front Headphone at 1]
+required-any = any
+index = 1
+
+[Element Headphone at 1]
+required-any = any
+index = 1
+switch = mute
+volume = merge
+override-map.1 = all
+override-map.2 = all-left,all-right
+
 ; This profile path is intended to control the second headphones, not
 ; the first headphones. But it should not hurt if we leave the
 ; headphone jack enabled nonetheless.
@@ -56,7 +68,7 @@ switch = off
 volume = off
 
 [Element Headphone2]
-required = any
+required-any = any
 switch = mute
 volume = merge
 override-map.1 = all


--- a/src/modules/alsa/mixer/paths/analog-output-speaker.conf
+++ b/src/modules/alsa/mixer/paths/analog-output-speaker.conf
@@ -32,6 +32,11 @@ state.unplugged = unknown
 state.plugged = no
 state.unplugged = unknown
 
+[Jack Front Headphone at 1]
+index = 1
+state.plugged = no
+state.unplugged = unknown
+
 [Jack Front Headphone]
 state.plugged = no
 state.unplugged = unknown


Hui Wang (2):
  alsa-mixer: Add alsa index number support for Element and Jack
  alsa-mixer: set different strings to name and alsa-name for jack and
    element

 src/modules/alsa/alsa-mixer.c                 | 99 +++++++++++++++----
 src/modules/alsa/alsa-mixer.h                 |  6 +-
 src/modules/alsa/alsa-ucm.c                   |  2 +-
 src/modules/alsa/alsa-util.c                  |  4 +-
 src/modules/alsa/alsa-util.h                  |  2 +-
 .../mixer/paths/analog-output.conf.common     |  6 ++
 src/modules/alsa/module-alsa-card.c           |  4 +-
 7 files changed, 95 insertions(+), 28 deletions(-)

-- 
2.17.1



More information about the pulseaudio-discuss mailing list