From: Jaroslav Kysela Date: Tue, 6 Oct 2020 08:23:25 +0000 (+0200) Subject: ucm: Handle 'Error' keyword in the master file X-Git-Tag: v1.2.4~17 X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=e80f35611d5de623f1cc1e7f266605b272c7259d;p=alsa-lib.git ucm: Handle 'Error' keyword in the master file With the conditional blocks, it may be useful to terminate the hardware detection from the configuration. Introduce 'Error' keyword for the master UCM configuration file. Signed-off-by: Jaroslav Kysela --- diff --git a/src/ucm/parser.c b/src/ucm/parser.c index d034b859..e57e208a 100644 --- a/src/ucm/parser.c +++ b/src/ucm/parser.c @@ -244,6 +244,24 @@ int parse_get_safe_name(snd_use_case_mgr_t *uc_mgr, snd_config_t *n, return 0; } +/* + * Handle 'Error' configuration node. + */ +static int error_node(snd_use_case_mgr_t *uc_mgr, snd_config_t *cfg) +{ + int err; + char *s; + + err = parse_string_substitute3(uc_mgr, cfg, &s); + if (err < 0) { + uc_error("error: failed to get Error string"); + return err; + } + uc_error("%s", s); + free(s); + return -ENXIO; +} + /* * Evaluate variable regex definitions (in-place delete) */ @@ -1899,6 +1917,10 @@ static int parse_master_file(snd_use_case_mgr_t *uc_mgr, snd_config_t *cfg) continue; } + /* error */ + if (strcmp(id, "Error") == 0) + return error_node(uc_mgr, n); + uc_error("uknown master file field %s", id); } return 0;