OSDN Git Service

ucm: Only look in ucm[1] or ucm2 dir once we've found a config file in one
authorHans de Goede <hdegoede@redhat.com>
Tue, 19 Nov 2019 10:48:21 +0000 (11:48 +0100)
committerJaroslav Kysela <perex@perex.cz>
Tue, 19 Nov 2019 11:45:38 +0000 (12:45 +0100)
commitb3a02322d4514ac9cf5c823253ff27e0541e4088
tree9e5139e94e32c4f5f8bef29eac433b0a8e119e10
parent77119d83a1f42b648671cf856e699500d89dc651
ucm: Only look in ucm[1] or ucm2 dir once we've found a config file in one

Unless environment variables are set, then configuration_filename()
when initially called by load_master_config() will first try to find
the requested master-config under <prefix>/alsa/ucm2 and then under
<prefix>/alsa/ucm.

Once a master-config is found this way, we should set conf_format to
match, so that subsequent lookups only look under the same directory
as where the master-config was found.

This fixes 2 problems:
1. uc_mgr_config_load() looking under <prefix>/alsa/ucm for includes for
   UCM2 profiles because it is called with uc_mgr->conf_format as format
   and before this commit that would stay 0 when autodetecion is used.

2. parse_verb_file() possibly loading an UCM2 verb-file for an UCM1 profile,
   the chance of this happening is small as this means that even though
   there is no UCM2 master-config there is an UCM2 profile dir matching
   uc_mgr->conf_file_name, which would be weird.

Fixes: aba2260ae7b5 ("ucm: switch to ucm2 directory and v2 format, keep backward compatibility")
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
src/ucm/parser.c