Commit graph

4674 commits

Author SHA1 Message Date
Rudi Heitbaum
804a86f0e3
Merge 757f3a86c9 into 62c24074ae 2026-03-19 10:14:07 +08:00
Huang Yunxuan
62c24074ae ucm: fix optional include
Some checks failed
Build alsa-lib / fedora_latest_build (push) Has been cancelled
Build alsa-lib / ubuntu_last_build (push) Has been cancelled
The path is not an absolute path and can't be used with `access()`.
Let's call `uc_mgr_config_load_file()` directly and mask acceptable
error numbers.

Closes: https://github.com/alsa-project/alsa-lib/pull/499
Signed-off-by: Huang Yunxuan <hyx0329@outlook.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2026-03-18 15:42:20 +01:00
Rudi Heitbaum
757f3a86c9 seq: fix discards const from pointer target
Since glibc-2.43:

For ISO C23, the functions bsearch, memchr, strchr, strpbrk, strrchr,
strstr, wcschr, wcspbrk, wcsrchr, wcsstr and wmemchr that return pointers
into their input arrays now have definitions as macros that return a
pointer to a const-qualified type when the input argument is a pointer
to a const-qualified type.

https://lists.gnu.org/archive/html/info-gnu/2026-01/msg00005.html

Signed-off-by: Rudi Heitbaum <rudi@heitbaum.com>
2026-02-20 11:31:51 +00:00
Rudi Heitbaum
a7ef4c9ea4 ucm: fix discards const from pointer target
Since glibc-2.43:

For ISO C23, the functions bsearch, memchr, strchr, strpbrk, strrchr,
strstr, wcschr, wcspbrk, wcsrchr, wcsstr and wmemchr that return pointers
into their input arrays now have definitions as macros that return a
pointer to a const-qualified type when the input argument is a pointer
to a const-qualified type.

https://lists.gnu.org/archive/html/info-gnu/2026-01/msg00005.html

Signed-off-by: Rudi Heitbaum <rudi@heitbaum.com>
2026-02-20 11:31:27 +00:00
Rudi Heitbaum
2769a6f407 conf: fix discards const from pointer target
Since glibc-2.43:

For ISO C23, the functions bsearch, memchr, strchr, strpbrk, strrchr,
strstr, wcschr, wcspbrk, wcsrchr, wcsstr and wmemchr that return pointers
into their input arrays now have definitions as macros that return a
pointer to a const-qualified type when the input argument is a pointer
to a const-qualified type.

https://lists.gnu.org/archive/html/info-gnu/2026-01/msg00005.html

Signed-off-by: Rudi Heitbaum <rudi@heitbaum.com>
2026-02-20 11:31:02 +00:00
Jaroslav Kysela
d8ca4a7cc4 ucm: add show_err parameter to uc_mgr_get_variable
Add bool show_err parameter to uc_mgr_get_variable() to control whether
an error message is displayed when a variable is not defined. This
centralizes error reporting and eliminates redundant error messages
in callers.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2026-02-18 13:30:29 +01:00
Jaroslav Kysela
a74521f371 ucm: find-card,find-device - add UCM variable support for arguments (Syntax 9)
Add variable support for all lookup arguments in find-card and find-device
substitutions. Variables are identified by $ prefix and only enabled for
Syntax 9+ to maintain backward compatibility.

Modified arguments with variable support:
- find-card: field, regex
- find-device: type, field, stream, regex

Example usage:
  ${find-card:field=$FieldName,regex=$Pattern,return=number}
  ${find-device:type=$DevType,stream=$StreamType,field=$FieldName,regex=$Pattern}

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2026-02-18 13:29:33 +01:00
Jaroslav Kysela
c5d903b0b4 ucm: add info-card substitution (Syntax 9)
Implement ${info-card:} substitution to retrieve specific fields from
a card's information structure by card number or ID. Unlike ${find-card:}
which searches through cards using regex, ${info-card:} directly queries
a specific card.

Arguments:
  card=<STR>   card number or card ID (string identifier)
  field=<STR>  number, id, driver, name, longname, mixername, components

Allow card and field parameters to reference UCM variables by prefixing
with $ character. When the first character is $, the value is resolved
using uc_mgr_get_variable().

Example usage:
  ${info-card:card=$MyCard,field=$MyField}

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2026-02-18 12:21:52 +01:00
Jaroslav Kysela
1823b4cd4b control: remap - fix memory leak in remap_load_list()
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2026-02-12 11:15:55 +01:00
Jaroslav Kysela
22225a4ec6 ucm: evaluate Repeat block before If block (Syntax 9)
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2026-02-06 19:33:08 +01:00
Jaroslav Kysela
c41f795f5c ucm: allow string with substitution for If.Condition block (Syntax 9)
When If.Condition is a string type instead of compound, parse it using
snd_config_load_string with variable substitution support for syntax v9+.
This allows more flexible condition definitions using variable references.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2026-02-06 19:32:31 +01:00
Jaroslav Kysela
30d1ae7221 ucm: optimize if_eval_string with common comparison helper
Refactor if_eval_string() to eliminate code duplication by introducing
a compare_strings() helper function that handles the common pattern of
retrieving, substituting, and comparing string pairs.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2026-02-06 19:32:31 +01:00
Jaroslav Kysela
27aa3e41ef ucm: add Repeat block - repetitive pattern substitution (Syntax 9)
Implements Repeat blocks for generating repetitive configuration patterns
with variable substitution. This feature allows applying a configuration
block multiple times with different variable values, significantly reducing
duplication in UCM configuration files.

iterator abstraction allows easy extension for future pattern types.

Example:

  Repeat.VolumeInit {
    Pattern {
      Variable 'ch'
      Type Integer
      First 0
      Last 7
      Step 1
    }
    Apply {
      cset "name='PCM Channel ${var:ch} Volume' 100%"
    }
  }

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2026-02-06 19:32:28 +01:00
Jaroslav Kysela
2943b1e412 ucm: add integer comparison condition (Syntax 9)
Adds support for integer comparison operations in If.Condition blocks.
Supports operators: ==, !=, <, >, <=, >= for comparing integer values.
Both values are substituted and converted from strings to 64-bit integers.
Hexadecimal (C like) strings are also accepted (like 0x1234).

Example usage:
  If.check_channels {
    Condition {
      Type Integer
      Operation ">"
      Value1 "${var:channels}"
      Value2 "2"
    }
    True { ... }
  }

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2026-02-06 18:27:37 +01:00
Jaroslav Kysela
e02e9dc6cf ucm: substitute define IDs and macro arguments (Syntax 9)
It is useful to substitute the variable names and string
macro arguments. It may simplify the UCM configurations.

E.g.:

  Define."${var:Name} Suffix" "Value"
  Macro.a.DoIt "Channels=${var:PlaybackChannels}"

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2026-02-05 17:35:55 +01:00
Jaroslav Kysela
5414277612 ucm: fix invalid pointer dereference in parse_open_variables()
Some checks failed
Build alsa-lib / fedora_latest_build (push) Has been cancelled
Build alsa-lib / ubuntu_last_build (push) Has been cancelled
When the string with variables is not parseable, do not
try to free invalid cfg pointer.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2026-02-04 18:43:59 +01:00
Jaroslav Kysela
ebf2efae0a control: remap - cosmetic code reorganization
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2026-02-04 18:42:56 +01:00
Jaroslav Kysela
166407dae4 control: remap - fix numid lookup issue
Some checks are pending
Build alsa-lib / fedora_latest_build (push) Waiting to run
Build alsa-lib / ubuntu_last_build (push) Waiting to run
The 'amixer controls' and 'amixer cget numid=' combo was not working
correctly when the remapping was active. This assert was trigerred:

amixer: control.c:427: snd_ctl_elem_info: Assertion `ctl && info && (info->id.name[0] || info->id.numid)' failed

All elements must be loaded and mapping created to build
the numid -> fullid link.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2026-02-03 17:46:02 +01:00
Jaroslav Kysela
5f7fe33002 topology: decoder - add boundary check for channel mixer count
Some checks failed
Build alsa-lib / fedora_latest_build (push) Has been cancelled
Build alsa-lib / ubuntu_last_build (push) Has been cancelled
Malicious binary topology file may cause heap corruption.

CVE: CVE-2026-25068

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2026-01-29 16:55:49 +01:00
Jaroslav Kysela
bc332f4211 control: ctlparse - make numid parsing more robust
Also correct the last amixer stderr printf to snd_error().

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2026-01-29 15:34:23 +01:00
Jaroslav Kysela
7887fbc6f0 ucm: libconfig parser - fix pathname for substituted file
Some checks failed
Build alsa-lib / fedora_latest_build (push) Has been cancelled
Build alsa-lib / ubuntu_last_build (push) Has been cancelled
The path name substituted file contents and normal file contents
should be handled similary. Use correct function determining
the right base directory name.

Fixes: 8f5779eb ("ucm: add LibraryConfig support")
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2026-01-26 15:10:46 +01:00
Jaroslav Kysela
75ed5f05ba Release v1.2.15.3
Some checks failed
Build alsa-lib / fedora_latest_build (push) Has been cancelled
Build alsa-lib / ubuntu_last_build (push) Has been cancelled
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2026-01-13 08:12:40 +01:00
Jaroslav Kysela
805464c7bd seq: return back old snd_seq_drain_output behaviour for -EAGAIN
It seems that many applications did not follow the documentation
including pyalsa sequencer module, thus return the previous
behaviour and correct documentation.

Closes: https://github.com/alsa-project/alsa-lib/issues/493
Fixes: b97a11ec ("seq: fix snd_seq_drain_output return value for partial drain")
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2026-01-13 08:09:47 +01:00
Jaroslav Kysela
63a981865a Release v1.2.15.2
Some checks failed
Build alsa-lib / fedora_latest_build (push) Has been cancelled
Build alsa-lib / ubuntu_last_build (push) Has been cancelled
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2026-01-08 15:27:57 +01:00
Jaroslav Kysela
b3bc2b4fee Makefile: remove dist-hook and remove tar option 'follow symlinks'
Some checks are pending
Build alsa-lib / fedora_latest_build (push) Waiting to run
Build alsa-lib / ubuntu_last_build (push) Waiting to run
The dist-hook is not required for latest automake. It was
introduced in 2000, so the things were hopefully fixed now.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2026-01-08 14:51:15 +01:00
Jaroslav Kysela
50b532de79 ucm: add some traces for the config filenames
It is handy to see the path names in the loading chain.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2026-01-08 13:56:48 +01:00
Jaroslav Kysela
8bea4b13d1 error: fix the "return old snd_lib_error_set_handler() behaviour"
The variable arguments must be handled differently. Add a conversion
routine which use the original argument call convention.

Fixes: f55eece8 ("error: return old snd_lib_error_set_handler() behaviour")
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2026-01-08 13:19:45 +01:00
Jaroslav Kysela
a37b8b9377 error: fix indendation in snd_lib_log_filter()
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2026-01-07 17:48:40 +01:00
Jaroslav Kysela
f55eece85c error: return old snd_lib_error_set_handler() behaviour
Unfortunately, the case when the old application sets
own error callback using the old method, was not handled
properly in snd_lib_vlog_default() function.

Make sure that only error messages are passed to this
old callback and silent other log priorities.

Link: https://bugs.gentoo.org/968131
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2026-01-07 17:48:39 +01:00
Jaroslav Kysela
731d5fb9d8 Release v1.2.15.1
Some checks failed
Build alsa-lib / fedora_latest_build (push) Has been cancelled
Build alsa-lib / ubuntu_last_build (push) Has been cancelled
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2025-12-19 11:31:58 +01:00
Jaroslav Kysela
f30c355278 conf: cards: unify whitespace - use tabs and remove trailing spaces
Some checks failed
Build alsa-lib / fedora_latest_build (push) Has been cancelled
Build alsa-lib / ubuntu_last_build (push) Has been cancelled
Convert leading spaces to tabs for consistent indentation,
remove trailing whitespace from all lines, and normalize
file endings across all card configuration files.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2025-12-10 16:50:28 +01:00
Jaroslav Kysela
17ffe17f03 conf: pistachio-card: define pcm configuration block only one time
There may be multiple pistachio-card soundcards in the system. Overwrite
the PCM configurations when loaded multiple times.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2025-12-10 16:36:21 +01:00
Jaroslav Kysela
29fa26b4b5 conf: YMF744: define pcm configuration block only one time
There may be multiple YMF744 soundcards in the system. Overwrite
the PCM configurations when loaded multiple times.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2025-12-10 16:36:21 +01:00
Jaroslav Kysela
4bcd33ef9d conf: VX222,VXPocket: define pcm configuration block only one time
There may be multiple VX soundcards in the system. Overwrite
the PCM configurations when loaded multiple times.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2025-12-10 16:36:21 +01:00
Jaroslav Kysela
d6b9d7e0be conf: VIA686A,VIA82xx: define pcm configuration block only one time
There may be multiple VIA soundcards in the system. Overwrite
the PCM configurations when loaded multiple times.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2025-12-10 16:36:20 +01:00
Jaroslav Kysela
4c74f3a568 conf: TRID4DWAVENX: define pcm configuration block only one time
There may be multiple TRID4DWAVENX soundcards in the system. Overwrite
the PCM configurations when loaded multiple times.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2025-12-10 16:36:20 +01:00
Jaroslav Kysela
51d75e5f07 conf: SI7018: define pcm configuration block only one time
There may be multiple SI7018 soundcards in the system. Overwrite
the PCM configurations when loaded multiple times.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2025-12-10 16:36:20 +01:00
Jaroslav Kysela
1cd87775c5 conf: SB-XFi: define pcm configuration block only one time
There may be multiple SB-XFi soundcards in the system. Overwrite
the PCM configurations when loaded multiple times.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2025-12-10 16:36:20 +01:00
Jaroslav Kysela
f03528daf2 conf: RME96[35][26]: define pcm configuration block only one time
There may be multiple RME96[35][26] soundcards in the system. Overwrite
the PCM configurations when loaded multiple times.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2025-12-10 16:36:20 +01:00
Jaroslav Kysela
8340b3c6b3 conf: PS3: define pcm configuration block only one time
There may be multiple PS3 soundcards in the system. Overwrite
the PCM configurations when loaded multiple times.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2025-12-10 16:36:20 +01:00
Jaroslav Kysela
a3028a492a conf: PMac,PMacToonie: define pcm configuration block only one time
There may be multiple PMac soundcards in the system. Overwrite
the PCM configurations when loaded multiple times.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2025-12-10 16:36:20 +01:00
Jaroslav Kysela
3d636ff530 conf: PC-Speaker: define pcm configuration block only one time
There may be multiple PC-Speaker soundcards in the system. Overwrite
the PCM configurations when loaded multiple times.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2025-12-10 16:36:20 +01:00
Jaroslav Kysela
ebb5ab7d84 conf: NFORCE: define pcm configuration block only one time
There may be multiple NFORCE soundcards in the system. Overwrite
the PCM configurations when loaded multiple times.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2025-12-10 16:36:20 +01:00
Jaroslav Kysela
de72d65728 conf: Maestro3: define pcm configuration block only one time
There may be multiple Maestro3 soundcards in the system. Overwrite
the PCM configurations when loaded multiple times.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2025-12-10 16:36:20 +01:00
Jaroslav Kysela
ff4fb7f8c9 conf: Loopback: define pcm configuration block only one time
There may be multiple Loopback soundcards in the system. Overwrite
the PCM configurations when loaded multiple times.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2025-12-10 16:36:20 +01:00
Jaroslav Kysela
99f1987a1e conf: ICH,ICH4,ICH-MODEM: define pcm configuration block only one time
There may be multiple ICH soundcards in the system. Overwrite
the PCM configurations when loaded multiple times.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2025-12-10 16:36:20 +01:00
Jaroslav Kysela
1f52b57ff8 conf: ICE17[12][24]: define pcm configuration block only one time
There may be multiple ICE17[12][24] soundcards in the system. Overwrite
the PCM configurations when loaded multiple times.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2025-12-10 16:36:20 +01:00
Jaroslav Kysela
dded72a687 conf: HdmiLpeAudio: define pcm configuration block only one time
There may be multiple HdmiLpeAudio soundcards in the system. Overwrite
the PCM configurations when loaded multiple times.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2025-12-10 16:36:20 +01:00
Jaroslav Kysela
a87570df72 conf: GUS: define pcm configuration block only one time
There may be multiple GUS soundcards in the system. Overwrite
the PCM configurations when loaded multiple times.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2025-12-10 16:36:20 +01:00
Jaroslav Kysela
ea93979929 conf: FWSpeakers: define pcm configuration block only one time
There may be multiple FWSpeakers soundcards in the system. Overwrite
the PCM configurations when loaded multiple times.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2025-12-10 16:36:20 +01:00