[pulseaudio-discuss] [PATCH] card: Log availability status when choosing initial profile

Tanu Kaskinen tanuk at iki.fi
Fri Jun 29 12:02:58 UTC 2018


On Wed, 2018-06-27 at 15:01 -0700, João Paulo Rechi Vita wrote:
> ---
>  src/pulsecore/card.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/src/pulsecore/card.c b/src/pulsecore/card.c
> index 0112cffb1..4ead3a606 100644
> --- a/src/pulsecore/card.c
> +++ b/src/pulsecore/card.c
> @@ -204,7 +204,10 @@ 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 an initial profile for card %s", card->name);
>      PA_HASHMAP_FOREACH(profile, card->profiles, state) {
> +        pa_log_debug("profile %s availability %s", profile->name, profile->available == PA_AVAILABLE_YES ? "yes" :
> +                                                                  profile->available == PA_AVAILABLE_NO ? "no" : "unknown");
>          if (profile->available == PA_AVAILABLE_NO)
>              continue;
>  
> @@ -213,6 +216,7 @@ void pa_card_choose_initial_profile(pa_card *card) {
>      }
>  
>      if (!best) {
> +        pa_log_info("No profile with availability status 'yes' or 'unknown' found for card %s", card->name);
>          PA_HASHMAP_FOREACH(profile, card->profiles, state) {
>              if (!best || profile->priority > best->priority)
>                  best = profile;
> @@ -220,6 +224,7 @@ void pa_card_choose_initial_profile(pa_card *card) {
>      }
>      pa_assert(best);
>  
> +    pa_log_info("Initial profile %s chosen for card %s", best->name, card->name);

This message belongs to pa_card_put(), because at this point the
initial profile may still change, either in the CHOOSE_INITIAL_PROFILE
hook or by the card implementation (at least module-alsa-card supports
overriding the automatic policy). If you need to log a message at this
point, the wording needs to be different (I couldn't immediately come
up with a good example).

-- 
Tanu

https://liberapay.com/tanuk
https://www.patreon.com/tanuk


More information about the pulseaudio-discuss mailing list