In case all other ports went to availability no, a port going to unknown
can actually be the best available port so check in that case as well.
Specifically this happens when various jacks get unplugged and speakers
are left as the available port (unknown availability) *and* the speakers
did the no -> unknown transition after all others transitions to no.
---
 src/modules/module-switch-on-port-available.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/src/modules/module-switch-on-port-available.c 
b/src/modules/module-switch-on-port-available.c
index 7397bcc..5f97292 100644
--- a/src/modules/module-switch-on-port-available.c
+++ b/src/modules/module-switch-on-port-available.c
@@ -143,9 +143,6 @@ static pa_hook_result_t 
port_available_hook_callback(pa_core *c, pa_device_port
     pa_source *source;
     bool is_active_profile, is_active_port;
 
-    if (port->available == PA_AVAILABLE_UNKNOWN)
-        return PA_HOOK_OK;
-
     card = port->card;
 
     if (!card) {
@@ -184,10 +181,9 @@ static pa_hook_result_t 
port_available_hook_callback(pa_core *c, pa_device_port
             pa_source_set_port(source, port->name, false);
         if (sink)
             pa_sink_set_port(sink, port->name, false);
-    }
-
-    if (port->available == PA_AVAILABLE_NO) {
+    } else {
         if (sink) {
+
             pa_device_port *p2 = pa_device_port_find_best(sink->ports);
 
             if (p2 && p2->available != PA_AVAILABLE_NO)
-- 
2.1.1

_______________________________________________
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss

Reply via email to