mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2026-02-18 22:05:17 -05:00
ucm: fix again the long name configuration filename lookup
The fix in commit77119d83a1assumes that both ucm1 / ucm2 directories have the configurations for the long name in the same directory. For v2 we changed the location to card_name/card_long_name aka driver_name/driver_long_name to make the directory layout more structured. Fixes:77119d83a1("ucm: Fix opening of master-configs by the card's longname") Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
parent
8c4301e7a8
commit
10a63e093c
1 changed files with 20 additions and 7 deletions
|
|
@ -1567,7 +1567,7 @@ static int get_by_card(snd_use_case_mgr_t *mgr, const char *ctl_name, char *long
|
||||||
}
|
}
|
||||||
|
|
||||||
static int load_master_config(snd_use_case_mgr_t *uc_mgr,
|
static int load_master_config(snd_use_case_mgr_t *uc_mgr,
|
||||||
const char *card_name, snd_config_t **cfg, int fcheck)
|
const char *card_name, snd_config_t **cfg, int longname)
|
||||||
{
|
{
|
||||||
char filename[MAX_FILE];
|
char filename[MAX_FILE];
|
||||||
int err;
|
int err;
|
||||||
|
|
@ -1578,12 +1578,25 @@ static int load_master_config(snd_use_case_mgr_t *uc_mgr,
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
configuration_filename(uc_mgr, filename, sizeof(filename),
|
uc_mgr->conf_format = 0;
|
||||||
card_name, card_name, ".conf");
|
if (longname) {
|
||||||
|
if (getenv(ALSA_CONFIG_UCM2_VAR) || !getenv(ALSA_CONFIG_UCM_VAR)) {
|
||||||
/* if the configuration file does not exist, silently return */
|
uc_mgr->conf_format = 2;
|
||||||
if (fcheck && access(filename, R_OK) != 0)
|
configuration_filename(uc_mgr, filename, sizeof(filename),
|
||||||
return -ENOENT;
|
uc_mgr->conf_file_name, card_name, ".conf");
|
||||||
|
}
|
||||||
|
if (uc_mgr->conf_format >= 2 && access(filename, R_OK) != 0) {
|
||||||
|
/* try the old ucm directory */
|
||||||
|
uc_mgr->conf_format = 1;
|
||||||
|
configuration_filename(uc_mgr, filename, sizeof(filename),
|
||||||
|
card_name, card_name, ".conf");
|
||||||
|
if (access(filename, R_OK) != 0)
|
||||||
|
return -ENOENT;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
configuration_filename(uc_mgr, filename, sizeof(filename),
|
||||||
|
card_name, card_name, ".conf");
|
||||||
|
}
|
||||||
|
|
||||||
err = uc_mgr_config_load(uc_mgr->conf_format, filename, cfg);
|
err = uc_mgr_config_load(uc_mgr->conf_format, filename, cfg);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue