John K. Luebs [Sun, 7 Jan 2024 19:33:33 +0000 (13:33 -0600)]
aplaymidi: Set event completely for tempo event
After UMP support was added in b399fb8 ev.type setting was inadvertently
dropped in the code path handling tempo meta event.
This is causing tempo meta events to not be handled at all.
Moreover, snd_seq_ev_set_fixed is also missing so MIDI files with
variable events such as SYSEX before the tempo meta event usually are
causing a segfault.
When the '-v' or '--test-position' options are used, the 'tstamp' is
shown as zero. Unconditionally enable the timestamps and choose the
timestamp time based on the 'monotonic' variable.
aplay: log pcm status before reporting a fatal error
When the --fatal-errors happen, nothing is provided to the user even
when the '-v' verbose option is specified. This patch adds the fatal
error exit after dumping the logs. No functionality change, just
better information on what just happened.
Closes: https://github.com/alsa-project/alsa-utils/pull/242 Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Cezary Rojewski [Fri, 4 Aug 2023 08:26:50 +0000 (10:26 +0200)]
aplay: Add option for specifying subformat
Make subformat first-class citizen by allowing users to specify it just
like it is the case for the format. Default to SND_PCM_SUBFORMAT_STD so
they are no surprises.
Closes: https://github.com/alsa-project/alsa-utils/pull/228 Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Tianyi Liu [Tue, 21 Nov 2023 15:19:35 +0000 (23:19 +0800)]
misc: fix incorrect usages of `strerror`
`strerror` takes the `errno` directly as its argument,
negating it will result in an "Unknown error".
This fixes such usages across multiple modules.
Fixes: https://github.com/alsa-project/alsa-utils/pull/245 Signed-off-by: Tianyi Liu <i.pear@outlook.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Mingjie Shen [Wed, 6 Dec 2023 21:09:58 +0000 (16:09 -0500)]
aplay: fix buffer overflow and tainted format string
Prior this commit, memcpy from names[0] to format[] will overwrite if
strlen(names[0]) is greater than 1024. Also, the length of malloc()ed
names[channel] is insufficient, leading to another buffer overwriting
when calling sprintf(). Moreover, the format string of sprintf()
can be controlled by user input. An attacker can exploit this weakness
to crash the program, disclose information or even execute arbitrary
code.
Fix by allocating enough space for arrays and using constant expressions
as the format strings.
Fixes: https://github.com/alsa-project/alsa-utils/pull/246/ Signed-off-by: Mingjie Shen <shen497@purdue.edu> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Andy Ross [Thu, 7 Dec 2023 17:17:57 +0000 (09:17 -0800)]
nhlt: Revert SSP_ANALOG device_type field
This partially reverts commit 3a47ef2487ed ("topology: nhlt: intel:
support more device types and directions"), which changed the default
device_type in the endpoint descriptor from zero to SSP_ANALOG.
This change breaks the Linux kernel NHLT parser (which AFAICT doesn't
recognize SSP_ANALOG at all), producing errors like:
[56458.583812] sof-audio-pci-intel-mtl 0000:00:1f.3: no matching blob for sample rate: 48000 sample width: 32 channels: 2
[56458.583833] sof-audio-pci-intel-mtl 0000:00:1f.3: failed to prepare widget dai-copier.SSP.SSP0-Codec.playback
[56458.583840] sof-audio-pci-intel-mtl 0000:00:1f.3: Failed to prepare connected widgets
[56458.583847] sof-audio-pci-intel-mtl 0000:00:1f.3: error: failed widget list set up for pcm 1 dir 0
[56458.583853] sof-audio-pci-intel-mtl 0000:00:1f.3: ASoC: error at snd_soc_pcm_component_hw_params on 0000:00:1f.3: -22
Revert for compatibility.
Fixes: https://github.com/alsa-project/alsa-utils/pull/248 Signed-off-by: Andy Ross <andyross@google.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Sam James [Thu, 7 Sep 2023 20:24:16 +0000 (21:24 +0100)]
nhlt: use stdint.h types
u_int_* aren't standard, but uint* are. Use those instead for musl compat.
Closes: https://github.com/alsa-project/alsa-utils/pull/234
Bug: https://bugs.gentoo.org/913758 Signed-off-by: Sam James <sam@gentoo.org> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
bat: really skip analysis of the first period and update related comment
Prior to this change bat/analyze.c would skip the last period of the recording, contrary to
what the comment in the code which stated the first period was meant to be skipped.
The comment has been updated to state that both the first and last period are skipped and the code
has been updated to match.
Closes: https://github.com/alsa-project/alsa-utils/pull/237 Signed-off-by: Delio Brignoli <dbrignoli@audioscience.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Bernd Kuhls [Fri, 13 Oct 2023 18:32:32 +0000 (20:32 +0200)]
configure.ac: fix UMP support detection
https://github.com/alsa-project/alsa-utils/commit/b399fb85a919636b7da34e8bcf17f484dd9046f7
added usage of alsa/ump_msg.h without checking whether alsa-lib was
compiled with rawmidi support:
https://github.com/alsa-project/alsa-lib/blob/master/include/Makefile.am#L37
Fixes a build error when alsa-lib was compiled with --disable-rawmidi
aplaymidi.c:34:10: fatal error: alsa/ump_msg.h: No such file or directory
34 | #include <alsa/ump_msg.h>
Closes: https://github.com/alsa-project/alsa-utils/pull/240 Signed-off-by: Bernd Kuhls <bernd@kuhls.net> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Fixes: https://github.com/alsa-project/alsa-utils/issues/238 Signed-off-by: Michael Opdenacker <michael.opdenacker@bootlin.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This solves an issue compiling with the musl libc.
Fixes: https://github.com/alsa-project/alsa-utils/issues/239 Signed-off-by: Michael Opdenacker <michael.opdenacker@bootlin.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Rudi Heitbaum [Mon, 15 May 2023 16:27:59 +0000 (02:27 +1000)]
alsactl: fix compilation when building in a subdir
Fixes: 613372d Fixes: cff2d1c
Compile errors when building in a subdir:
alsactl/alsactl.c:33:10: fatal error: os_compat.h: No such file or directory
33 | #include "os_compat.h"
| ^~~~~~~~~~~~~
alsactl/lock.c:34:10: fatal error: os_compat.h: No such file or directory
34 | #include "os_compat.h"
| ^~~~~~~~~~~~~
Fixes: https://github.com/alsa-project/alsa-utils/pull/213 Signed-off-by: Rudi Heitbaum <rudi@heitbaum.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Takashi Iwai [Mon, 28 Aug 2023 14:36:17 +0000 (16:36 +0200)]
aseqdump: Add options to switch view mode
This patch adds to switch the operation mode of aseqdump to specify
how the values are shown. Namely, it allows to show the MIDI 2.0
values in two more different ways: compatible "normalized" view and
percentage view, in addition to the default "raw" view.
The "raw" view mode just shows the value found in the event almost as
is. The MIDI 2.0 values are shown in 16 or 32bit hex numbers.
The channel and UMP group numbers are 0-based, taking from 0 to 15.
OTOH, in the normalized view, the 16bit or 32bit velocity and data
values of MIDI 2.0 are normalized to the value fit in MIDI 1.0,
i.e. from 0 to 127, but with decimal points. Similarly, the pitch
wheel values are normalized between -8192 to 8191.
Also, the channel numbers and UMP group numbers are 1-based, taking
from 1 to 16.
In the percentage view, the velocity and data values are normalized
and shown in percentage, from 0% to 100%. The pitch wheel is
normalized from -100% to 100%. The channel and UMP groups are 1-based
as well as in normalized view mode.
Correct the wrong value shown in MIDI2 default output (status instead
of channel). Also adjust the printf formats to use %2d consistently
for the channel numbers.
aseqdump: Align outputs of UMP MIDI 1.0 with legacy MIDI 1.0
The outputs from UMP MIDI 1.0 are slightly differently shown as the
legacy MIDI 1.0 (the velocities and values are in hex), which is
rather confusing. Let's make them look more similar.
Jaska Uimonen [Tue, 30 May 2023 14:09:13 +0000 (17:09 +0300)]
topology: plugins: nhlt: remove dmic error print
Remove "fs not set" print from dmic processing. The message is printed out
when pdm is enabled but not configured. Many sof topologies enable all
pdms even if not used as it is a requirement for some Intel firmware
versions to work correctly.
Fixes: https://github.com/alsa-project/alsa-utils/pull/218 Signed-off-by: Jaska Uimonen <jaska.uimonen@intel.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Seppo Ingalsuo [Fri, 21 Apr 2023 11:07:33 +0000 (14:07 +0300)]
Topology: NHLT: Intel: Update DMIC FIR coefficients
The previous version contained some hand edit mistakes those
impacted the filter frequency response. The used generator script
is found from directory:
Brent Lu [Tue, 25 Jul 2023 14:58:17 +0000 (22:58 +0800)]
topology: nhlt: intel: support more device types and directions
In current NHLT table the device type of all SSP endpoints are set to
BT Sideband(0) instead of SSP Analog Codec(4) and the direction only
supports Render(0) and Capture(1).
Here we introduce two new quirks from topology to set the device type
correctly and support two more directions: Render with loopback(2)
and Feedback for render(3) for speakers with echo reference or IV
sense feedback.
Fixes: https://github.com/alsa-project/alsa-utils/pull/226 Signed-off-by: Brent Lu <brent.lu@intel.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
The CombineArrays definition is an array so that multiple combinations can
be specified in order to deal with only valid combinations. For example,
16-bit bit_depth is only valid with 16-bit valid_bit_depth. So if we
also want to add those combinations with the multiple rates, the
definition would look like:
Takashi Iwai [Wed, 22 Mar 2023 07:55:10 +0000 (08:55 +0100)]
aplaymidi: Add UMP support
By switching via the new option -u, aplaymidi can behave as a UMP
client and output UMP packets instead of legacy sequencer events.
As of now, the only supported version is 1.
Takashi Iwai [Wed, 22 Mar 2023 07:45:54 +0000 (08:45 +0100)]
aconnect: Add UMP support
This patch extends the aconnect program for supporting UMP.
Now the verbose output can show the UMP client version.
Also, a new option -a is added to control the behavior whether to show
the all ports including the inactive ports or not. As default, only
the active ports are shown, but UMP clients allow to hide some ports
as inactive.
Takashi Iwai [Thu, 17 Nov 2022 16:48:23 +0000 (17:48 +0100)]
aseqdump: Add UMP support
Add the support for showing the UMP events to aseqdump.
With the new option -u, the program can start as a UMP sequencer
client and receive UMP events instead of the legacy MIDI events.
Also, the automatic event conversion among legacy and UMP clients can
be suppressed by the new -r option, too.
Jaroslav Kysela [Tue, 16 May 2023 13:38:24 +0000 (15:38 +0200)]
nhlt: add nhlt-dmic-info utility
The microphone arrays for Intel platforms are described in the
ACPI NHLT table. This table is available in sysfs. Parse this
information and use a more common format (json) for output. This
information is usable for the further DSP processing.
alsa-info.sh: uname - reduce execs by four, and eliminate a logic bug
Per `info uname`, `uname` always prints its data in the same order.
Also, "note that A && B || C is not if-then-else. C may run when A is true."
https://www.shellcheck.net/wiki/SC2015
alsa-info.sh: Update `test` '-a' and '-o' to '&&' and '||'
lines 50, 103: in two compound ['s, replace '-a' with '] && ['
SC2166 – Prefer `[ p ] && [ q ]` as `[ p -a q ]` is not well defined.
SC2107 – Instead of `[ a && b ]`, use `[ a ] && [ b ]`.
line 45: in a compound test command, change '-o' to '|| test'
SC1139 – Use `||` instead of `-o` between test commands.
SC2109 – Instead of `[ a || b ]`, use `[ a ] || [ b ]`.
... https://github.com/koalaman/shellcheck
Fixes: https://github.com/alsa-project/alsa-utils/pull/206
From: wileyhy @ github Signed-off-by: Jaroslav Kysela <perex@perex.cz>
When a duration is specified but the the capture device cannot use the
requested sample rate and an alternative rate is used the duration
sample count must be (re)calculated.
Fixes: https://github.com/alsa-project/alsa-utils/pull/200 Signed-off-by: Tj <hacker@iam.tj> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
The REG_ICASE flag is a compile-time flag (cflags), it
should be used with regcomp() instead of regexec(). Also
add the REG_EXTENDED flag in this patch to make patterns
like 'tgl|adl' work.
Fixes: https://github.com/alsa-project/alsa-utils/pull/195 Signed-off-by: Chao Song <chao.song@linux.intel.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
In the example the $[$PCM_NUMBER - 1] would be replaced with the
result of arithmetic expression '1 - 1' in other words '0' , and
$index in all occurrences with index attribute found from pipeline
object. Any non alpha numeric or '_' character are treated as
delimiters for variable names if $[]-notation is not used.
Fixes: https://github.com/alsa-project/alsa-utils/pull/189 Signed-off-by: Jyri Sarha <jyri.sarha@intel.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
SASANO Takayoshi [Sat, 31 Dec 2022 07:03:34 +0000 (16:03 +0900)]
Add OpenBSD support
- ERESTART not supported platform: use EINTR instead
- add include/os_compat.h, well-used OS specific definition
- copied include/bswap.h from alsa-lib
- EPIPE and ESTRPIPE are different usage, but currently
EPIPE is used when ESTRPIPE is not defined.
To fix this problem, assign ESPIPE instead.
Fixes: https://github.com/alsa-project/alsa-utils/pull/186 Signed-off-by: SASANO Takayoshi <uaa@uaa.org.uk> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Chao Song [Tue, 17 Jan 2023 12:52:18 +0000 (20:52 +0800)]
topology: pre-processor: support to include conf block with IncludeByKey
Currently, The IncludeByKey mechanism only supports conditionally
including a topology conf file. Even if we only
want to conditionally include a small conf block, we have
to use a conf file and in the end we will have a lot of
trivial conf files that only contain a single conf blocks.
This patch extends the use of IncludeByKey ito support including conf
blocks conditionally. For example, the block below will include the route
conditionally based on the variable definition COPIER_ROUTE.
Jaska Uimonen [Fri, 16 Dec 2022 16:25:35 +0000 (18:25 +0200)]
topology: nhlt: intel: add support for ssp blob ver 1.5
Ssp plugin had already a definition for newer nhlt blob version 1.5.
Add support to generate that instead of legacy blob. Never blob can be
generated by adding "version" field in SSP dai topology2 definition and
setting it to lower 16 bits of SSP_BLOB_VER_1_5 (0xee000105) -> 0x105
i.e 8 bits for major and 8 bits for minor version.
SSP."0" {
id 0
dai_index 0
direction "duplex"
name NoCodec-0
version 0x105
}
Fixes: https://github.com/alsa-project/alsa-utils/pull/184 Signed-off-by: Jaska Uimonen <jaska.uimonen@linux.intel.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Jaska Uimonen [Wed, 12 Oct 2022 10:44:55 +0000 (13:44 +0300)]
topology: plugins: nhlt: add ssp aux controls
Intel ssp blob can have auxiliary controls catenated as tlv array at the
end of its "normal" data blob. These are needed in some platforms for
example to enable hardware clocks earlier than streaming starts.
In topology the auxiliary data classes are embedded into hw_config and
can be instantiated like:
Object.Base.hw_config."SSP0_0" {
id 0
mclk_freq 38400000
bclk_freq 256000
tdm_slot_width 16
format "DSP_A"
bclk "codec_provider"
fsync "codec_provider"
fsync_freq 16000
Khem Raj [Thu, 15 Dec 2022 22:04:10 +0000 (14:04 -0800)]
aplay,axfer: Replace off64_t with off_t
Also replace lseek64 with lseek.
_FILE_OFFSET_BITS=64 is passed to needed platforms since configure uses
AC_SYS_LARGEFILE macro. Therefore off_t is already 64-bit and lseek is
same as lseek64.
Additionally this fixes buils with latest musl where these lfs64
functions are moved out from _GNU_SOURCE and under _LARGEFILE64_SOURCE
macro alone. This makes the builds fail on 32-bit platforms even though
default off_t on musl is 64-bit always.
Chao Song [Thu, 8 Dec 2022 06:40:04 +0000 (14:40 +0800)]
topology: propagate nhlt plugin error to main program
Let's propagate nhlt plugin error to main program,
so that we don't generate a wrong nhlt blob silently.
Fixes: https://github.com/alsa-project/alsa-utils/pull/181 Signed-off-by: Chao Song <chao.song@linux.intel.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
aplay: Fix parsing of format with WAV_FMT_EXTENSIBLE header
WAV_FMT_EXTENSIBLE header contains valid bits per sample, which can be
different than bits per sample. Make sure it is taken into account when
parsing headers and choosing playback format.
Tim Bird [Tue, 17 May 2022 15:50:49 +0000 (09:50 -0600)]
bat: Add 'readcapture' option to support analyzing external audio
If audio data is captured on another device (ie we are NOT using
loopback mode), then allow alsabat to analyze that data, by passing
a filename reference on the command line.
Add the '--readcapture' option to the argument parser. When
this option is specified, avoid doing a local capture, and instead
just read the audio data from the indicated file, and analyze that.
Fixes: https://github.com/alsa-project/alsa-utils/pull/166 Signed-off-by: Tim Bird <tim.bird@sony.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Fabrice Fontaine [Sun, 14 Aug 2022 18:31:30 +0000 (20:31 +0200)]
configure.ac: fix build without dlfcn.h
Fix the following static build failure (i.e. without dlfcn.h) raised
since version 1.2.7 and
https://github.com/alsa-project/alsa-utils/commit/44d3e8aa44fc12f95bfeef0e3a1051e8f77047b5:
pre-processor.c:28:10: fatal error: dlfcn.h: No such file or directory
28 | #include <dlfcn.h>
| ^~~~~~~~~