[PATCH 1/3] switch-on-port-available: unify input/output switching policy

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



We don't switch away from profiles that have sinks that have ports
that are not unavailable. That rule was added to avoid automatic
switching to HDMI when plugging in a monitor, but I don't think the
rule needs to be output specific, so let's make the profile change
policy identical between input and output.
---
 src/modules/module-switch-on-port-available.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/modules/module-switch-on-port-available.c b/src/modules/module-switch-on-port-available.c
index 5dd9786..1b917ec 100644
--- a/src/modules/module-switch-on-port-available.c
+++ b/src/modules/module-switch-on-port-available.c
@@ -57,6 +57,9 @@ static bool profile_good_for_output(pa_card_profile *profile) {
 }
 
 static bool profile_good_for_input(pa_card_profile *profile) {
+    pa_source *source;
+    uint32_t idx;
+
     pa_assert(profile);
 
     if (!pa_safe_streq(profile->card->active_profile->output_name, profile->output_name))
@@ -68,6 +71,14 @@ static bool profile_good_for_input(pa_card_profile *profile) {
     if (profile->card->active_profile->max_sink_channels != profile->max_sink_channels)
         return false;
 
+    PA_IDXSET_FOREACH(source, profile->card->sources, idx) {
+        if (!source->active_port)
+            continue;
+
+        if (source->active_port->available != PA_AVAILABLE_NO)
+            return false;
+    }
+
     return true;
 }
 
-- 
2.7.0



[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux