mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-05 13:29:57 -05:00
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:
parent
b72724369b
commit
c1a7e3c59d
6 changed files with 54 additions and 10 deletions
|
|
@ -52,6 +52,7 @@ PA_MODULE_USAGE(
|
|||
struct device {
|
||||
char *path;
|
||||
bool need_verify;
|
||||
bool ignore;
|
||||
char *card_name;
|
||||
char *args;
|
||||
uint32_t module;
|
||||
|
|
@ -286,6 +287,9 @@ static void verify_access(struct userdata *u, struct device *d) {
|
|||
pa_assert(u);
|
||||
pa_assert(d);
|
||||
|
||||
if (d->ignore)
|
||||
return;
|
||||
|
||||
cd = pa_sprintf_malloc("/dev/snd/controlC%s", path_get_card_id(d->path));
|
||||
accessible = access(cd, R_OK|W_OK) >= 0;
|
||||
pa_log_debug("%s is accessible: %s", cd, pa_yes_no(accessible));
|
||||
|
|
@ -332,14 +336,20 @@ static void verify_access(struct userdata *u, struct device *d) {
|
|||
* failure or a "fatal" failure. */
|
||||
|
||||
if (pa_ratelimit_test(&d->ratelimit, PA_LOG_DEBUG)) {
|
||||
int err;
|
||||
|
||||
pa_log_debug("Loading module-alsa-card with arguments '%s'", d->args);
|
||||
pa_module_load(&m, u->core, "module-alsa-card", d->args);
|
||||
err = pa_module_load(&m, u->core, "module-alsa-card", d->args);
|
||||
|
||||
if (m) {
|
||||
d->module = m->index;
|
||||
pa_log_info("Card %s (%s) module loaded.", d->path, d->card_name);
|
||||
} else
|
||||
} else if (err == -PA_ERR_NOENTITY) {
|
||||
pa_log_info("Card %s (%s) module skipped.", d->path, d->card_name);
|
||||
d->ignore = true;
|
||||
} else {
|
||||
pa_log_info("Card %s (%s) failed to load module.", d->path, d->card_name);
|
||||
}
|
||||
} else
|
||||
pa_log_warn("Tried to configure %s (%s) more often than %u times in %llus",
|
||||
d->path,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue