acp: fix UCM off profile

This commit is contained in:
Wim Taymans 2020-08-18 16:52:09 +02:00
parent 69be14186e
commit cfdd6cab20
3 changed files with 8 additions and 6 deletions

View file

@ -117,6 +117,7 @@ static void add_profiles(pa_card *impl)
ap->profile.name = ap->name = pa_xstrdup("off"); ap->profile.name = ap->name = pa_xstrdup("off");
ap->profile.description = ap->description = pa_xstrdup(_("Off")); ap->profile.description = ap->description = pa_xstrdup(_("Off"));
ap->profile.available = ACP_AVAILABLE_YES; ap->profile.available = ACP_AVAILABLE_YES;
ap->is_off = true;
pa_hashmap_put(impl->profiles, ap->name, ap); pa_hashmap_put(impl->profiles, ap->name, ap);
PA_HASHMAP_FOREACH(ap, impl->profile_set->profiles, state) { PA_HASHMAP_FOREACH(ap, impl->profile_set->profiles, state) {
@ -1029,6 +1030,7 @@ int acp_card_set_profile(struct acp_card *card, uint32_t new_index)
struct acp_card_profile **profiles = card->profiles; struct acp_card_profile **profiles = card->profiles;
pa_alsa_profile *op, *np; pa_alsa_profile *op, *np;
uint32_t idx; uint32_t idx;
int res;
if (new_index >= card->n_profiles) if (new_index >= card->n_profiles)
return -EINVAL; return -EINVAL;
@ -1057,9 +1059,9 @@ int acp_card_set_profile(struct acp_card *card, uint32_t new_index)
/* if UCM is available for this card then update the verb */ /* if UCM is available for this card then update the verb */
if (impl->use_ucm) { if (impl->use_ucm) {
if (pa_alsa_ucm_set_profile(&impl->ucm, impl, np ? np->profile.name : NULL, if ((res = pa_alsa_ucm_set_profile(&impl->ucm, impl, np->is_off ? NULL : np->profile.name,
op ? op->profile.name : NULL) < 0) { op ? op->profile.name : NULL)) < 0) {
return -1; return res;
} }
} }

View file

@ -369,6 +369,7 @@ struct pa_alsa_profile {
bool supported:1; bool supported:1;
bool fallback_input:1; bool fallback_input:1;
bool fallback_output:1; bool fallback_output:1;
bool is_off:1;
char **input_mapping_names; char **input_mapping_names;
char **output_mapping_names; char **output_mapping_names;

View file

@ -1337,9 +1337,8 @@ int pa_alsa_ucm_set_profile(pa_alsa_ucm_config *ucm, pa_card *card, const char *
/* change verb */ /* change verb */
pa_log_info("Set UCM verb to %s", profile); pa_log_info("Set UCM verb to %s", profile);
if ((snd_use_case_set(ucm->ucm_mgr, "_verb", profile)) < 0) { if ((ret = snd_use_case_set(ucm->ucm_mgr, "_verb", profile)) < 0) {
pa_log("Failed to set verb %s", profile); pa_log("Failed to set verb %s: %s", profile, snd_strerror(ret));
ret = -1;
} }
/* find active verb */ /* find active verb */