ucm: add possibility to skip the UCM card completely (Linked)

We have a requirement to "hide" some hardware drivers, because
other (main) UCM configuration will refer them.

This patch use special error codes to notify the upper layers
to skip the module loading.

BugLink: https://github.com/alsa-project/alsa-ucm-conf/issues/30
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
Jaroslav Kysela 2020-06-07 18:25:41 +02:00 committed by Tanu Kaskinen
parent b72724369b
commit c1a7e3c59d
6 changed files with 54 additions and 10 deletions

View file

@ -785,6 +785,7 @@ int pa__init(pa_module *m) {
const char *profile_str = NULL;
char *fn = NULL;
bool namereg_fail = false;
int err = -PA_MODULE_ERR_UNSPECIFIED, rval;
pa_alsa_refcnt_inc();
@ -841,7 +842,12 @@ int pa__init(pa_module *m) {
snd_config_update_free_global();
if (u->use_ucm && !pa_alsa_ucm_query_profiles(&u->ucm, u->alsa_card_index)) {
rval = u->use_ucm ? pa_alsa_ucm_query_profiles(&u->ucm, u->alsa_card_index) : -1;
if (rval == -PA_ALSA_ERR_UCM_LINKED) {
err = -PA_MODULE_ERR_SKIP;
goto fail;
}
if (rval == 0) {
pa_log_info("Found UCM profiles");
u->profile_set = pa_alsa_ucm_add_profile_set(&u->ucm, &u->core->default_channel_map);
@ -1009,7 +1015,7 @@ fail:
pa__done(m);
return -1;
return err;
}
int pa__get_n_used(pa_module *m) {