Commit graph

1752 commits

Author SHA1 Message Date
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
Jaroslav Kysela
90bbeb1d3e alsaloop: fix possible memory leak in create_loopback_handle()
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-01-08 18:21:39 +01:00
Jaroslav Kysela
c5ecfd9789 alsactl: init - parse() - fix possible double free
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-01-08 18:18:53 +01:00
Jaroslav Kysela
e55534d8a5 alsactl: init - set_ctl_value() - fix bytes parsing
Use the correct error value handling from hextodigit().

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-01-08 18:16:14 +01:00
Jaroslav Kysela
42ca978078 alsactl: daemon - read_pid_file() fix the returned code on read error
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-01-08 18:09:14 +01:00
Jaroslav Kysela
05ebe64b2d aplay: add avail > delay checks to --test-position
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-01-08 18:09:12 +01:00
Curtis Malainey
03e98d2806 ucm: fix typo in docs
Do you know the tstaus of this fix?

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-01-07 11:37:50 +01:00
Jaroslav Kysela
76bc37aeb7 aplay: add test code for snd_pcm_status() to --test-position
We need to test also snd_pcm_status() values.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-01-03 17:19:07 +01:00
Takashi Iwai
12487b40b6 alsactl: Remove asound.state file check from alsa-restore.service again
We added the check of asound.state file presence some time ago to
assure that alsactl gets called only if the state file is already
present.  Since then, the situation has changed significantly:
e.g. now alsactl does initialize if the state file isn't present, and
the same alsa-restore.service is used to save the state.  This means
that we should start this service no matter the state file exists at
the boot time or not.  So, revert the old change again.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-12-11 23:55:34 +01:00
Takashi Iwai
c53f7cd038 alsactl: Fix race at creating a lock file
A race at creating a lock file in state_lock() was discovered
recently: namely, between the first open(O_RDWR) and the second
open(O_RDWR|O_CREAT|O_EXCL) calls, another alsactl invocation may
already create a lock file, then the second open() will return EEXIST,
which isn't handled properly and treated as a fatal error.

In this patch, we check EEXIST case and try again open() with O_RDWR.
This must succeed usually, and if it fails, handle finally as the
fatal error.

BugLink: https://bugzilla.opensuse.org/show_bug.cgi?id=1179904
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-12-11 23:46:23 +01:00
Takashi Iwai
878e1a7c0f alsactl: Fix double decrease of lock timeout
The state_lock() has a loop to wait for the lock file creation, and
the timeout value gets decremented twice mistakenly, which leads to a
half timeout (5 seconds) than expected 10 seconds.  Fix it.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-12-11 23:43:34 +01:00
Takashi Iwai
0385e8ebd4 Add more files to .gitignore 2020-12-10 10:34:40 +01:00
Takashi Iwai
5812f37d87 alsa-info: Add lsusb and stream outputs
We need more detailed information for USB-audio devices, at least the
lsusb -v output and the contents of stream* proc files.
Let's add them to alsa-info.sh output.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-12-09 18:35:49 +01:00