diff options
author | João Paulo Rechi Vita <jprvita@endlessm.com> | 2018-06-20 18:36:59 -0700 |
---|---|---|
committer | Arun Raghavan <arun@arunraghavan.net> | 2018-10-11 13:08:41 +0000 |
commit | a720938855575ff78111c788f9cfef100a1a01a4 (patch) | |
tree | 470ce26f093d3d28fa599ee30a4485b480e442ef | |
parent | 784853004c91e3c14fb9b9745dd65126241d579e (diff) |
card: Log initial profile selection
Add logs to pa_card_choose_initial_profile and pa_card_set_profile to
have detailed logging of the profile initialization logic.
-rw-r--r-- | src/pulsecore/card.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/pulsecore/card.c b/src/pulsecore/card.c index 4305eb48c..f1628938b 100644 --- a/src/pulsecore/card.c +++ b/src/pulsecore/card.c @@ -83,7 +83,7 @@ void pa_card_profile_set_available(pa_card_profile *c, pa_available_t available) c->available = available; pa_log_debug("Setting card %s profile %s to availability status %s", c->card->name, c->name, - available == PA_AVAILABLE_YES ? "yes" : available == PA_AVAILABLE_NO ? "no" : "unknown"); + pa_available_to_string(available)); /* Post subscriptions to the card which owns us */ pa_assert_se(core = c->card->core); @@ -199,7 +199,9 @@ void pa_card_choose_initial_profile(pa_card *card) { * or if all profiles are unavailable, pick the profile with the highest * priority regardless of its availability. */ + pa_log_debug("Looking for initial profile for card %s", card->name); PA_HASHMAP_FOREACH(profile, card->profiles, state) { + pa_log_debug("%s availability %s", profile->name, pa_available_to_string(profile->available)); if (profile->available == PA_AVAILABLE_NO) continue; @@ -217,6 +219,7 @@ void pa_card_choose_initial_profile(pa_card *card) { card->active_profile = best; card->save_profile = false; + pa_log_info("%s: active_profile: %s", card->name, card->active_profile->name); /* Let policy modules override the default. */ pa_hook_fire(&card->core->hooks[PA_CORE_HOOK_CARD_CHOOSE_INITIAL_PROFILE], card); @@ -331,6 +334,7 @@ int pa_card_set_profile(pa_card *c, pa_card_profile *profile, bool save) { if (c->linked && (r = c->set_profile(c, profile)) < 0) return r; + pa_log_debug("%s: active_profile: %s -> %s", c->name, c->active_profile->name, profile->name); c->active_profile = profile; c->save_profile = save; @@ -338,7 +342,6 @@ int pa_card_set_profile(pa_card *c, pa_card_profile *profile, bool save) { update_port_preferred_profile(c); if (c->linked) { - pa_log_info("Changed profile of card %u \"%s\" to %s", c->index, c->name, profile->name); pa_hook_fire(&c->core->hooks[PA_CORE_HOOK_CARD_PROFILE_CHANGED], c); pa_subscription_post(c->core, PA_SUBSCRIPTION_EVENT_CARD|PA_SUBSCRIPTION_EVENT_CHANGE, c->index); } |