From 8132c4e2b400bb6511f6d127e2cb743cacd1cd87 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 7 Jun 2021 13:04:03 +0200 Subject: [PATCH] acp: add fallback alibpref just in case Until we are sure that everybody has a recent enough version of alsa-lib 1.2.5 --- spa/plugins/alsa/acp/acp.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/spa/plugins/alsa/acp/acp.c b/spa/plugins/alsa/acp/acp.c index 5fa42750f..0d773ef8a 100644 --- a/spa/plugins/alsa/acp/acp.c +++ b/spa/plugins/alsa/acp/acp.c @@ -242,9 +242,13 @@ static void init_device(pa_card *impl, pa_alsa_device *dev, pa_alsa_direction_t dev->ports = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func); if (m->ucm_context.ucm) { - const char *alibpref; + const char *alibpref = NULL; dev->ucm_context = &m->ucm_context; - if ((snd_use_case_get(impl->ucm.ucm_mgr, "_alibpref", &alibpref) == 0)) { + if ((snd_use_case_get(impl->ucm.ucm_mgr, "_alibpref", &alibpref) != 0)) + alibpref = NULL; + if (alibpref == NULL) + alibpref = spa_aprintf("_ucm%04X.", impl->card.index); + if (alibpref != NULL) { char **d; for (d = m->device_strings; *d; d++) { if (pa_startswith(*d, alibpref)) {