[PATCH] pactl: Show port availability

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

 



Signed-off-by: David Henningsson <david.henningsson at canonical.com>
---

I think I promised mkbosmans to add availability to pactl once we merged the other stuff, so here comes.

 src/utils/pactl.c |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/src/utils/pactl.c b/src/utils/pactl.c
index b1a0064..9630904 100644
--- a/src/utils/pactl.c
+++ b/src/utils/pactl.c
@@ -212,6 +212,15 @@ static void get_server_info_callback(pa_context *c, const pa_server_info *i, voi
     complete_action();
 }
 
+static const char* get_available_str_ynonly(int available)
+{
+    switch (available) {
+    case PA_PORT_AVAILABLE_YES: return ", available";
+    case PA_PORT_AVAILABLE_NO: return ", not available";
+    }
+    return "";
+}
+
 static void get_sink_info_callback(pa_context *c, const pa_sink_info *i, int is_last, void *userdata) {
 
     static const char *state_table[] = {
@@ -308,7 +317,8 @@ static void get_sink_info_callback(pa_context *c, const pa_sink_info *i, int is_
 
         printf(_("\tPorts:\n"));
         for (p = i->ports; *p; p++)
-            printf("\t\t%s: %s (priority. %u)\n", (*p)->name, (*p)->description, (*p)->priority);
+            printf("\t\t%s: %s (priority: %u%s)\n", (*p)->name, (*p)->description, (*p)->priority,
+                get_available_str_ynonly((*p)->available));
     }
 
     if (i->active_port)
@@ -419,7 +429,8 @@ static void get_source_info_callback(pa_context *c, const pa_source_info *i, int
 
         printf(_("\tPorts:\n"));
         for (p = i->ports; *p; p++)
-            printf("\t\t%s: %s (priority. %u)\n", (*p)->name, (*p)->description, (*p)->priority);
+            printf("\t\t%s: %s (priority: %u%s)\n", (*p)->name, (*p)->description, (*p)->priority,
+                get_available_str_ynonly((*p)->available));
     }
 
     if (i->active_port)
-- 
1.7.5.4



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

  Powered by Linux