Commit graph

1819 commits

Author SHA1 Message Date
Yong Zhi
038ed518e9 topology: plugins: fix off by 1 mem allocation error
Fix valgrind memcheck error:

==1337389== Invalid write of size 1
==1337389==    at 0x4A4AFAB: __vsnprintf_internal (vsnprintf.c:117)
==1337389==    by 0x4AECF40: __snprintf_chk (snprintf_chk.c:38)
==1337389==    by 0x484B870: snprintf (stdio2.h:67)
==1337389==    by 0x484B870: print_as_hex_bytes (nhlt-processor.c:112)
==1337389==    by 0x484B870: merge_manifest_data (nhlt-processor.c:154)
==1337389==    by 0x484B870: do_nhlt (nhlt-processor.c:420)
==1337389==    by 0x484B870: _snd_topology_nhlt_process (nhlt-processor.c:484)

The consecutive snprintf overwrites always the previous terminator until
it hits the very last call of:

snprintf(dst, ALSA_BYTE_CHARS + 1, "0x%02x,", *nhlt_buffer);

when the size n given to snprintf is 1 more than allocated.

Fixes: https://github.com/alsa-project/alsa-utils/pull/162
Signed-off-by: Yong Zhi <yong.zhi@intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-11-04 22:03:35 +01:00
Tomohiro IKEDA
7ff994347e chore: Add link to master branch on GitHub Actions
Fixes: https://github.com/alsa-project/alsa-utils/pull/161
Singed-off-by: Tomohiro IKEDA <tomohiro.ikeda@justincase-tech.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-11-04 22:02:49 +01:00
Tomohiro IKEDA
21de8d6a2f chore: Delete .travis.yml because of using not Travis CI but GitHub Actions
Fixes: https://github.com/alsa-project/alsa-utils/pull/160
Signed-off-by: Tomohiro IKEDA <tomohiro.ikeda@justincase-tech.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-11-04 22:02:03 +01:00
John Keeping
4daf22b278 amidi: restore space between bytes
Commit 9a8fcec ("amidi: add timestamp option for dump") removed the
space between bytes when dumping MIDI, changing the output from:

	90 45 40
	80 45 00

to:

	904540
	804500

It seems that this was an unintentional side effect of refactoring the
code to add the new timestamp output but the result is less readable
than it was before.

Restore the space between bytes in the same message.

Fixes: 9a8fcec ("amidi: add timestamp option for dump")
Fixes: https://github.com/alsa-project/alsa-utils/pull/158/
Signed-off-by: John Keeping <john@metanate.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-11-04 22:01:19 +01:00
Takashi Sakamoto
0e657ca00b axfer: fix typo in manual
The spelling of 'aborted' was 'aboeted' in the manual. This commit fixes
it.

Fixes: a37703614a ("axfer: fulfill manual section for libffado backend")
Fixes: https://github.com/alsa-project/alsa-utils/pull/156
Reported-by: Chao Song chao.song@linux.intel.com
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-11-04 22:00:18 +01:00
Jaroslav Kysela
a61edeb0d4 Release v1.2.8
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-10-24 10:17:28 +02:00
Jaroslav Kysela
f37ef4768c alsactl: Print driver name in info
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-09-27 19:06:04 +02:00
Jaroslav Kysela
9a0271854f amixer: fix the help for 'events' command
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-08-25 09:33:58 +02:00
Jaroslav Kysela
62cd05a929 aplay: remove wrongly merged UCM code
The code origin comes from me. Unfortunately, it was merged
by mistake to another commit. Remove it for now.

Fixes: https://github.com/alsa-project/alsa-utils/issues/153
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-08-03 22:46:47 +02:00
Jaroslav Kysela
6ee086363a aplay: fix the capture file length regression
The commit 4b959a4 ("aplay: Fix for arecord recording ghost data")
intruduced a regression (file may contain more samples than
expected). Correct this.

Fixes: https://github.com/alsa-project/alsa-utils/issues/163
Fixes: 4b959a4 ("aplay: Fix for arecord recording ghost data")
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-08-03 22:10:05 +02:00
Jaroslav Kysela
a566f8a0ed configure: automake - use subdir-objects option
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-06-02 08:31:33 +02:00
Jaroslav Kysela
265dda7715 configure: use AC_DISABLE_STATIC (for topology modules)
Fixes: https://github.com/alsa-project/alsa-utils/issues/152
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-06-02 08:25:51 +02:00
Jaroslav Kysela
7d934f3142 Release v1.2.7
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-05-31 18:24:24 +02:00
Jaroslav Kysela
65841efdf5 topology: nhlt plugin: second attempt to fix the .so linking
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-05-31 18:23:59 +02:00
Jaroslav Kysela
cae9b71589 topology: nhlt plugin: fix the .so linking
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-05-31 18:11:50 +02:00
Jaroslav Kysela
788cfa71ea alsamixer: add alsamixer.rc.example file
Fixes: https://github.com/alsa-project/alsa-utils/issues/112
From: Bertram Felgenhauer / int-e / github
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-05-31 14:16:30 +02:00
Jaska Uimonen
96ddc346e0 topology: plugins: nhlt: fix intel dmic mode calculation
Dmic find_modes function was used with same sampling rate for both fifo
a and b parameter calculations. This bug was found in testing two
simultaneous dmic dais in topology. Fix this by introducing a sampling
rate argument for find_modes.

Fixes: https://github.com/alsa-project/alsa-utils/pull/148
Signed-off-by: Jaska Uimonen <jaska.uimonen@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-05-31 14:10:25 +02:00
Amadeusz Sławiński
4b959a447a aplay: Fix for arecord recording ghost data
When recording we should only write the amount of data read to output
file instead of copying whole buffer. This fixes glitches appearing at
the end of recorded file, when stopping recording.

Fixes: https://github.com/alsa-project/alsa-utils/pull/150
Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-05-31 14:09:29 +02:00
Jaroslav Kysela
bbc74a61ac alsactl: implement 'info' command
It may be useful to collect the basic sound card information.
The output is in the YAML structured syntax (human and machine readable).

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-05-10 09:08:26 +02:00
Jaroslav Kysela
904bc1dfd4 topology: add missing nhlt headers to Makefile.am
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-05-03 14:16:43 +02:00
Jaroslav Kysela
3862452e4e topology: add missing pre-process-external.h to Makefile.am
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-05-03 14:06:13 +02:00
Jaroslav Kysela
061344f62f github workflow: add libtoolize call for alsa-utils
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-05-03 13:33:14 +02:00
Matthias Braun
cbf0a2fa58 aplay: fix a typo in warning (inaudiable -> inaudible)
From: Matthias Braun (https://github.com/mb720)
Fixes: https://github.com/alsa-project/alsa-utils/pull/143
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-05-03 13:28:26 +02:00
Jaroslav Kysela
42010cfeba topology: do not pass pre_processor_defs to pre_process_plugins()
This parameter is not used.

Link: https://github.com/alsa-project/alsa-utils/pull/129
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-05-03 13:24:36 +02:00
Jaska Uimonen
f9e6010d5e topology: plugins - add Intel nhlt encoder plugin
Add Intel nhlt acpi table encoder plugin into topology2.0 processing.
Nhlt internal structure is defined in:
https://01.org/sites/default/files/595976_intel_sst_nhlt.pdf
Nhlt acpi table contain vendor specific binary data blobs that are used
in some Intel dsp platforms for configuring the dmic and ssp hardware.

The function of this code is mainly to generate the vendor specific
binary blobs, but as there is existing nhlt parser code and header in
kernel there's no point of re-inventing the container: just use the
existing nhlt acpi table format. Basically this code is creating similar
nhlt acpi table that you would get from: cat
/sys/firmware/acpi/tables/NHLT

This code will have implementation for dmic and ssp endpoints. Thus the
code will translate the topology dai tokens into vendor specific binary
blobs and pack them into nhlt acpi table. Ssp and dmic code is lifted
from Sound Open Firmware (sof) code base, thus it will have BSD-3
license.

This plugin can be enabled from command line with:

alsatplg -DPREPROCESS_PLUGINS="nhlt" -c foo.conf -p -o bar.tplg

You can also dump the nhlt binary into a file with additional define:

-DNHLT_BIN="nhlt.bin"

Link: https://github.com/alsa-project/alsa-utils/pull/129
Signed-off-by: Jaska Uimonen <jaska.uimonen@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-05-03 13:24:03 +02:00
Jaska Uimonen
44d3e8aa44 topology: add simple topology plugin mechanism
Add a simple plugin interface for processing the topology tree. There
can be cases where parts of the topology need to be translated from the
original format into something else. For example one could calculate
some kind of filter coefficients from filter parameters or some other
binary interface parameters from plain text topology tokens.

Mechanism is similar as in alsa-plugins and in the plugin there should
be only 1 function exported of the form:

int _snd_topology_##pluginname##_process (snd_config_t *input, snd_config_t *output)

Input and output parameters are snd_config tree before and after topology2
pre-processing. So the plugin can modify both if needed. There are cases
where the plugin may need to get information from input tree, but make
modifications to the output.

The plugins to be used can be defined in command line with:

alsatplg -DPREPROCESS_PLUGINS="foobar" -c topology.conf -p -o topology.tplg

Multiple plugins should be separated by ":".

Plugins to be used can also be defined with "Define" clause inside the
topology file (but command line takes precedence):

Define {
       PREPROCESS_PLUGINS "foobar"
}

Link: https://github.com/alsa-project/alsa-utils/pull/129
Signed-off-by: Jaska Uimonen <jaska.uimonen@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-05-03 13:23:36 +02:00
Jaroslav Kysela
8403967669 alsactl: add locking for per-card initialization
Introduce the -K,--lock-dir parameter to specify the locking
directory. If the locking is active, files card<NUM>.lock
are used to serialize the multiple initialization requests
(udev, service).

Allow the relative -O,--lock-file argument (it's default now).

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-02-02 15:34:40 +01:00
Jaroslav Kysela
64fa37f09b alsactl: lock - use alarm signal and F_SETLKW rather polling
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-02-01 20:45:48 +01:00
Jaroslav Kysela
ccb6d4612b alsactl: remove unused argument for state_lock_()
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-02-01 20:01:08 +01:00
Jaroslav Kysela
f5997e15d6 alsactl: add dbg() prints to init_ucm()
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-02-01 19:47:53 +01:00
Ranjani Sridharan
ed36ce25a7 topology: pre-processor: fix seg fault when there no command line defines
In case there are not command line definitions, there is nothing to
merge or delete.

Fixes: https://github.com/alsa-project/alsa-utils/pull/141
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-01-28 22:39:45 +01:00
Jaroslav Kysela
b5748d329b topology: use a copy of the command line defines
Fixes: a9b3525 ("topology: don't fail when Define section is missing in the included file")
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-01-28 18:53:52 +01:00
Jaroslav Kysela
a9b35252b4 topology: don't fail when Define section is missing in the included file
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-01-28 18:07:46 +01:00
Jaroslav Kysela
31d4afd8ca topology: create Define subtree for command line defines only
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-01-28 18:03:08 +01:00
Jaroslav Kysela
3afa353c0a topology: the includes should be deleted not removed
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-01-28 18:03:07 +01:00
Takashi Iwai
c511b49bf6 alsamixer: Revert has_mouse() check
has_mouse() function of ncurses doesn't seem working reliably.
Revert the previous change for addressing the regressions.

Fixes: 31820c5f23 ("alsamixer: Check the availability of mouse")
BugLink: https://github.com/alsa-project/alsa-utils/issues/139
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2022-01-28 17:46:45 +01:00
Jaroslav Kysela
7245f63b2e topology: use cached Define subtree in pre_process_includes()
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-01-28 10:04:07 +01:00
Jaroslav Kysela
123eecf7fa topology: fix the define section merge from the included files
The bellow commit assumed that the merge of the included file
is to the main configuration tree, but it's for the subtree.
The Define compound from the included file must be handled
separately.

Link: https://github.com/alsa-project/alsa-utils/pull/140
Fixes: e1a0711 ("topology: fix the command line define merge for new includes")
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-01-28 09:45:42 +01:00
Jaroslav Kysela
329cc772af topology: fix the comment for improved -D option
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-01-28 09:29:34 +01:00
Jaroslav Kysela
16f9311174 topology: add support for multiple -D arguments
It may be useful in the makefile rules for example.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-01-27 18:48:20 +01:00
Ranjani Sridharan
c47188f258 topology: pre-process-object: expand variables before validating attributes
With the introduction of variables in the topology files, validation of
attributes values must be done after they are expanded to their defined
values. Also, since valid values for attributes in the class definition
can also be variables, they need to be expanded as well. So, first expand
the attribute values and then check them against expanded valid values.

Fixes: https://github.com/alsa-project/alsa-utils/pull/138
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-01-27 18:32:06 +01:00
Jaroslav Kysela
1f1cbab235 speaker-test: remove sample_map.csv from Makefile
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-01-27 18:29:05 +01:00
Jaroslav Kysela
5a7ffd5171 topology: rename function free_pre_preprocessor to free_pre_processor
Line up this name with others.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-01-27 15:02:02 +01:00
Jaroslav Kysela
3c665532e0 topology: optimization for pre_processor_defs parsing
Parse the configuration tree only one time and then reuse
it for the merge.

Also, do not pass inc_path to all functions - add it
to the pre-processor structure.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-01-27 14:58:58 +01:00
Jaroslav Kysela
6723b5d413 topology: merge the pre-processor call to one function
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-01-27 14:33:20 +01:00
Jaroslav Kysela
e1a0711329 topology: fix the command line define merge for new includes
The defines from the command line must overwrite the defines
from the included configuration files forcefully.

Link: https://github.com/alsa-project/alsa-utils/pull/129
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-01-27 14:16:38 +01:00
Alex Xu (Hello71)
d05ac4a078 alsactl: flush stdout for monitor command
It may be useful to pipe the output to another program.

Fixes: https://github.com/alsa-project/alsa-utils/pull/109
Signed-off-by: Alex Xu (Hello71) <alex_y_xu@yahoo.ca>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-01-27 13:22:38 +01:00
Jaroslav Kysela
8adbb2c275 alsactl: fix typo in comment in 00main
Fixes: https://github.com/alsa-project/alsa-utils/issues/132
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-01-27 13:19:36 +01:00
Jaroslav Kysela
90e1fd964b speaker-test: remove sample_map.csv
The CSV file is not used. The .wav file names are fixed
in the source code, but the directory may be specified
using --wavdir. Remove this file until there's a demand
for the more precise .wav file mapping.

Fixes: https://github.com/alsa-project/alsa-utils/issues/133
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-01-27 13:16:37 +01:00
Jaroslav Kysela
84173ff9e3 topology: don't allow to mix verbose level and output to stdout
Fixes: https://github.com/alsa-project/alsa-utils/issues/131
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-01-27 13:04:01 +01:00