Commit graph

1515 commits

Author SHA1 Message Date
Jaroslav Kysela
f77a269370 configure: Fix linking of alsatplg with the older libs
BugLink: https://github.com/alsa-project/alsa-utils/issues/33
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-12-03 20:52:42 +01:00
Jaroslav Kysela
34e373d0b1 alsactl: fix --sched-idle (set it really to SCHED_IDLE)
Reported-by: tommy <tommy@kelsos.ptp>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-12-03 13:53:25 +01:00
Jaroslav Kysela
160b47e27c alsaucm: dump - fix the prefixed "
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-11-30 20:38:17 +01:00
Jaroslav Kysela
49716fa61e alsaucm: add json dump command
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-11-30 20:32:15 +01:00
Jaroslav Kysela
860ffda825 alsaucm: add text dump command
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-11-30 19:13:07 +01:00
Jaroslav Kysela
745c5df260 alsaucm: use the first sound card (use case name 'hw:CARDNO') as default
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-11-25 18:01:33 +01:00
Jaroslav Kysela
3c740d9049 alsactl: sysfs - add /sys/kernel/uevent_seqnum check to init
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-11-25 18:01:32 +01:00
Rosen Penev
c9dc401264 aplay: Limit VUMeter progress bar to 100 for negative as well
While the progress bar cannot be negative, GCC concludes that it can be
and assumes tmp can be written past the end. Fixes this GCC warning:

aplay.c:1747:18: warning: '%02d' directive writing between 2 and 11 bytes
 into a region of size 4 [-Wformat-overflow=]
 1747 |    sprintf(tmp, "%02d%%", maxperc[c]);

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-11-20 22:01:26 +01:00
Rosen Penev
ac82b65167 aplay: Adjust buffer sizes to fix snprintf warnings
It also reduces compiled size slightly.

aplay.c: In function 'capture':
aplay.c:3055:34: error: '-01' directive output may be truncated writing 3
bytes into a region of size between 1 and 4097 [-Werror=format-truncation=
]
 3055 |    snprintf(namebuf, namelen, "%s-01", buf);
      |                                  ^~~
aplay.c:3055:4: note: 'snprintf' output between 4 and 4100 bytes into a
destination of size 4097
 3055 |    snprintf(namebuf, namelen, "%s-01", buf);
      |    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
aplay.c:3053:34: error: '-01.' directive output may be truncated writing 4
bytes into a region of size between 1 and 4097 [-Werror=format-truncation=
]
 3053 |    snprintf(namebuf, namelen, "%s-01.%s", buf, s);
      |                                  ^~~~
aplay.c:3053:4: note: 'snprintf' output 5 or more bytes (assuming 4101)
into a destination of size 4097
 3053 |    snprintf(namebuf, namelen, "%s-01.%s", buf, s);
      |    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
aplay.c:3065:34: error: '%02i' directive output may be truncated writing
between 2 and 10 bytes into a region of size between 0 and 4096 [-Werror=
format-truncation=]
 3065 |   snprintf(namebuf, namelen, "%s-%02i", buf, filecount);
      |                                  ^~~~
aplay.c:3065:30: note: directive argument in the range [1, 2147483647]
 3065 |   snprintf(namebuf, namelen, "%s-%02i", buf, filecount);
      |                              ^~~~~~~~~
aplay.c:3065:3: note: 'snprintf' output between 4 and 4108 bytes into a
destination of size 4097
 3065 |   snprintf(namebuf, namelen, "%s-%02i", buf, filecount);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
aplay.c:3063:34: error: '%02i' directive output may be truncated writing
between 2 and 10 bytes into a region of size between 0 and 4096 [-Werror=
format-truncation=]
 3063 |   snprintf(namebuf, namelen, "%s-%02i.%s", buf, filecount, s);
      |                                  ^~~~
aplay.c:3063:30: note: directive argument in the range [1, 2147483647]
 3063 |   snprintf(namebuf, namelen, "%s-%02i.%s", buf, filecount, s);
      |                              ^~~~~~~~~~~~
aplay.c:3063:3: note: 'snprintf' output 5 or more bytes (assuming 4109)
into a destination of size 4097
 3063 |   snprintf(namebuf, namelen, "%s-%02i.%s", buf, filecount, s);

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-11-20 19:46:55 +01:00
Rosen Penev
80fd81f4a8 treewide: Fix printf formats
Found with cppcheck

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-11-20 19:46:17 +01:00
Rosen Penev
66e9a81609 treewide: Fix wrong formats on 32-bit
uint64_t evaluates to unsigned long long on 32-bit, not unsigned long.
Use the proper formats.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-11-20 19:45:57 +01:00
Rosen Penev
5e6df5ae4b treewide: sys/poll to poll
Fixes warning on musl:

warning redirecting incorrect #include <sys/poll.h> to <poll.h>

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-11-20 19:44:02 +01:00
Jaroslav Kysela
c0591c540d Release v1.2.1
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-11-14 18:02:29 +01:00
Jaroslav Kysela
d207574ef7 alsaucm: fix the implicit card open
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-11-14 18:01:10 +01:00
Jaroslav Kysela
c8fdd38c74 alsaucm, topology: LDADD cleanups and add support for libatopology
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-11-12 19:39:42 +01:00
Jaroslav Kysela
d2b0b91edf alsaucm: do the implicit ucm open only when the command requires it
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-11-09 22:20:00 +01:00
Jaroslav Kysela
94401f7afe alsaucm: call snd_config_update_free_global() to make valgrind more happy
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-11-04 18:38:59 +01:00
Jaroslav Kysela
5828279b5d amixer: do not double LF for container type
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-10-31 17:33:00 +01:00
Takashi Sakamoto
7d7c988e05 axfer: handle -ETIMEDOUT before non-block I/O operation
When running for IRQ-based scheduling model, transmission backend is
expected to queue PCM event in different context from the main thread.
When queueing no events during time equivalent to one period of PCM
buffer, the backend has problems.

This commit outputs report it for non-blocking operation for IRQ-based
scheduling model. The timeout is equivalent to all frames in buffer,
instead of period for safe.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-10-30 13:13:22 +01:00
Takashi Sakamoto
498ca99461 axfer: code refactoring for a helper function to wait for avail buffer space
This commit applies code refactoring for waiting PCM event queued
per period of PCM buffer in copying operation for IRQ-based scheduling
model.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-10-30 13:13:22 +01:00
Takashi Sakamoto
a07eb8e235 axfer: handle -ETIMEDOUT before handle mmap I/O operation
When running for IRQ-based scheduling model, transmission backend is
expected to queue PCM event in different context from the main thread.
When queueing no events during time equivalent to one period of PCM
buffer, the backend has problems.

This commit outputs report it for mmap operation for IRQ-based
scheduling model. The timeout is equivalent to all frames in buffer,
instead of period for safe.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-10-30 13:13:22 +01:00
Takashi Sakamoto
e5e6a7838b axfer: return ETIMEDOUT when no event occurs after waiter expiration
Although the waiter abstraction handles timeout as success, it should
report for callers to know timeout.

This commit takes the waiter to return -ETIMEDOUT when timeout expires.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-10-30 13:13:22 +01:00
Takashi Sakamoto
1c17128410 axfer: fix to return error code when a call of select(2) fails
A call of select(2) returns negative code and report errors via errno
local variable, howver current waiter implementation for select(2)
returns the negative code instead of errno.

This commit fixes it.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-10-30 13:13:22 +01:00
Takashi Sakamoto
178a1f187c axfer: return the number of file descriptors for I/O events from select(2) waiter
A call of select(2) returns error code at failure, the number of file
descriptors available I/O at success. Current implementation of
waiter abstraction for select(2) returns 0 at success and callers
can't get the number.

This commit fixes it.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-10-30 13:13:22 +01:00
chunxu.li
d40e724905 aplay: fix memory leak when setup_chmap() fail
setup_chmap() will return with error number if hw_map calloc fail or
channels doesn't match with hw_params, but memory free was ignored when
error occurs.

Signed-off-by: chunxu.li <chunxuxiao@gmail.com>
Reviewed-by: Takashi Sakamoto o-takashi@sakamocchi.jp
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-09-25 09:57:19 +02:00
Rosen Penev
192fb6220a alsamixer: Remove exp10 usage
exp10 is a GNU extension and not available everywhere (eg. uClibc-ng).

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-09-03 12:17:41 +02:00
Takashi Sakamoto
fbb222c9bc axfer: test: fix invalid comparison of 64 bit storage in ILP32 data type
In system V ABIs with ILP32 data model, bit shift for '1ul' can brings
undefined behaviour when the calculation result is over 32 bit width.

This commit fixes the bug.

Reported-by: Rolf Eike Beer <eike@sf-mail.de>
Reference: https://bugs.gentoo.org/681652
Reference: https://github.com/alsa-project/alsa-utils/issues/23
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-07-31 15:58:46 +02:00
Takashi Sakamoto
0bc366a15c axfer: mapper: fix parameter check for demuxer
Each container should be configured to store one saple per frame in
demuxer case. This commit fixes the bug.

Fixes: 25c8e3bebb ('axfer: add support for a mapper for multiple target')
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-07-31 15:57:28 +02:00
Jaroslav Kysela
3aea4fedf9 axfer: remove unused variable warnings
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-05-27 15:37:05 +02:00
Jaroslav Kysela
7a3ca6fe6d Release v1.1.9
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-05-10 08:57:22 +02:00
Takashi Sakamoto
0b07c560f7 axfer/test: fix uninitialized warning
This commit fixes uninitialized return value from a call of test_mux() and
text_demux() to suppress warnings below:

$ make check
...
gcc -DHAVE_CONFIG_H -I. -I../../include     -O2 -Wall -pipe -g -MT mapper-test.o -MD -MP -MF .deps/mapper-test.Tpo -c -o mapper-test.o mapper-test.c
mapper-test.c: In function ‘test_mapper’:
mapper-test.c:241:9: warning: ‘err’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  return err;
         ^~~
mapper-test.c:231:5: warning: ‘err’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  if (err < 0)
     ^

Fixes: 39d1ab8a0c: ('axfer: add a unit test for mapper interface')
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-05-07 08:33:01 +02:00
Takashi Sakamoto
0248c29757 axfer/test: fix uninitialized warning
This commit fixes uninitialized return value from a call of test_vector()
to suppress a warning below.

gcc -DHAVE_CONFIG_H -I. -I../../include     -O2 -Wall -pipe -g -MT mapper-test.o -MD -MP -MF .deps/mapper-test.Tpo -c -o mapper-test.o mapper-test.c
mapper-test.c: In function ‘test_vector’:
mapper-test.c:293:6: warning: ‘err’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  int err;
      ^~~

Fixes: 39d1ab8a0c: ('axfer: add a unit test for mapper interface')
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-05-07 08:32:53 +02:00
Samuel Holland
c43a62114a axfer: Declare global variables as 'extern' in header
This avoids multiple definitions of the same global variable (one in
each file that includes this header), and fixes a linking error when
compiled with -fno-common.

Fixes: 96110793b3 ("axfer: add support for a container of raw data")

Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-05-07 08:30:25 +02:00
Samuel Holland
60f78865d3 axfer: Fix creation of v1.2 headers on big-endian systems
struct block_v120_format defines these members as uint8_t. On
little-endian systems, no swapping is done, and the generated block
header is fine. However, on big-endian machines, the value is swapped to
the high byte and then truncated by the assignment, causing both
bits_per_sample and samples_per_frame to be zero.

This fixes an assertion failure in container-test when later
parsing the header ["assert(*samples_per_frame > 0);" in
container_context_pre_process()].

Fixes: 4ab7510f3a: ("axfer: add support for a container of Creative Tech. voice format")

Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-05-07 08:28:31 +02:00
Milton Vandersloot
551cc37fc6 amixer: define _GNU_SOURCE to get exp10
Get rid of a warning about implicit declaration of exp10, which is
behind _GNU_SOURCE as a non-standard feature. The same problem was fixed
for alsamixer in commit 116488e5f2.

Signed-off-by: Milton Vandersloot <miltonvandersloot@fake-box.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-04-06 08:58:49 +02:00
Jaroslav Kysela
11e6de5493 xfer: fix possible minor memory leak in xfer_options_parse_args() (coverity)
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-03-13 17:21:16 +01:00
Jaroslav Kysela
30f9a14a79 axfer: return back unsigned avail variable, do proper retype in xfer-libasound-irq-mmap.c
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-03-13 14:51:22 +01:00
Jaroslav Kysela
8dcc3a1391 alsaloop: remove unused assignment warning (coverity)
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-03-13 14:47:23 +01:00
Jaroslav Kysela
8c026b9562 alsactl: monitor - remove dead code in run_dispatcher() (coverity)
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-03-13 14:46:33 +01:00
Jaroslav Kysela
9b6c5e2d5c aplay: check the return value for snd_pcm_sw_params_current() (coverity)
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-03-13 14:46:33 +01:00
Jaroslav Kysela
819e04c7a1 axfer: coverity fixes
- container-voc.c - out of array access
- container-voc.c - handle correctly eof
- frame_cache.c - correct memory allocation
- container.c - byte_count might be used uninitialized
- xfer-libasound-irq-mmap.c - fix avail signess
- xfer-options.c - fix potential 32-bit wrap for duration

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-03-13 14:42:42 +01:00
Jaroslav Kysela
bc42704c96 aplay: fix the multiple open file descriptors for the raw capture
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-03-12 17:36:11 +01:00
Jaroslav Kysela
6dc4b1eab5 arecordmidi: simple coverity fix
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-03-12 16:06:03 +01:00
Jaroslav Kysela
cf2cc37502 alsactl: simple coverity fix
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-03-12 16:05:48 +01:00
Jaroslav Kysela
a558b71e63 alsa-info.sh: cleanups
- fix awk arguments
- backticks/gravemarks removal
- some cosmetic and indentation changes
- add REQUIRES to check the basic tools

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-03-12 15:53:03 +01:00
Prashant Malani
52c9cc9571 seq: arecordmidi: Add num-events option
Add a command line option to automatically exit after recording a fixed
number of MIDI events. This allows a program using arecordmidi to expect
a MIDI file to be written automatically when the specified number of
events have been received, instead of having to send a SIGINT or SIGTERM
programmatically.

It also avoids the need to have the arecordmidi process running in the
background, and then constantly stat the output file to check if any
bytes have been written to it (this makes for less predictable and
longer-running tests).

This functionality finds use in Chrome OS functional testing, since
having to send SIGTERM/SIGINT programmatically and then wait for the
output file adds unpredictability and delay to the tests.

The addition of this command-line option should (hopefully) not break
any existing usage.

Signed-off-by: Prashant Malani <pmalani@chromium.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-02-11 09:13:47 +01:00
Takashi Sakamoto
6fdaa0c524 axfer: add missing header file of unit test to distribution
The file 'axfer/test/generator.h' is missing in distribution and brings
FTBFS for unit tests of axfer.

This commit fixes to add it.

Reported-by: Elimar Riesebieter <riesebie@lxtec.de>
Fixes: b878df1ff0: ('axfer: add unit test for container interface')
Fixes: 39d1ab8a0c: ('axfer: add a unit test for mapper interface')
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-01-29 16:48:00 +01:00
Takashi Sakamoto
257be19c47 axfer: allow to be compiled with glibc-2.11 or former
The program, axfer, was developed in userspace with glibc-2.28. This
userspace is mostly compliant to POSIX:2008 and some additional macros
for poll event are officially available. The glibc supports them as a
default since its v2.12 release. It will be failed to be compiled with
old glibc or the other libraries for C standard APIs.

One of the purpose of axfer is an better alternative of aplay. In a
point of the purpose, it's preferable to be compiled with the old
libraries.

This commit adds conditional macros to be compiled with libraries for
old compliance level of POSIX.

Reported-by: Jay Foster <jay@systech.com>
Fixes: fce16d9279 ('axfer: add an implementation of waiter for select(2)')
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-01-29 16:45:51 +01:00
Takashi Sakamoto
2ba2066008 axfer: add an entry of axfer to README
Axfer has beed added as a rework of aplay with robust design to
support recent features of Linux sound subsystem.

This commit adds an entry to README.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-01-29 16:44:52 +01:00
Takashi Sakamoto
9ed5d7c876 axfer: correct invalid usage of escape of itaric text
A dot sign is valid for a prefix of instruction.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-01-29 16:44:42 +01:00