On Tue, 2 Aug 2016, at 12:50 AM, Pali Rohár wrote: > When pa_card_set_profile is called with save=false then > module-card-restore > start fight with module-bluetooth-policy and every second is profile > changing between hsp and a2dp. > > So when pulseaudiu is changing profile in module-bluetooth-policy we need > to save it and tell module-card-restore to not try to restore old > profile. > > Signed-off-by: Pali Rohár <pali.rohar at gmail.com> > --- > src/modules/bluetooth/module-bluetooth-policy.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/src/modules/bluetooth/module-bluetooth-policy.c > b/src/modules/bluetooth/module-bluetooth-policy.c > index 68c8ab4..74ae898 100644 > --- a/src/modules/bluetooth/module-bluetooth-policy.c > +++ b/src/modules/bluetooth/module-bluetooth-policy.c > @@ -159,7 +159,7 @@ static void card_set_profile(struct userdata *u, > pa_card *card, const char *to_p > > pa_log_debug("Setting card '%s' to profile '%s'", card->name, > to_profile); > > - if (pa_card_set_profile(card, profile, false) != 0) { > + if (pa_card_set_profile(card, profile, true) != 0) { > pa_log_warn("Could not set profile '%s'", to_profile); > continue; > } > -- This is not actually what we want to do. Automatic switching should not make module-card-restore save the desired profile. The short workaround for this is to register the hook in module-bluetooth-policy with priority later than module-card-restore. That said, I'm not sure it's a good thing for hooks to be fighting to set the profile. I would rather have them select the profile and at the end of running hooks, if something provided a profile, we set it. Tanu, since you added the original code -- wdyt? -- Arun