Commit graph

1664 commits

Author SHA1 Message Date
Jaroslav Kysela
a589d88862 alsactl: clean the boot / hotplug card specific configuration directory
The /var/lib/alsa/card<NUMBER>.conf.d directories should be emptied
when the card is initialized. Implement this functionality directly
to alsactl.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-04-13 11:16:09 +02:00
Jaroslav Kysela
0a6b63a2c4 amixer/alsamixer: use sysdefault:<CARD> devices instead hw:<CARD>
The alsa-lib 1.2.5 introduced a new scheme for the default control
devices.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-04-06 20:25:58 +02:00
Jaroslav Kysela
7a7e064f83 alsaloop: samplerate - fix the wrong pointer operation
It seems that the warnings fix introduced a regression.

BugLink: https://github.com/alsa-project/alsa-utils/issues/85
Fixes: cc46d02 ("alsaloop: pcmjob - fix few warnings")
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-03-31 16:38:37 +02:00
Jaroslav Kysela
204ae460a1 amixer: cleanups for valgrind
Call snd_config_update_free_global() to check the memory
leaks and wrong memory access.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-03-30 13:32:34 +02:00
Jaroslav Kysela
69276d4a6c amixer: print error when snd_hctl_handle_events() fails
It may be possible that the controls are quickly added and
removed, thus the "hard" fail is not optimal here.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-03-29 11:36:19 +02:00
Jaroslav Kysela
2c753a85a7 alsactl: snd_ctl_elem_id_compare was renamed to snd_ctl_elem_id_compare_set
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-03-23 17:52:13 +01:00
Andreas Pape
c9e9a79c6c aplay: avoid any further PCM writing if in abort
Terminating stream with CTRL-C will set in_aborting flag which is used to leave any
write/read loop on the ALSA device.
After ending the read/write loop aplay tries to drain the stream which is not required and can also lead to malfunctions:
-If user interrupts a blocked/non responsive PCM (e.g. usb uac2 gadget which does not consume data
due to stream stopped by host) it will successfully terminate the write loop but will hang again in drain call.
This would require to hit CTRL-C again to unblock which should be avoided.
Aplay currently anyhow allows signal handler to get invoked only once.

Signed-off-by: Andreas Pape <apape@de.adit-jv.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-03-19 12:53:39 +01:00
Pierre-Louis Bossart
00be486131 speaker-test: add support for S24_LE and S24_BE
These formats are sometimes advertised by drivers, e.g. SOF.
The format is 3 bytes packed in 32-bit container, with the MSB zeroed
out.

sample: 0x00123456

S24_LE format:
b0 56
b1 34
b2 12
b3 00

S24_BE format:
b0 00
b1 12
b2 34
b3 56

I only tested the S24_LE format with the SOF driver, S24_BE was added
for symmetry only.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-03-14 09:33:39 +01:00
Takashi Sakamoto
c2d27acfce axfer: test: reduce test case for maximum number of samples per frame
This commit reduces test case for maximum number of samples per frame so
that overall time is shortened. The count of total iteration is also
reduced by one quarter.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-03-11 09:30:02 +01:00
Takashi Sakamoto
61c8622de4 Revert "axfer: test - add run-test-in-tmpdir.sh script"
This reverts commit e1551de8dd since tests
run for in-memory files now.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-03-11 09:30:02 +01:00
Takashi Sakamoto
0a03f06134 axfer: test: reduce test case for maximum number of frame count
This commit reduces test case for maximum number of frame count so that
overall time is shortened. The count of total iteration is still the same.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-03-11 09:30:02 +01:00
Takashi Sakamoto
92004425fc axfer: test: use memfd_create() for mapper-test
The mapper test program writes audio data frame to files, and read
them from the files, then validate them. For the operations, usage of
any in-memory file is good to shorten time of overall operations.

This commit uses shm by memfd_create().

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-03-11 09:30:02 +01:00
Takashi Sakamoto
5ab26fbc14 axfer: test: minor code arrangement to use the same file descriptor for mappter-test
In mapper test program, two set of file descriptors open to the same files
for container builder and parser contexts, however the same file descriptor
is available for the case.

This commit arranges to use the same file descriptor for the contexts.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-03-11 09:30:02 +01:00
Takashi Sakamoto
2314d746b9 axfer: test: use memfd_create() for container-test
The container test program writes audio data frame to file, and read
them from the file, then validate them. For the operations, usage of
any in-memory file is good to shorten time of overall operations.

This commit uses shm via memfd_create(). As a result, overall time to
run is shorten one half of before, depending on machine environment.

I note that we can achieve the same result by using O_TMPFILE flag in
open(2) system call, however the implementation of O_TMPFILE is to add
i-node without name on underling file system, thus it has overhead
depending on implementation in each file system. On the other hand,
memfd_create() is directly relevant to shm and expected to be less
overhead.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-03-11 09:30:02 +01:00
Takashi Sakamoto
c45d994867 axfer: test: minor code arrangement to use the same file descriptor for container-test
In container test program, two file descriptors open to the same file
for builder and parser contexts, however the same file descriptor is
available for the case.

This commit arranges to use the same file descriptor for the contexts.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-03-11 09:29:59 +01:00
Takashi Sakamoto
e9a4d32e29 autotools: preparation to use memfd_create(2)
This is a preparation to use memfd_create(2) system call for test programs
of axfer. The system call was introduced at Linux kernel v3.17 and
relatively new.

For safe, this commit adds detection of memfd_create() in autotools side
so that application can handle the case not to detect.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-03-11 09:28:12 +01:00
Takashi Sakamoto
6b0f1b20ae axfer: maintain lifetime of file descriptor outside of container module
This commit closes file descriptor outside of container module so
that maintenance of lifetime for the descriptor is delegated to container
user.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-03-11 09:28:12 +01:00
Takashi Sakamoto
5cb67b5ab6 axfer: open file descriptor outside of container module
Internal container module operates file descriptor to media file. For
this purpose, the structure has fd member and any file operation is done
internally. However, the case to use special file descriptor such as
memfd requires to maintain file descriptor externally.

This commit opens file descriptor outside of container module. The
internal APIs to initialize container get an argument for the file
descriptor instead of file path.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-03-11 09:28:12 +01:00
Takashi Sakamoto
4bf9e269b2 axfer: minor code arrangement to allocate containers
This commit unifies duplicated code to allocate for container structure.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-03-11 09:28:12 +01:00
Takashi Sakamoto
85ab708f50 axfer: minor code arrangement in a point of opened file descriptor
This commit arranges assignment to fd member after checking file
descriptor.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-03-11 09:28:12 +01:00
Takashi Sakamoto
81c93f6460 axfer: minor code arrangement in a point of stdio detection
Current implementation sets stdio member in a condition branch, however
it's convenient to set it always regardless of any condition.

This commit arranges assignment to the member.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-03-11 09:28:12 +01:00
Takashi Sakamoto
d81a0f93bc axfer: minor code arrangement for container module in a point of nonblocking flag
In internal container module, any file descriptor is expected as
non-blocking mode. Current implementation distinguish the case of
standard input and output from the case to open actual file since
O_NONBLOCK is used for the latter case. However, in both cases,
fcntl(2) is available to set non-blocking mode to the file descriptor.

This commit arranges to use fcntl(2) for both cases.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-03-11 09:28:12 +01:00
Jaroslav Kysela
eefc2c61cf alsactl: use card iterator functions for all card loops
Take the card iterator idea from the monitor code and
use it for all card loops. It reduces the code duplications
and makes things easy to review.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-03-11 09:23:33 +01:00
Jaroslav Kysela
9a2115b5cc alsactl: Add ucm support for the FixedBootSequence
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-03-11 09:23:31 +01:00
Jaroslav Kysela
7f5622c106 alsactl: fix possible memory leak for dump-cfg
Also remove extra snd_config_update_free_global() call for dump-state.
There's a global call in the main() function.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-03-10 18:13:16 +01:00
Jaroslav Kysela
c3f2344b72 alsactl: add 'clean' cmd to help, improve man page
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-03-07 20:18:12 +01:00
Jaroslav Kysela
b137145a92 alsactl: fix the compiler warning (uninitialized variable res)
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-03-07 20:00:24 +01:00
Jaroslav Kysela
c1474594dc alsactl: add dump-cfg and dump-state commands
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-03-07 19:58:33 +01:00
MichaIng
09c04f8935 alsactl: init command now honors -g flag as well
BugLink: https://github.com/alsa-project/alsa-utils/issues/75
Signed-off-by: MichaIng <micha@dietpi.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-03-07 18:48:35 +01:00
Jaroslav Kysela
65453da000 alsactl: honor ignore_nocards flag in init()
BugLink: https://github.com/alsa-project/alsa-utils/issues/75
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-03-06 12:40:57 +01:00
Jaroslav Kysela
e1551de8dd axfer: test - add run-test-in-tmpdir.sh script
BugLink: https://github.com/alsa-project/alsa-utils/issues/19
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-03-06 08:37:16 +01:00
Jaroslav Kysela
f8ce4f1e3a amidi, aseqnet: handle write errors
BugLink: https://github.com/alsa-project/alsa-utils/issues/17
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-03-05 21:50:28 +01:00
Jaroslav Kysela
ade71cf8b0 alsactl: fix some compiler warnings
BugLink: https://github.com/alsa-project/alsa-utils/issues/17
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-03-05 21:43:47 +01:00
Jaroslav Kysela
bccebc59a0 aplay: fix the wrong pointer dereference in playbackv_go()
BugLink: https://github.com/alsa-project/alsa-utils/issues/70
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-03-05 21:29:33 +01:00
Ryan Burns
c867aa8a84 alsamixer: use background color instead of COLOR_BLACK
BugLink: https://github.com/alsa-project/alsa-utils/pull/77
Signed-off-by: Ryan Burns <rtburns@protonmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-03-05 21:25:02 +01:00
bengan
bdb10da3aa alsa-info.sh: Add jack2 (jackdbus) detection
BugLink: https://github.com/alsa-project/alsa-utils/pull/74
Signed-off-by: bengan <bengan@bag.org>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-03-05 21:21:34 +01:00
Matt Campbell
c47e93fa7e amixer: Expand on channel docs in man page
Add missing channel params to the amixer man page. Also call out that
the channel param must come before the value to take effect.

signed-off-by: Matthew Campbell <mcampbell@izotope.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-03-05 21:14:12 +01:00
Bruno Vernay
a4cff92223 alsa-info.sh: Use HTTPS instead of HTTP
Signed-off-by: Bruno Vernay <brunovern.a@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-03-05 21:13:12 +01:00
Jaroslav Kysela
30809f395e alsa-info.sh: add PipeWire daemon detection
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-03-05 18:21:43 +01:00
Jaroslav Kysela
f67020abcf alsa-info.sh: bumb version to 0.5.0
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-03-05 18:09:52 +01:00
Jaroslav Kysela
17b4129e6c alsactl: add 'clean' command to remove the application controls
It is handy to remove all card controls created by applications.

This change allows to remove those controls for all cards, selected
card or selected card with a control id filter list like:

   alsactl clean 0 "name='PCM'" "name='Mic Phantom'"

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-03-04 21:15:56 +01:00
Jaroslav Kysela
c1f8cc2f07 alsa-info.sh: add sysfs card info section
It may be useful to dump the sysfs tree to gather
more runtime information.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-02-22 10:56:34 +01:00
Jaroslav Kysela
c990f9a8ad alsa-info.sh: add card number to the ALSA module list section
Previous output:

  !!Loaded ALSA modules
  !!-------------------

  snd_hda_intel
  snd_usb_audio

New output:

  !!Loaded ALSA modules
  !!-------------------

  snd_hda_intel (card 0)
  snd_usb_audio (card 1)

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-02-22 10:55:14 +01:00
Jaroslav Kysela
8cd781be74 alsa-info.sh: add audio keyword to the dmesg filter
Example:

sof-audio-pci 0000:00:1f.3: SoundWire enabled on CannonLake+ platform, using SOF driver

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-01-26 19:30:23 +01:00
Jaroslav Kysela
b8a1e95773 aplay: fix the test position test for playback (avail > delay)
The avail > delay condition is invalid only for capture, of course.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-01-19 12:37:34 +01:00
Jaroslav Kysela
19cc5daef4 alsamixer: fix shift in parse_words()
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-01-11 10:46:49 +01:00
Jaroslav Kysela
e165d3413e alsamixer: remove unused variable y in display_scroll_indicators()
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-01-11 10:41:42 +01:00
Jaroslav Kysela
b0c4ed248e alsamixer: remove dead fcn widget_handle_key() in widget.c
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-01-11 10:40:53 +01:00
Jaroslav Kysela
88513212c5 topology: fix possible double free in load()
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-01-08 18:33:28 +01:00
Jaroslav Kysela
c9b4293212 alsaloop: get_queued_playback_samples() - simplify code
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-01-08 18:29:56 +01:00