Commit graph

110 commits

Author SHA1 Message Date
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
SASANO Takayoshi
613372dc7c Add OpenBSD support
- ERESTART not supported platform: use EINTR instead
- add include/os_compat.h, well-used OS specific definition
- copied include/bswap.h from alsa-lib

- EPIPE and ESTRPIPE are different usage, but currently
  EPIPE is used when ESTRPIPE is not defined.

  To fix this problem, assign ESPIPE instead.

Fixes: https://github.com/alsa-project/alsa-utils/pull/186
Signed-off-by: SASANO Takayoshi <uaa@uaa.org.uk>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-02-03 13:08:44 +01:00
Jaroslav Kysela
bbc74a61ac alsactl: implement 'info' command
It may be useful to collect the basic sound card information.
The output is in the YAML structured syntax (human and machine readable).

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-05-10 09:08:26 +02:00
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
Jaroslav Kysela
af62c72e2d alsactl: suppress no device 'errors' for UCM
This patch adds --ucm-nodev (or -X) option to get those
messages back. The code works only with library 1.2.6+.

By default, these messages are suppressed:

  alsactl[xxx]: alsa-lib parser.c:242:(error_node) UCM is not supported for this HDA model (HDA Intel PCH...)
  alsactl[xxx]: alsa-lib main.c:1405:(snd_use_case_mgr_open) error: failed to import hw:0 use case configuration -6

Fixes: https://github.com/alsa-project/alsa-utils/issues/111
Link: https://lore.kernel.org/alsa-devel/20211027144008.27002-1-tiwai@suse.de/
Link: 23198a72cd
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-10-28 12:16:11 +02:00
Jaroslav Kysela
d6d566a9ee alsactl: return error value in dump_config_tree()
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-06-04 09:53:56 +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
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
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
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
Andrew Hlynskyi
d7bf45edc3 alsactl: init - add -U option to disable UCM based init
The reason is to use it with internal init extra commands like:
  alsactl -U -E CMD=info init

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-10-06 13:03:03 +02:00
Jaroslav Kysela
570ea6c455 alsactl: allow to compile alsactl without UCM support
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-14 19:54:04 +02:00
Jaroslav Kysela
b68e854d28 alsactl: add -D argument to execute also the UCM defaults section
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-14 19:34:18 +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
Oscar65
d2bf87608a alsactl: fix error handling for sched_setscheduler() call
As man page says: "If successful, the sched_setparam() function shall return zero."

Without update I got this output in the syslog (journalctl):
abr 16 09:25:30 mypc alsactl[1652]: alsactl 1.2.2 daemon started
abr 16 09:25:30 mypc alsactl[1652]: /usr/bin/alsactl: do_nice:165sched_setparam failed: No such file or directory

If sched_setscheduler() returns 0, so it means that the call was successful.

Signed-off-by: Oscar Megía <megia.oscar@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-04-17 09:29:24 +02: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
b1e3d945b7 Change FSF address (Franklin Street)
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2017-11-14 14:28:53 +01:00
Jaroslav Kysela
158a67f6f5 alsactl: add -L (no-lock) and change -D (lock-dir) to -O (state-lock-file)
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2014-05-07 11:20:16 +02:00
Julian Scheel
2607d8deee alsactl: Store lockfile in /var/lock, add -D option to specify the lock dir
It can not be generally assumed that the directories in which asound.state
resides are writable. Use /var/lock and allow users to alter this path.

Signed-off-by: Julian Scheel <julian@jusst.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2014-05-07 10:55:51 +02:00
Takashi Iwai
d2d9b6fc8d alsactl: Add monitor command
With monitor command, you can monitor the events received from the
given control device.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-11-26 11:45:34 +01:00
Jaroslav Kysela
611249ae26 alsactl: add --nice and --sched-idle options
The state management can run at low priority, add --nice and --sched-idle
options to set the scheduler.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2013-04-10 09:42:40 +02:00
Jaroslav Kysela
e05b903b1f alsactl: move systemd config to the daemon mode
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2013-04-08 14:51:39 +02:00
Jaroslav Kysela
ffaff06849 alsactl: add event filter and cache for the daemon mode
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2013-04-08 11:31:45 +02:00
Jaroslav Kysela
067f4f3256 alsactl: Improved command line argument handling...
Improve command line argument handling for future extensions.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2013-04-05 13:47:21 +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
Jaroslav Kysela
e3e85a851c alsactl: safe state store and memory allocation cleanups
- store new configuration to file + ".new" extension, rename later
- free the configuration tree on exit from load_state()/save_state()
- call snd_config_update_free_global() at the end of command blocks

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2013-04-03 11:16:46 +02:00
Jaroslav Kysela
5ee6a67075 Revert "alsactl - Display help for names command"
This reverts commit 6d32e055d7.

From: Alexander Stein <alexander.stein@systec-electronic.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2011-04-28 08:13:54 +02:00
Lennart Poettering
81f015f5ab alsactl: Move asound.state location to /var/lib/alsa
.... and add configure switch for it.

/etc might be on a read-only partition which is not suitable for dynamic
data such as the mixer settings. Hence move the location of asound.state
to /var/lib.

This is based on a patch from Ubuntu/Debian which hardcoded the pah in
/var/lib.

Signed-off-by: Lennart Poettering <mznyfn@0pointer.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2010-11-23 15:48:50 +01:00
Jaroslav Kysela
69c6bead43 alsactl: Fix return code
The main() should return positive error value.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2010-02-14 19:07:25 +01:00
Takashi Iwai
ba38c92e69 alsactl - Add missing -I option
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-02-20 18:01:58 +01:00
Takashi Iwai
08837a80e0 Fix misc compile warnings in alsactl
alsactl.c:166: warning: assignment from incompatible pointer type
  init_utils_string.c:21: warning: ‘string_is_true’ defined but not used

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-02-18 15:34:57 +01:00
Diego E. 'Flameeyes' Pettenò
6232f1c96c Make some static tables and strings constants.
By doing this we move them from the .data section to .rodata setion,
or from .data.rel to .data.rel.ro.

The .rodata section is mapped directly from the on-disk file, which is
always a save, while .data.rel.ro is mapped directly when using
prelink, which is a save in a lot of cases.

Signed-off-by: Diego E. 'Flameeyes' Pettenò <flameeyes@gmail.com>
2008-11-21 13:10:02 +01:00
Takashi Iwai
1797b2c290 Add -I option to alsactl
Add -I option to alsactl to take back the old restore behavior without
initialization.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-11-13 09:28:43 +01:00
Jaroslav Kysela
f63ff476f3 alsactl: Add -g,--ignore option to ignore 'No soundcards found' error
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-09-18 09:40:02 +02:00
Jaroslav Kysela
0a8e8d581e alsactl: Fix oops (when parsing card argument)
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-09-11 13:39:42 +02:00
Jaroslav Kysela
cdf5a9b824 alsactl init - fix memory leaks (valgrind helped)
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-08-19 13:28:22 +02:00
Jaroslav Kysela
30744c02e7 alsactl: Allow card specification by device name (support for udev)
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-08-18 16:57:18 +02:00
Jaroslav Kysela
ef8bfcecda alsactl - remove 'names' command, fix alsactl man page
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-08-18 16:47:33 +02: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
Takashi Iwai
e5b2ab2a9f alsactl - Set -F option as default
Set -F option as default for restore.  There are still too many systems
that are too lazy to set -F option...

Added the new -P option to back to the old behavior.
2007-11-14 11:54:38 +01:00
Jaroslav Kysela
48de580a7b Changed Jaroslav Kysela's e-mail from perex@suse.cz to perex@perex.cz 2007-10-15 10:25:17 +02:00
Takashi Iwai
6d32e055d7 alsactl - Display help for names command
shortly explain the "names" command in the help text

From: Tomas Pospisek <tpo2@sourcepole.ch>
2007-05-23 12:06:49 +02:00
Takashi Iwai
cdccd6585f alsactl - adjust spaces in help texts
adds a space in the help text between "restore" and "<card>" and indents
the rest of the text accordingly to fit.

From: Tomas Pospisek <tpo2@sourcepole.ch>
2007-05-23 12:02:14 +02:00
Jaroslav Kysela
8fa7c15229 alsactl - return error state, fail when no configuration is found
See bug#843
2006-10-04 10:14:24 +02:00
Takashi Iwai
52aeaa557f Remove obsolete power command from alsactl
Remove obsolete power command from alsactl.
2006-03-13 19:39:17 +00:00