[pulseaudio-discuss] [PATCH] card-restore: Watch for profiles added after card creation.

Tanu Kaskinen tanu.kaskinen at linux.intel.com
Sun Sep 8 00:49:04 PDT 2013


On Thu, 2013-07-25 at 16:39 +0200, poljar (Damir Jelić) wrote:
> This patch adds the ability to restore profiles if they are added after
> card creation.
> 
> Adding profiles after card creation mainly happens for bluetooth cards.
> 
> Buglink: https://bugs.freedesktop.org/show_bug.cgi?id=65349
> ---
>  src/modules/module-card-restore.c | 29 +++++++++++++++++++++++++----
>  1 file changed, 25 insertions(+), 4 deletions(-)

Applied, thanks! I fixed a small issue pointed out below.

> +static pa_hook_result_t card_profile_added_callback(pa_core *c, pa_card_profile *profile, struct userdata *u) {
> +    struct entry *entry;
> +
> +    pa_assert(profile);
> +
> +    if (!(entry = entry_read(u, profile->card->name)))
> +        return PA_HOOK_OK;
> +
> +    if (pa_safe_streq(entry->profile, profile->name)) {
> +        pa_card_set_profile(profile->card, profile->name, true);
> +        pa_log_info("Restored profile '%s' for card %s.", profile->name, profile->card->name);

pa_card_set_profile() can fail, in which case the log message shouldn't
be printed.

-- 
Tanu



More information about the pulseaudio-discuss mailing list