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>
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.
Example:
configure --with-alsactl-udev-args="-E__ENV=abcd" \
--with-alsactl-udev-extra-test='TEST=="/abcd",__TEST=="/xyz",'
Closes: https://github.com/alsa-project/alsa-utils/issues/278
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
- 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>
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>
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>
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.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
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 f9e6010d5e ("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>
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>
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.
Class.Pipeline.mixout-gain-dai-copier-playback {
Object.Widget {
mixout."1" {}
dai-copier."1" {}
gain."1" {}
pipeline."1" {}
}
Object.Base {
!route [
{
source mixout.$index.1
sink gain.$index.1
}
]
}
}
If we want to extend this pipeline with the addition of an eqiir/eqfir,
we can create a SubTreeCopy node with type extend as follows:
Class.Pipeline.mixout-gain-eqiir-eqfir-dai-copier-playback {
SubTreeCopy.baseclass {
source "Class.Pipeline.mixout-gain-dai-copier-playback"
type extend
tree {
Object.Widget {
eqiir.1 {}
eqfir.1 {}
}
Object.Base {
!route [
{
source gain.$index.1
sink eqiir.$index.1
}
{
source eqiir.$index.1
sink eqfir.$index.1
}
]
}
}
}
}
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
tree {
Object.Widget {
drc.1 {}
}
Object.Base {
!route [
{
source mixout.$index.1
sink gain.$index.1
}
{
source gain.$index.1
sink drc.$index.1
}
{
source drc.$index.1
sink eqiir.$index.1
}
{
source eqiir.$index.1
sink eqfir.$index.1
}
]
}
}
}
# 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).
Signed-off-by: Takashi Iwai <tiwai@suse.de>
For simplifying code, use the new helper function snd_ump_get_byte()
for extracting a byte data for SysEx and co.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
UMP 7-bit SysEx can hold up to 6 bytes, not 14 bytes.
Fixes: 02b0c3af56 ("aseqdump: Avoid OOB access with broken SysEx UMP packets")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
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.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Add the support to dump UMP 8-bit SysEx messages.
A slight code refactoring to share the code snippet between 7bit and
8bit SysEx handling, too.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Use the standard MIDI event encoder function provided in alsa-lib and
simplify the code. We can reduce a lot of lines.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Move the low-level API function call to init_seq() instead of calling
directly from main(). Just a code refactoring.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Make man page a bit nicer; reformatting and setting bold/italic
properly, typo fixes, and adding a few more words and sections.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
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.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Show the event prefix "SysEx" for UMP SysEx data. Otherwise it's
difficult to know what it is.
Fixes: 506097ebb1 ("aseqdump: Show UMP SysEx messages")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Since the required alsa-lib version was bumped and the relevant code
cleanup, some conditionals are no longer referred. Drop them.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
New features such as MIDI 2.0 should be always enabled for the
builds. Update the dependency to alsa-lib 1.2.12.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
The printf format for a normalized velocity in MIDI2 mode had a typo,
resulting in a bogus value. Fix it.
Fixes: 7e9bebad0b199 ("aseqdump: Add options to switch view mode")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Enhance aseqdump to interpret more UMP messages. Now it includes the
standard Stream messages and Flex Data messages.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
So far, aplaymidi2 passes the MIDI1/MIDI2 channel voice UMP messages
to the target while processing other UMP messages internally. But
sometimes we'd like to pass all UMP messages as is and let the
receiver processes.
This patch adds a new option -a (or --passall) to pass the all UMP
packets included in the given MIDI Clip file to the target as-is.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
The current code didn't proceed the text position buffer and the text
was always truncated in 12 bytes. Let's fix it.
Fixes: 74daf3a93a ("arecordmidi2: Add options to put meta data texts")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
For convenience, add more options to embed the meta data texts given
via command line. The song name etc can be given directly via the
respective option directly, e.g. --song="text..."
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Allow to add arbitrary profile UMP data to be put into the
configuration of the recorded stream via --profile option.
The file must contain valid UMP data encoded in big-endian.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
When the output file is '-', it's recorded to stdout.
For avoiding the corruption, this mode also suppresses the messages to
stdout, too, which can be enabled also via -s / --silent option.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This reverts commit e609d66807.
It turned out that the failure was rather in alsa-lib API; the
input and output have been incorrectly implemented.
Now that the alsa-lib code got fixed, let's revert the bad fix.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Now aplaymidi2 shows the meta data texts embedded in Flex Data
messages such as copyright and lyrics. The text output isn't
synchronized yet with the actual position, though.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
The inactive port should have been shown in each port line instead of
the client name line.
Fixes: 64b1d486b1 ("aconnect: Add UMP support")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
The recorded tick is incorrectly converted for 1us tempo-base on the
old kernels. Since we correct the queue tempo, we don't have to
adjust the returned tick value any longer. The current code applies
it doubly, resulting in 100 times slower.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
The direction was wrongly passed to the FB setup. It has to be
"OUTPUT" instead of "INPUT, so that other applications can write to
arecordmidi2 port.
Fixes: 2cdf5ebedb ("arecordmidi2: Add initial version")
Signed-off-by: Takashi Iwai <tiwai@suse.de>