[pulseaudio-discuss] [PATCH 1/6] Alsa: Correct port availability with multiple jacks

Sjoerd Simons sjoerd at luon.net
Fri Oct 31 14:01:24 PDT 2014


In case there are two independent jacks for one port (e.g. Dock
Headphone Jack and Headphone Jack), the availability ends up being
incorrect for one of the first was _NO (not plugged) and the second gets
_YES (plugged). Also pulse complains about the state being inconsistent
which isn't true.

Fix this by preferring higher states (_YES > _NO > _UNKNOWN)
---
 src/modules/alsa/module-alsa-card.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/src/modules/alsa/module-alsa-card.c b/src/modules/alsa/module-alsa-card.c
index ed332e0..0026e0f 100644
--- a/src/modules/alsa/module-alsa-card.c
+++ b/src/modules/alsa/module-alsa-card.c
@@ -335,14 +335,8 @@ static void report_port_state(pa_device_port *p, struct userdata *u) {
 
         cpa = jack->plugged_in ? jack->state_plugged : jack->state_unplugged;
 
-        /* "Yes" and "no" trumphs "unknown" if we have more than one jack */
-        if (cpa == PA_AVAILABLE_UNKNOWN)
-            continue;
-
-        if ((cpa == PA_AVAILABLE_NO && pa == PA_AVAILABLE_YES) ||
-            (pa == PA_AVAILABLE_NO && cpa == PA_AVAILABLE_YES))
-            pa_log_warn("Availability of port '%s' is inconsistent!", p->name);
-        else
+        /* Prefer going towards _YES in case of multiple jacks */
+        if (cpa > pa)
             pa = cpa;
     }
 
-- 
2.1.1



More information about the pulseaudio-discuss mailing list