Commit graph

21 commits

Author SHA1 Message Date
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
Andreas Müller
6a0d13ddb2 utils.c: Include limits.h explicitly to fix build on musl
Fixes:
| ../../alsa-utils-1.2.5/alsactl/utils.c: In function 'snd_card_clean_cfgdir':
| ../../alsa-utils-1.2.5/alsactl/utils.c:309:19: error: 'PATH_MAX' undeclared (first use in this function)
|   309 |         char path[PATH_MAX];
|       |                   ^~~~~~~~
| ../../alsa-utils-1.2.5/alsactl/utils.c:309:19: note: each undeclared identifier is reported only once for each function it appears in

Fixes: https://github.com/alsa-project/alsa-utils/pull/92
Signed-off-by: Andreas Müller <schnitzeltony@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-06-07 19:13:47 +02:00
Jaroslav Kysela
cd2f779b8d alsactl: fix lock_fd unlock in load_configuration() - error path
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-06-04 10:08:18 +02:00
Jaroslav Kysela
78212445de alsactl: fix the nested iteration
There may be nested iterations for hw: card names.
Handle this card name in snd_card_iterator_sinit().

BugLink: https://github.com/alsa-project/alsa-lib/issues/142
Fixes: eefc2c6 ("alsactl: use card iterator functions for all card loops")
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-06-01 17:49:27 +02:00
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
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
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
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
225a9afbc3 alsactl: fix the syslog message - add : delimiter after function:line
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-06-20 08:47:01 +02:00
Jaroslav Kysela
0adca4cac7 alsactl: use the right priority for syslog messages
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-14 19:41:40 +02:00
Jaroslav Kysela
8fb4016a17 alsactl: redirect alsa-lib errors
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-14 19:09:53 +02:00
Jaroslav Kysela
b1e3d945b7 Change FSF address (Franklin Street)
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2017-11-14 14:28:53 +01:00
Jaroslav Kysela
89a4f490bd alsactl: coverity - missing_va_end – va_end was not called for "ap" 2014-09-24 10:52:17 +02:00
Jaroslav Kysela
f4be3f88b6 alsactl: Fix the va_list initialization in cerror_() and dbg_()
The <ap> argument for syslog_() was uninitialized.

From: Alan Hamilton <alanh@arizonaroads.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2013-12-29 20:06:53 +01:00
Jordi Mallach
f2f5f7a7d3 Fix a build failure due to a misused format string.
This fixes builds with -Werror=format-security.

Signed-off-by: Jordi Mallach <jordi@debian.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-05-16 10:38:25 +02:00
Jaroslav Kysela
cc5c3357cf alsactl: add the daemon mode
For the plug-and-play hardware, like USB devices, it may be helpful
to manage the sound state periodically, before the devices are removed.

This change implements new commands 'daemon' and 'rdaemon' to save
the sound state in defined intervals when the sound controls are changed.

The udev rules can notify the daemon using the 'kill' or 'nrestore'
commands to rescan available cards in the system.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2013-04-05 13:47:18 +02:00
Clemens Ladisch
b4ff58b685 Revert wrong parts of "alsactl: use snd_config_imake* functions"
This reverts the parts of commit e509df69a5
that accidentally reverted a bunch of earlier commits.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2010-05-26 10:37:58 +02:00
Clemens Ladisch
e509df69a5 alsactl: use snd_config_imake* functions
To save a call to snd_config_set_xxx, replace the calls to
snd_config_make_xxx with snd_config_imake_xxx.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2010-05-26 10:07:47 +02:00
Jaroslav Kysela
5c35aa8b69 alsactl: improve -d to get warnings and store exitcode to runstate file
Also, make the initialization & restore logic for one card similar to
multiple card initialization & restore.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2010-02-25 09:22:26 +01:00
Jaroslav Kysela
b8560a6bbb alsactl init - restore calls also init on failure
The initialization procedure consist from default initialization and
state restoration. When restore fails for a reason or the config file
contains inaccurate information, then init is called.

Also, if something fails (init or restore), a file specified using -r
option can be created with description what failed. It can be useful
when user space decides to notify user to set the sound driver properly.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-08-14 16:46:27 +02:00
Jaroslav Kysela
b402cf543a Initial 'alsactl init' implementation
See 'man 7 alsactl_init' for more details.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-07-31 15:45:08 +02:00