Commit graph

1910 commits

Author SHA1 Message Date
Tianyi Liu
edff9652c0 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>
2023-12-08 20:01:04 +01:00
Mingjie Shen
4ce6a0a4af 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>
2023-12-08 20:00:13 +01:00
Mingjie Shen
004d085c67 alsactl: fix potential buffer overwrite
The 'call to sprintf' operation on line 413 requires 21 bytes
but the destination is only 16 bytes.

Fixes: https://github.com/alsa-project/alsa-utils/pull/247
Signed-off-by: Mingjie Shen <shen497@purdue.edu>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-12-08 19:56:45 +01:00
Andy Ross
8f3d84ba19 nhlt: Revert SSP_ANALOG device_type field
This partially reverts commit 3a47ef2487 ("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>
2023-12-08 19:46:58 +01:00
Jaroslav Kysela
b5591747fd alsa-restore.rules: use devnode instead number atribute
Fixes: https://github.com/alsa-project/alsa-utils/issues/244
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-11-15 15:02:34 +01:00
Jaroslav Kysela
37447085c6 aplay: use stdint.h types instead u_int/u_short/u_char
Closes: https://github.com/alsa-project/alsa-utils/pull/234
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-10-17 13:45:42 +02:00
Sam James
5ae01fcf27 Revert "nhlt-dmic-info.c: include sys/types.h"
This reverts commit 0925ad7f09.

This isn't necessary now that we use standard types (sys/types.h just
defines some compatibility typedefs).

Closes: https://github.com/alsa-project/alsa-utils/pull/234
Signed-off-by: Sam James <sam@gentoo.org>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-10-17 13:45:36 +02:00
Sam James
c08d580b28 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>
2023-10-17 13:45:26 +02:00
Sam James
d272c5d935 topology: add include for ENABLE_NLS on musl
Needed for setlocale().

(After rebasing to pick up 8c229270f6, just
move it to be guarded as the include now exists.)

Closes: https://github.com/alsa-project/alsa-utils/pull/234
Signed-off-by: Sam James <sam@gentoo.org>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-10-17 13:44:54 +02:00
Delio Brignoli
039e4cad48 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>
2023-10-17 13:28:13 +02:00
Bernd Kuhls
31e91f911e configure.ac: fix UMP support detection
b399fb85a9
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>
2023-10-17 13:25:44 +02:00
Ranjani Sridharan
68dd54784a topology: pre-processor: Add support for enum controls
Add support for adding enum controls in the topology pre-processor.

Closes: https://github.com/alsa-project/alsa-utils/pull/236
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-10-17 13:24:11 +02:00
Michael Opdenacker
0925ad7f09 nhlt-dmic-info.c: include sys/types.h
This fixes an issue compiling with the musl libc.

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>
2023-09-19 14:36:53 +02:00
Michael Opdenacker
8c229270f6 topology: include locale.h
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>
2023-09-19 14:36:38 +02:00
Jaroslav Kysela
dfe1c7143a topology: use ATTRIBUTE_UNUSED instead remove argument name
We need to support older compilers than GCC 11.

Link: https://github.com/alsa-project/alsa-utils/issues/233
Fixes: 153d185 ("topology: fix the verbose compilation warnings for latest gcc")
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-09-04 17:11:29 +02:00
Jaroslav Kysela
9e5e9a6d70 alsaucm: use ATTRIBUTE_UNUSED instead remove argument name
We need to support older compilers than GCC 11.

Link: https://github.com/alsa-project/alsa-utils/issues/233
Fixes: d7bbc26 ("alsaucm: fix the verbose compilation warnings for latest gcc")
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-09-04 16:59:01 +02:00
Jaroslav Kysela
66112d60e4 seq: use ATTRIBUTE_UNUSED instead remove argument name
We need to support older compilers than GCC 11.

Link: https://github.com/alsa-project/alsa-utils/issues/233
Fixes: 181e190 ("aplaymidi: fix the verbose compilation warnings for latest gcc")
Fixes: a03377a ("aseqnet: fix the verbose compilation warnings for latest gcc")
Fixes: 429c32a ("aseqdump: fix the verbose compilation warnings for latest gcc")
Fixes: 0b48dd6 ("aconnect: fix the verbose compilation warnings for latest gcc")
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-09-04 16:54:14 +02:00
Jaroslav Kysela
94eeb5a40f bat: use ATTRIBUTE_UNUSED instead remove argument name
We need to support older compilers than GCC 11.

Link: https://github.com/alsa-project/alsa-utils/issues/233
Fixes: b366875 ("bat: fix the verbose compilation warnings for latest gcc")
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-09-04 16:49:36 +02:00
Jaroslav Kysela
7552aef6e0 alsaloop: use ATTRIBUTE_UNUSED instead remove argument name
We need to support older compilers than GCC 11.

Link: https://github.com/alsa-project/alsa-utils/issues/233
Fixes: d609a58 ("alsaloop: fix the verbose compilation warnings for latest gcc")
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-09-04 16:45:39 +02:00
Jaroslav Kysela
2db896afd4 amidi: use ATTRIBUTE_UNUSED instead remove argument name
We need to support older compilers than GCC 11.

Link: https://github.com/alsa-project/alsa-utils/issues/233
Fixes: 1843540 ("amidi: fix the verbose compilation warnings for latest gcc")
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-09-04 16:37:56 +02:00
Jaroslav Kysela
a90faa2dd6 axfer: use ATTRIBUTE_UNUSED instead remove argument name
We need to support older compilers than GCC 11.

Link: https://github.com/alsa-project/alsa-utils/issues/233
Fixes: ad5a1c0 ("axfer: fix the verbose compilation warnings for latest gcc")
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-09-04 16:33:47 +02:00
Jaroslav Kysela
e56cf3bcb0 github: Try to fix the build with the release tag
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-09-01 21:42:47 +02:00
Jaroslav Kysela
c2a6bcba1e Release v1.2.10
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-09-01 17:36:26 +02:00
lee-yunseok
656eabd7cf po: add Korean translations
Fixes: https://github.com/alsa-project/alsa-utils/pull/214
Signed-off-by: lee-yunseok <ironyunseok@protonmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-08-30 18:58:40 +02:00
Rudi Heitbaum
e4daea49d8 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>
2023-08-30 18:56:41 +02:00
Jaroslav Kysela
feb9c4cdec reshuffle included files to include config.h as first
config.h may contain defines like _FILE_OFFSET_BITS which influence
the system wide include files (off_t types, open -> open64 function
usage etc.).

Related: https://github.com/alsa-project/alsa-utils/pull/223
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-08-30 18:48:23 +02:00
Jaroslav Kysela
9b95d9b20a github: update build.yml
- use actions/checkout@v3
- improve code to generate a specific git version

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-08-30 15:56:27 +02:00
Jaroslav Kysela
5201ec026d aseqdump: fix MIDI 2.0 code - it compiles now
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-08-30 15:56:06 +02:00
Jaroslav Kysela
a1bd9a0a15 gitcompile: set more verbose compilation warnings
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-08-30 15:42:24 +02:00
Jaroslav Kysela
b7d73a4611 nhlt-dmic-info: fix the verbose compilation warnings for latest gcc
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-08-30 15:42:24 +02:00
Jaroslav Kysela
d7bbc26d6e alsaucm: fix the verbose compilation warnings for latest gcc
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-08-30 15:42:24 +02:00
Jaroslav Kysela
181e19017d aplaymidi: fix the verbose compilation warnings for latest gcc
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-08-30 15:42:19 +02:00
Jaroslav Kysela
a03377a221 aseqnet: fix the verbose compilation warnings for latest gcc
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-08-30 12:58:11 +02:00
Jaroslav Kysela
429c32a2ec aseqdump: fix the verbose compilation warnings for latest gcc
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-08-30 12:58:11 +02:00
Jaroslav Kysela
0b48dd621b aconnect: fix the verbose compilation warnings for latest gcc
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-08-30 12:53:16 +02:00
Jaroslav Kysela
ed98b06dc2 speaker-test: fix the verbose compilation warnings for latest gcc
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-08-30 12:51:16 +02:00
Jaroslav Kysela
1843540e27 amidi: fix the verbose compilation warnings for latest gcc
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-08-30 12:50:57 +02:00
Jaroslav Kysela
b36687548d bat: fix the verbose compilation warnings for latest gcc
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-08-30 12:44:37 +02:00
Jaroslav Kysela
7c54fb5ebe iecset: fix the verbose compilation warnings for latest gcc
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-08-30 12:37:12 +02:00
Jaroslav Kysela
10a2557d7e alsamixer: fix the verbose compilation warnings for latest gcc
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-08-30 12:36:45 +02:00
Jaroslav Kysela
d609a58664 alsaloop: fix the verbose compilation warnings for latest gcc
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-08-30 12:36:15 +02:00
Jaroslav Kysela
ad5a1c0c88 axfer: fix the verbose compilation warnings for latest gcc
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-08-30 12:35:57 +02:00
Jaroslav Kysela
60bf4bb2af alsactl: fix the verbose compilation warnings for latest gcc
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-08-30 12:35:23 +02:00
Jaroslav Kysela
bf477bbb6d amixer: fix the verbose compilation warnings for latest gcc
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-08-30 12:35:03 +02:00
Jaroslav Kysela
df0b85aa4f aplay: fix the verbose compilation warnings for latest gcc
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-08-30 12:34:36 +02:00
Jaroslav Kysela
153d185822 topology: fix the verbose compilation warnings for latest gcc
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-08-30 12:33:19 +02:00
Jaroslav Kysela
8ed9d7607f alsactl: fix the copy-n-paste typo (SND_RAWMIDI_STREAM_*)
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-08-30 10:57:31 +02:00
Takashi Iwai
7e9bebad0b 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.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-08-28 16:44:45 +02:00
Takashi Iwai
ad09344d4c aseqdump: Correct wrong channel number
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.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-08-28 16:44:45 +02:00
Takashi Iwai
8703c08978 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.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-08-28 16:44:45 +02:00