OSDN Git Service

ucm: Allow empty strings in "${var:...}" substitutions
authorHans de Goede <hdegoede@redhat.com>
Sat, 27 Jun 2020 18:30:52 +0000 (20:30 +0200)
committerJaroslav Kysela <perex@perex.cz>
Sun, 28 Jun 2020 15:51:46 +0000 (17:51 +0200)
commitf4e48d0d158a9aac47e2239b862ef6d5643833cc
treee9d07b0f1b741671c876d998495b16ec68a76958
parenteb94bf02803797df0506357cb85bde3a4f65a0dc
ucm: Allow empty strings in "${var:...}" substitutions

Recent ucm-conf changes introduce checks like this one in various places:

If.mspk {
        Condition {
                Type String
                Empty "${var:MonoSpeaker}"
        }
        True ...
        False ...
}

The 'Empty "${var:MonoSpeaker}"' part can only every succeed if we do:

Define.MonoSpeaker ""

But so far that would result in an error like this one:

ALSA lib ucm_subs.c:367:(uc_mgr_get_substituted_value) variable '${var:MonoSpeaker}' is not defined in this context!
ALSA lib main.c:983:(snd_use_case_mgr_open) error: failed to import cht-bsw-rt5672 use case configuration -22
alsaucm: error failed to open sound card cht-bsw-rt5672: Invalid argument

This commit fixes this by allowing empty values for "${var:...}"
substitutions.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Tested-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
src/ucm/ucm_subs.c