From: Jaroslav Kysela Date: Fri, 21 Mar 2025 10:41:09 +0000 (+0100) Subject: ucm: add '${LibCaps}' substitution X-Git-Tag: v1.2.14~14 X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=d8300e5cb794ea014e7d9d233d61af7a0cabc459;p=alsa-lib.git ucm: add '${LibCaps}' substitution It is a preparation for future checking of alsa-lib's extensions. Signed-off-by: Jaroslav Kysela --- diff --git a/src/ucm/ucm_confdoc.h b/src/ucm/ucm_confdoc.h index b8baeb5e..e6c0a091 100644 --- a/src/ucm/ucm_confdoc.h +++ b/src/ucm/ucm_confdoc.h @@ -388,6 +388,7 @@ substituted. The substitutes strings are in the table bellow. Substituted string | Value -----------------------|--------------------- +${LibCaps} | Library capabilities (string like '*a*b*c*') [**Syntax 8**] ${OpenName} | Original UCM card name (passed to snd_use_case_mgr_open()) ${ConfLibDir} | Library top-level configuration directory (e.g. /usr/share/alsa) ${ConfTopDir} | Top-level UCM configuration directory (e.g. /usr/share/alsa/ucm2) @@ -433,6 +434,10 @@ Define.Bytes2 "${sys-card:[type=hex,pos=0x22]device/../descriptors}" Replace *type=hex* with *type=ascii* or omit this variable settings to work with ASCII characters. +#### Library capabilities + +None at the moment. The list will grow after *Syntax 8* (library 1.2.14). + #### Special whole string substitution Substituted string | Value diff --git a/src/ucm/ucm_subs.c b/src/ucm/ucm_subs.c index d1dc5819..a3d9c392 100644 --- a/src/ucm/ucm_subs.c +++ b/src/ucm/ucm_subs.c @@ -20,7 +20,7 @@ * transition sequences, multiple client access and user defined use * cases was kindly sponsored by Wolfson Microelectronics PLC. * - * Copyright (C) 2019 Red Hat Inc. + * Copyright (C) 2019-2025 Red Hat Inc. * Authors: Jaroslav Kysela */ @@ -30,8 +30,19 @@ #include #include +/* capabilities string like "*a*b*c" will be used to check library extensions */ +/* use Needle like "*a*" or regex expression for a match */ +#define LIB_CAPS_STRING "*" "*" + static unsigned char _hex_table[16] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; +static char *rval_lib_caps(snd_use_case_mgr_t *uc_mgr ATTRIBUTE_UNUSED) +{ + if (uc_mgr->conf_format < 8) + return NULL; + return strdup(LIB_CAPS_STRING); +} + static char *rval_open_name(snd_use_case_mgr_t *uc_mgr) { const char *name; @@ -883,6 +894,7 @@ __std: goto __std; } fcn2 = NULL; + MATCH_VARIABLE(value, "${LibCaps}", rval_lib_caps, false); MATCH_VARIABLE(value, "${OpenName}", rval_open_name, false); MATCH_VARIABLE(value, "${ConfLibDir}", rval_conf_libdir, false); MATCH_VARIABLE(value, "${ConfTopDir}", rval_conf_topdir, false);