Peter Korsgaard [Wed, 7 Jan 2026 11:00:21 +0000 (12:00 +0100)]
alsaloop: parse_config(): align optstring order with the long options
The 'd' and 'm' options were not in the same order as the long options. Fix
that.
No functional change, but makes it easier to ensure they are kept in sync.
Closes: https://github.com/alsa-project/alsa-utils/pull/317 Signed-off-by: Peter Korsgaard <peter@korsgaard.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Closes: https://github.com/alsa-project/alsa-utils/pull/317 Signed-off-by: Peter Korsgaard <peter@korsgaard.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Peter Korsgaard [Wed, 7 Jan 2026 10:55:00 +0000 (11:55 +0100)]
alsaloop: parse_config(): drop unused 'F' option
It is not documented in the usage info, no corresponding long option and is
not handled in the parsing, so drop it from the optstring.
Closes: https://github.com/alsa-project/alsa-utils/pull/317 Signed-off-by: Peter Korsgaard <peter@korsgaard.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Closes: https://github.com/alsa-project/alsa-utils/pull/317 Signed-off-by: Peter Korsgaard <peter@korsgaard.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
speaker-test: fix segfault with more than 16 channels
get_channel_name() was accessing the channel_name array without bounds
checking. When using more than 16 channels without a channel map, it
would read past the end of the array and crash.
Closes: https://github.com/alsa-project/alsa-utils/pull/319 Signed-off-by: Geoffrey D. Bennett <g@b4.vu> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Rudi Heitbaum [Fri, 20 Feb 2026 11:10:24 +0000 (11:10 +0000)]
aplay, alsactl, topology: 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.
Michael Biebl [Sun, 24 May 2026 01:21:28 +0000 (03:21 +0200)]
Remove more generated files on "make clean"
Closes: https://github.com/alsa-project/alsa-utils/pull/328 Signed-off-by: Michael Biebl <biebl@debian.org> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
aplay: use snprintf instead of sprintf in device_list()
sprintf() does not perform bounds checking. Replace it with snprintf()
using sizeof(name) to follow safer coding practices and make the buffer
size explicit, consistent with how similar fixes have been applied
elsewhere in the codebase
Peter Korsgaard [Wed, 4 Jun 2025 07:35:00 +0000 (09:35 +0200)]
alsaloop: only log xrun debug messages when verbose
Xruns can happen quite often (E.G. continuously when using alsaloop to/from
the UAC gadget driver without a connected host), so only log the debug
messages when verbose logging has been requested to not flood the logs.
Closes: https://github.com/alsa-project/alsa-utils/pull/302 Signed-off-by: Peter Korsgaard <peter@korsgaard.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Jaroslav Kysela [Thu, 1 Jan 2026 17:39:38 +0000 (18:39 +0100)]
alsactl: fix sequence to clean card specific config files for UCM
For UCM, card-specific config files should be removed only when the fixed
boot flag is set or if the card is not the primary card in a given card
group.
Achill Gilgenast [Mon, 24 Nov 2025 14:53:04 +0000 (15:53 +0100)]
configure: Allow systemd service installation without systemd.pc
If the systemdsystemunitdir got passed anyway as a variable, we don't
need the systemd.pc dependency anymore and allow building without a
systemd build-dependency.
Relevant in Alpine Linux, where we allowed systemd services to be
(sub-)packaged (e.g. for downstreams like postmarketOS), but don't have
systemd pacakged in Alpine itself, yet.
Closes: https://github.com/alsa-project/alsa-utils/pull/309 Signed-off-by: Achill Gilgenast <achill@achill.org> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Jaroslav Kysela [Wed, 3 Dec 2025 18:37:01 +0000 (19:37 +0100)]
alsactl: fix state restore to handle dynamic user control elements
Track user control elements separately and adjust control
count difference checking to account for dynamic user elements.
Prevents false positives in re-init detection when only user
controls have changed.
Jaroslav Kysela [Thu, 27 Nov 2025 17:17:14 +0000 (18:17 +0100)]
alsactl: add systemd service to handle deferred card initialization
Add alsa-card-wait@.service to handle cards in waiting state.
Update udev rules to use --export and trigger the wait service
when ALSA_CARD_STATE=waiting. Service runs "alsactl wrestore"
for deferred card initialization.
Jaroslav Kysela [Thu, 27 Nov 2025 16:04:46 +0000 (17:04 +0100)]
alsactl: add -Y option to export card states as key=value pairs
Add export.c with support for exporting card states as key=value pairs.
Exports ALSA_CARD_NUMBER/ALSA_CARD_STATE for single cards, or
ALSA_CARD#_STATE for multiple cards. States: active, skip, waiting.
Add -Y (--export) option to restore command for state export.
This feature is designed for udev IMPORT{program} use.
Jaroslav Kysela [Fri, 21 Nov 2025 11:25:42 +0000 (12:25 +0100)]
alsactl: ucm: implement boot parameters and card group sync infrastructure
Implement boot parameter management for multi-card synchronization.
Add boot_params.c with read/write functions for Boot control element,
card group configuration file support, and validity checking.
Extend init_ucm.c with boot/restore logic and card state handling.
Add -G (group-file) and -m (force-ucm-restore) command line options.
Takashi Iwai [Tue, 28 Oct 2025 12:29:59 +0000 (13:29 +0100)]
amidi: Ignore inactive MIDI ports as default at listing
When listing the devices, currently we show all MIDI ports including
inactive ones. But those inactive ports are rarely useful, and it'd
be more convenient to filter them out.
This patch introduces the filtering of inactive ports at listing
devices via amidi -l option. When user needs to scan all MIDI ports
including inactive ports, pass the new option -x in addition.
Alexander Stein [Thu, 10 Apr 2025 11:01:19 +0000 (13:01 +0200)]
bat: Fix buffer time configuration
By swapping time configuration some hardware constraints can be supported.
Fixes the error: Set parameter to device error: buffer time: 500000
hw:tqmtlv320aic32: Invalid argument(-22)
Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Seppo Ingalsuo [Tue, 14 Jan 2025 14:20:09 +0000 (16:20 +0200)]
Topology: NHLT: Intel: Improve error message for DMIC enable conflict
The DMIC HW does not provide all the freedom that topology
syntax appears to provide for DAI configuration. This change
helps to understand better what the error is about.
Closes: https://github.com/alsa-project/alsa-utils/pull/286 Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Seppo Ingalsuo [Wed, 8 Jan 2025 11:56:46 +0000 (13:56 +0200)]
Topology: NHLT: Intel: Fix mono DMIC configure for MTL platform
This change fixes the blob generator for mono microphone
configuration. As difference to previous platforms the FIFO packer
mono/stereo mode set up in OUTCONTROLx IPM_SOURCE_MODE bit-field.
The previous code version hard-codes the FIFO packer to stereo
mode without support for mono.
As a fix if only one microphone is enabled for dmic0 or dmic1,
then the corresponding IPM_SOURCE_MODE in OUTCONTROL0 or OUTCONTROL1
is set to 0. Otherwise it is set to 1 for stereo mode.
Closes: https://github.com/alsa-project/alsa-utils/pull/286 Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Seppo Ingalsuo [Wed, 15 Jan 2025 13:35:30 +0000 (15:35 +0200)]
Topology: NHLT: Intel: Fix DMA slots config in SSP blob
This fixes a mistake in function ssp_calculate_intern_v30().
The rx_dir[0] and tx_dir[0] value was hard-coded to 0x3 for
typical stereo slots configuration. It should be instead
retrieved from topology parameters for the SSP.
Closes: https://github.com/alsa-project/alsa-utils/pull/289 Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Takashi Iwai [Wed, 8 Jan 2025 07:29:10 +0000 (08:29 +0100)]
aseqdump: Fix typos in messages
The message for a MIDI2 pitch bend event was shown incorrectly as
channel pressure. Fix it.
Also, some MIDI2 note-on events referred to note-off union fields and
those should be corrected, too (although both point to the same
address, hence there is no difference in the outputs).
Aaron Ma [Wed, 20 Nov 2024 07:55:02 +0000 (15:55 +0800)]
alsactl: 90-alsa-restore.rules - fix AMD acp-pdm-mach link
The link name of AMD ACP digital microphones driver acp-pdm-mach
is acp-dmic-codec. Fix it to make UCM initialize it again.
Closes: https://github.com/alsa-project/alsa-utils/pull/281 Fixes: 8116639 ("alsactl: 90-alsa-restore.rules - add support for AMD ACP digital microphone") Signed-off-by: Aaron Ma <aaron.ma@canonical.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Fix the label mismatch which was introduced in the transition from the
temporary test rules.
Closes: https://github.com/alsa-project/alsa-utils/issues/280 Fixes: 8116639 ("alsactl: 90-alsa-restore.rules - add support for AMD ACP digital microphone") Signed-off-by: Jaroslav Kysela <perex@perex.cz>
If *defs == NULL the realloc() will be a simple malloc() and return a
pointer to uninitialized memory. Doing a strcat() to this is bad, so in
that case strcpy() the string into the newly allocated buffer.
This fixes the buffer overflow bug, such as:
*** buffer overflow detected ***: terminated
Program received signal SIGABRT, Aborted.
__pthread_kill_implementation (no_tid=0, signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:44
warning: 44 ./nptl/pthread_kill.c: No such file or directory
(gdb) bt
at ../sysdeps/posix/libc_fatal.c:132
at ./debug/fortify_fail.c:24
dest=dest@entry=0x5555555682c0 "hUUU\005PLATFORM=mtl,PREPROCESS_PLUGINS=nhlt,NHLT_BIN=nhlt-sof-mtl-sdw-cs42l42-l0-max98363-l2-4ch-48k-96k.bin,NUM_DMICS=4,PDM1_MIC_A_ENABLE=1,PDM1_MIC_B_ENABLE=1,DMIC0_ID=3,DMIC1_ID=4,DMIC1_ENABLE=passth"...,
src=src@entry=0x7fffffffe0fa "PLATFORM=mtl,PREPROCESS_PLUGINS=nhlt,NHLT_BIN=nhlt-sof-mtl-sdw-cs42l42-l0-max98363-l2-4ch-48k-96k.bin,NUM_DMICS=4,PDM1_MIC_A_ENABLE=1,PDM1_MIC_B_ENABLE=1,DMIC0_ID=3,DMIC1_ID=4,DMIC1_ENABLE=passthrough"..., destlen=<optimized out>) at ./debug/strcat_chk.c:34
__src=0x7fffffffe0fa "PLATFORM=mtl,PREPROCESS_PLUGINS=nhlt,NHLT_BIN=nhlt-sof-mtl-sdw-cs42l42-l0-max98363-l2-4ch-48k-96k.bin,NUM_DMICS=4,PDM1_MIC_A_ENABLE=1,PDM1_MIC_B_ENABLE=1,DMIC0_ID=3,DMIC1_ID=4,DMIC1_ENABLE=passthrough"...,
__dest=<optimized out>) at /usr/include/x86_64-linux-gnu/bits/string_fortified.h:130
d=0x7fffffffe0fa "PLATFORM=mtl,PREPROCESS_PLUGINS=nhlt,NHLT_BIN=nhlt-sof-mtl-sdw-cs42l42-l0-max98363-l2-4ch-48k-96k.bin,NUM_DMICS=4,PDM1_MIC_A_ENABLE=1,PDM1_MIC_B_ENABLE=1,DMIC0_ID=3,DMIC1_ID=4,DMIC1_ENABLE=passthrough"...,
defs=<synthetic pointer>) at topology.c:400
Closes: https://github.com/alsa-project/alsa-utils/pull/277 Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Jaroslav Kysela [Mon, 11 Nov 2024 14:44:38 +0000 (15:44 +0100)]
alsactl: 90-alsa-restore.rules - add support for AMD ACP digital microphone
The UCM configuration for AMD ACP digital microphones combines HDA analog card
with ASoC AMD ACP digital microphone card. When the ACP microphone card
is detected later than HDA analog card, the UCM initialization for HDA
analog card should be executed again.
Additional changes:
Added --with-alsactl-udev-extra-test argument to handle the tests for
directories. The default value was kept.
Added --alsactl-udev-args argument to pass extra arguments to alsactl
in the udev rule.
Note: The autoconf does not handle correctly spaces so configure
call like 'configure --alsactl-udev-args="-E ENV=abcd"' is not allowed.
Substitue '__' string as ' ' for this reason.
Seppo Ingalsuo [Wed, 17 Jul 2024 16:09:12 +0000 (19:09 +0300)]
Topology: NHLT: Intel: SSP: Handle differences for ACE3.x
- The SSC1 bits 21 and 20, TSRE and RSRE, do not exist.
- The SSC0 bit 30 ACS does not exist.
- The SSC0 bit 6 ECS does not exist but needs to be set, add note.
- The MDIVXCTRL bits 20:21 MNDSS does not exist.
Closes: https://github.com/alsa-project/alsa-utils/pull/276 Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Seppo Ingalsuo [Thu, 18 Apr 2024 15:46:30 +0000 (18:46 +0300)]
Topology: NHLT: Intel: SSP: Always set SSC0 Network mode
The MOD = 1 is the only allowed setting for SSC0(31) bit for
cAVS 2.x and all ACE versions 1.x, 2.x, and 3.x
Closes: https://github.com/alsa-project/alsa-utils/pull/276 Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Seppo Ingalsuo [Mon, 15 Apr 2024 10:26:51 +0000 (13:26 +0300)]
Topology: NHLT: Intel: SSP: Add support for blob format
This patch adds the 3.0 format that is used for the PTL
ACE3.x platform. Blob 3.0 is based on blob 1.5 but it adds
DMA control registers settings and has some changes in
registers bitfields.
This patch also fixes some compile warnings when NHLT_DEBUG is
set for comparing int with unsigned in ssp-debug.c for code for
all blobs variants.
Closes: https://github.com/alsa-project/alsa-utils/pull/276 Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Takashi Iwai [Tue, 20 Aug 2024 07:40:21 +0000 (09:40 +0200)]
aseqdump: Add missing dump of UMP Set Key Signature Message
The handling of Set Key Signature message of the Flex Data type was
missing by some reason. Now the definition was added in alsa-lib
ump_msg.h, so let's show the contents.
Marc Herbert [Thu, 1 Aug 2024 01:34:50 +0000 (18:34 -0700)]
gitcompile: restore ACLOCAL_FLAGS ability to use
Fixes cryptic "error macro 'AM_PATH_ALSA' not found in library
configure.ac:22" when attempting a local install as described at
https://thesofproject.github.io/latest/getting_started/build-guide/build-from-scratch.html#build-alsa-lib-and-alsa-utils-from-source
Fixes giant commit f9e6010d5ec7 ("topology: plugins - add Intel nhlt
encoder plugin") which added a second invocation of `aclocal` in 2021
but forgot the extra `$alsa_m4_flags`.
To avoid duplication, do not fix by adding the missing `$alsa_m4_flags`
to the second aclocal invocation. Instead, drop that variable and append
`-I ../alsa-lib/utils` directly to $ACLOCAL_FLAGS
Closes: https://github.com/alsa-project/alsa-utils/pull/272 Signed-off-by: Marc Herbert <marc.herbert@intel.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Peter Ujfalusi [Mon, 22 Jul 2024 06:03:00 +0000 (09:03 +0300)]
aplay: Print '=== PAUSE ===' only if it is supported
Instead of printing the '=== PAUSE ===' unconditionally before calling
do_pause(), move it to the function and only print it if the stream can
be paused.
If the stream cannot be paused that the '=== PAUSE ===' will be replaced
by `PAUSE command ignored (no hw support)` immediately, which is not
observable by users but automation scripts will catch the '=== PAUSE ==='
and might think that the stream is indeed got paused.
Move the print into do_pause() function after the snd_pcm_pause() have
returned without error to make sure it is only printed if the stream is
paused and we are waiting for the pause release from user to proceed.
Closes: https://github.com/alsa-project/alsa-utils/pull/271 Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
topology: pre-processor: Introduce a new feature for subtree
Introduce a new kyword "SubTreeCopy" for extneding existing conf nodes
with additional nodes. This feature is useful for extending previous
pipeline class definitions with the addition of one or more widgets
without having to duplicate everything in the new class definition.
For example: Consider a pipeline class definition as below. Note that
only the widgets & routes are shown here.
Note that the target is left undefined, which means that the newly
created subtree will be merged to the parent node that contains the
"SubTreeCopy" node i.e. in this case
Class.Pipeline.mixout-gain-eqiir-eqfir-dai-copier-playback".
But if we want to modify an existing pipeline class while modifying the
order of widgets and/or inserting new widgets, we should use the type
"override" instead. This allows for adding new widgets to the list of
widgets in the base class definition while also allowing overriding the
routes to allow inserting the new widgets and reordering the widgets in
the base class. For example, if we want to add a drc widget between the
gain and the eqiir modules in the above class, we can do the following:
Class.Pipeline.mixout-efx-dai-copier-playback {
# This copy will override all widgets/routes in the base class
SubTreeCopy.baseclass {
source "Class.Pipeline.mixout-gain-eqiir-eqfir-dai-copier-playback"
target "Class.Pipeline"
type override
# Explicitly copy the widgets from the base class now
SubTreeCopy.widgets {
source "Class.Pipeline.mixout-gain-eqiir-eqfir-dai-copier-playback.Object.Widget"
target "Class.Pipeline.mixout-efx-dai-copier-playback.Object.Widget"
}
}
Closes: https://github.com/alsa-project/alsa-utils/pull/268 Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Add the support for yet more UMP messages. UMP Mixed Data Set
messages are the generic data containers withe the message type 5
(shared with 8-bit SysEx).
aseqdump: Avoid OOB access with broken SysEx UMP packets
UMP SysEx messages have length field to specify the contained data
bytes, but they can be over the actual packet size. Add the proper
size limit checks for avoiding the access overflow.
Add a new option -u to specify the UMP MIDI1 or MIDI2 mode. As
default (-u 0), the program reads the legacy MIDI 1.0 byte stream,
while in UMP mode, it reads as UMP packets and send to the target.
The UMP packet bytes are encoded in big endian.