sink, source: improve suspend cause logging

Previously the suspend cause was logged as a hexadecimal number, now
it's logged as a human-friendly string.

Also, the command line interface handled only a subset of causes when
printing them, now all suspend causes are printed.
This commit is contained in:
Tanu Kaskinen 2017-12-28 12:09:19 +02:00
parent eeee5664fa
commit f176443181
5 changed files with 80 additions and 15 deletions

View file

@ -212,6 +212,7 @@ char *pa_sink_list_to_string(pa_core *c) {
v[PA_VOLUME_SNPRINT_VERBOSE_MAX],
cm[PA_CHANNEL_MAP_SNPRINT_MAX], *t;
const char *cmn;
char suspend_cause_buf[PA_SUSPEND_CAUSE_TO_STRING_BUF_SIZE];
cmn = pa_channel_map_to_pretty_name(&sink->channel_map);
@ -222,7 +223,7 @@ char *pa_sink_list_to_string(pa_core *c) {
"\tdriver: <%s>\n"
"\tflags: %s%s%s%s%s%s%s%s\n"
"\tstate: %s\n"
"\tsuspend cause: %s%s%s%s\n"
"\tsuspend cause: %s\n"
"\tpriority: %u\n"
"\tvolume: %s\n"
"\t balance %0.2f\n"
@ -250,10 +251,7 @@ char *pa_sink_list_to_string(pa_core *c) {
sink->flags & PA_SINK_FLAT_VOLUME ? "FLAT_VOLUME " : "",
sink->flags & PA_SINK_DYNAMIC_LATENCY ? "DYNAMIC_LATENCY" : "",
pa_sink_state_to_string(pa_sink_get_state(sink)),
sink->suspend_cause & PA_SUSPEND_USER ? "USER " : "",
sink->suspend_cause & PA_SUSPEND_APPLICATION ? "APPLICATION " : "",
sink->suspend_cause & PA_SUSPEND_IDLE ? "IDLE " : "",
sink->suspend_cause & PA_SUSPEND_SESSION ? "SESSION" : "",
pa_suspend_cause_to_string(sink->suspend_cause, suspend_cause_buf),
sink->priority,
pa_cvolume_snprint_verbose(cv,
sizeof(cv),
@ -328,6 +326,7 @@ char *pa_source_list_to_string(pa_core *c) {
v[PA_VOLUME_SNPRINT_VERBOSE_MAX],
cm[PA_CHANNEL_MAP_SNPRINT_MAX], *t;
const char *cmn;
char suspend_cause_buf[PA_SUSPEND_CAUSE_TO_STRING_BUF_SIZE];
cmn = pa_channel_map_to_pretty_name(&source->channel_map);
@ -338,7 +337,7 @@ char *pa_source_list_to_string(pa_core *c) {
"\tdriver: <%s>\n"
"\tflags: %s%s%s%s%s%s%s\n"
"\tstate: %s\n"
"\tsuspend cause: %s%s%s%s\n"
"\tsuspend cause: %s\n"
"\tpriority: %u\n"
"\tvolume: %s\n"
"\t balance %0.2f\n"
@ -363,10 +362,7 @@ char *pa_source_list_to_string(pa_core *c) {
source->flags & PA_SOURCE_LATENCY ? "LATENCY " : "",
source->flags & PA_SOURCE_DYNAMIC_LATENCY ? "DYNAMIC_LATENCY" : "",
pa_source_state_to_string(pa_source_get_state(source)),
source->suspend_cause & PA_SUSPEND_USER ? "USER " : "",
source->suspend_cause & PA_SUSPEND_APPLICATION ? "APPLICATION " : "",
source->suspend_cause & PA_SUSPEND_IDLE ? "IDLE " : "",
source->suspend_cause & PA_SUSPEND_SESSION ? "SESSION" : "",
pa_suspend_cause_to_string(source->suspend_cause, suspend_cause_buf),
source->priority,
pa_cvolume_snprint_verbose(cv,
sizeof(cv),