]> git.alsa-project.org Git - alsa-lib.git/commitdiff
ucm: add '${LibCaps}' substitution
authorJaroslav Kysela <perex@perex.cz>
Fri, 21 Mar 2025 10:41:09 +0000 (11:41 +0100)
committerJaroslav Kysela <perex@perex.cz>
Fri, 21 Mar 2025 10:41:09 +0000 (11:41 +0100)
It is a preparation for future checking of alsa-lib's extensions.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
src/ucm/ucm_confdoc.h
src/ucm/ucm_subs.c

index b8baeb5ec82000cd6db1e370234f4758de3337ee..e6c0a09128a52e549a3e2f858876ab7846f47053 100644 (file)
@@ -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
index d1dc581930c7b1ac7ff5d58c631c621101cbba73..a3d9c392e10e75564cf9717834b921dd8176c978 100644 (file)
@@ -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 <perex@perex.cz>
  */
 
 #include <limits.h>
 #include <regex.h>
 
+/* 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);