From e1e2d0624d6c90e119e27afe7d477c624291a78f Mon Sep 17 00:00:00 2001 From: Tanu Kaskinen Date: Tue, 7 Mar 2017 19:02:43 +0200 Subject: [PATCH] more logging --- src/modules/module-card-restore.c | 16 +++++++++++++--- src/pulsecore/card.c | 5 ++++- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/modules/module-card-restore.c b/src/modules/module-card-restore.c index 3c0307bee..e465a44ed 100644 --- a/src/modules/module-card-restore.c +++ b/src/modules/module-card-restore.c @@ -213,6 +213,7 @@ static bool entry_write(struct userdata *u, const char *name, const struct entry pa_tagstruct_puts(t, e->preferred_input_port); pa_tagstruct_puts(t, e->preferred_output_port); + pa_log_debug("foobar - %s: Storing preferred_output_port = %s in the database.", name, pa_strnull(e->preferred_output_port)); key.data = (char *) name; key.size = strlen(name); @@ -518,8 +519,12 @@ static pa_hook_result_t card_new_hook_callback(pa_core *c, pa_card_new_data *new pa_assert(new_data); - if (!(e = entry_read(u, new_data->name))) + pa_log_debug("foobar - %s: card_new_hook_callback()", new_data->name); + + if (!(e = entry_read(u, new_data->name))) { + pa_log_debug("foobar - %s: entry_read() failed", new_data->name); return PA_HOOK_OK; + } /* Always restore the latency offsets because their * initial value is always 0 */ @@ -540,10 +545,15 @@ static pa_hook_result_t card_new_hook_callback(pa_core *c, pa_card_new_data *new } if (e->preferred_output_port) { + pa_log_debug("foobar - %s: e->preferred_output_port = %s", new_data->name, e->preferred_output_port); p = pa_hashmap_get(new_data->ports, e->preferred_output_port); - if (p) + if (p) { + pa_log_debug("foobar - port found, calling pa_card_new_data_set_preferred_port()"); pa_card_new_data_set_preferred_port(new_data, PA_DIRECTION_OUTPUT, p); - } + } else + pa_log_debug("foobar - port not found"); + } else + pa_log_debug("foobar - %s: e->preferred_output_port = (null)", new_data->name); entry_free(e); diff --git a/src/pulsecore/card.c b/src/pulsecore/card.c index bc5b75b04..99e9d64b9 100644 --- a/src/pulsecore/card.c +++ b/src/pulsecore/card.c @@ -101,8 +101,10 @@ void pa_card_new_data_set_preferred_port(pa_card_new_data *data, pa_direction_t if (direction == PA_DIRECTION_INPUT) data->preferred_input_port = port; - else + else { data->preferred_output_port = port; + pa_log_debug("foobar - %s: pa_card_new_data_set_preferred_port(%s)", data->name, port ? port->name : "(null)"); + } } void pa_card_new_data_done(pa_card_new_data *data) { @@ -167,6 +169,7 @@ pa_card *pa_card_new(pa_core *core, pa_card_new_data *data) { c->preferred_input_port = data->preferred_input_port; c->preferred_output_port = data->preferred_output_port; + pa_log_debug("%s: preferred_output_port = %s (pa_card_new)", c->name, c->preferred_output_port ? c->preferred_output_port->name : "(unset)"); pa_device_init_description(c->proplist, c); pa_device_init_icon(c->proplist, true); -- 2.11.0