[alsa-devel] [PATCH alsa-lib 2/4] ucm: Fix fallback to card_name (shortname) config for ucm1 profiles
Hans de Goede
hdegoede at redhat.com
Tue Nov 19 11:48:20 CET 2019
uc_mgr_import_master_config() first calls load_master_config()
with the card's longname and if that fails then calls it again with the
card_name.
Before this commit configuration_filename() would force conf_format to 2
when it the access(fn, R_OK) test failed for the ucm1 longname
master-config filename.
This would cause configuration_filename() to blindly return a filename
under <prefix>/ucm2 without seeing if that is actually there and without
trying to fallback to the old profiles under <prefix>/ucm, breaking the
loading of UCM1 profiles by card_name.
This commit fixes this by modifying configuration_filename() to not set
conf_format when checking for the UCM1 config filename fails.
Instead, to make sure that any errors about opening the file still report
the new path, configuration_filename() now resets the filename to the UCM2
path if the access() check has failed for both the UCM2 and UCM1 paths,
without touching conf_format.
Fixes: aba2260ae7b5 ("ucm: switch to ucm2 directory and v2 format, keep backward compatibility")
Signed-off-by: Hans de Goede <hdegoede at redhat.com>
---
src/ucm/parser.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/src/ucm/parser.c b/src/ucm/parser.c
index 17aab054..a7e80de3 100644
--- a/src/ucm/parser.c
+++ b/src/ucm/parser.c
@@ -101,7 +101,6 @@ static void configuration_filename(snd_use_case_mgr_t *uc_mgr,
}
if (uc_mgr->conf_format > 0) {
-__format:
configuration_filename2(fn, fn_len, uc_mgr->conf_format,
dir, file, suffix);
return;
@@ -112,11 +111,11 @@ __format:
return;
configuration_filename2(fn, fn_len, 0, dir, file, suffix);
- if (access(fn, R_OK)) {
- /* make sure that the error message refers to the new path */
- uc_mgr->conf_format = 2;
- goto __format;
- }
+ if (access(fn, R_OK) == 0)
+ return;
+
+ /* make sure that the error message refers to the new path */
+ configuration_filename2(fn, fn_len, 2, dir, file, suffix);
}
/*
--
2.23.0
More information about the Alsa-devel
mailing list