On 2014-11-16 23:15, Sjoerd Simons wrote:
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.

Hmm, this requires some careful thought. Like, in the case there is more than one port that is "unknown", and the user selects that port manually, then another port goes from no (or yes!) to unknown, that port might be selected, or not selected, based on port priority or something...?

I think we need to restrict this one to "only consider unknown ports in case *all* other ports are unavailable"? Does that make sense?

---
  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)


--
David Henningsson, Canonical Ltd.
https://launchpad.net/~diwic
_______________________________________________
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss

Reply via email to