ucm: add sys-card substitution

It may be useful to check additional sysfs parameters like USB descriptors
to determine the exact hardware capabilities.

Introduce 'sys-card' substitution and 'sys' substitution to allow data
fetching from given range. Also, add conversion to hexadecimal format
when the source file has binary contents.

Example - fetch bytes from positions 0x10..0x15 (6 bytes):

  Define.Bytes1 "${sys-card:[type=hex,pos=0x10,size=6]device/../descriptors}"

Example - fetch one byte from position 0x22:

  Define.Bytes2 "${sys-card:[type=hex,pos=0x22]device/../descriptors}"

Replace type=hex or omit this variable settings to work with ASCII
characters.

Link: https://github.com/alsa-project/alsa-ucm-conf/issues/444
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
Jaroslav Kysela 2025-03-13 17:46:58 +01:00
parent 0c7086777a
commit 7fbd47ce79
2 changed files with 153 additions and 7 deletions

View file

@ -40,7 +40,7 @@
#include <pthread.h>
#include "use-case.h"
#define SYNTAX_VERSION_MAX 7
#define SYNTAX_VERSION_MAX 8
#define MAX_CARD_SHORT_NAME 32
#define MAX_CARD_LONG_NAME 80