Commit graph

34 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
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
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
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
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
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
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
4bea8fe3a7 alsactl: add initial support for UCM init
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-14 18:19:20 +02:00
Jaroslav Kysela
598488c4af alsactl: init - iterate through all cards for the initial settings
The generic initialization code returns error code 99 (-99). Take
all those codes equal or above (bellow) this value as non-fatal.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-14 18:18:22 +02: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
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
b1e3d945b7 Change FSF address (Franklin Street)
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2017-11-14 14:28:53 +01:00
Jaroslav Kysela
3ad94da0c8 alsactl: remove debug line in set_ctl_values()
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2016-03-22 16:50:33 +01:00
Takashi Iwai
c68a3d02d1 alsactl: Read only *.conf files when a directory is passed via INCLUDE
When alsactl init is invoked and a directory path is passed to INCLUDE
command in the config file, read only *.conf files in that directory.
This will avoid reading backup files or invalid files that have been
created accidentally.

Also by using scandir() with alphasort(), alsactl reads the files in
alphabetical order.  Thus it's highly recommended to use some number
prefix to the file name for assuring the order.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-06-14 16:06:42 +02:00
Jaroslav Kysela
1247c3d8ac alsactl: fix error path code in init_parse.c
If initialization file (-i option) does not exists, the free_space()
function was called with NULL pointer.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2009-12-14 17:26:57 +01:00
Jaroslav Kysela
a227f00690 alsactl init: Add CTL{do_search} and CTL{do_count} parsers
To increase configuration readability, add CTL{do_search} and CTL{do_count}
actions. The old PROGRAM=="__ctl_search" notion is also allowed.

Add CTL{write} to XML documentation.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2009-10-08 13:47:27 +02:00
Jaroslav Kysela
eb2e4706f0 alsactl: introduce CTL{write} to match directly written CTL values
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2009-10-07 10:53:04 +02:00
Jaroslav Kysela
94ac54bff1 alsactl: fix sysfsroot path and parser extensions
The sysfsroot path is /sys/class/sound/cardX/device for recent kernels.
The ACCESS check honors the variable substutition now. Added $config{key}
substitution.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2009-04-30 11:26:15 +02:00
Jaroslav Kysela
d01bbbd706 alsactl/init: Fix CTL{value} assigning - make it relevant to documentation
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2009-04-15 08:57:39 +02:00
Will Wagner
9662a167d8 Use ANSI C functions
Replace non-ANSI C functions index() and rindex() with strchr() and
strrchr(), respectively.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-01-19 14:19:10 +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
Diego E. 'Flameeyes' Pettenò
ca1ea1e904 Mark static the functions not used outside their unit.
This way the compiler can assume more information about their
interface for optimisation.

Signed-off-by: Diego E. 'Flameeyes' Pettenò <flameeyes@gmail.com>
2008-11-21 13:09:56 +01: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
9a748178d1 alsactl init - CTL{values}, CTL{enums} and default "guess method" initialization
Implemented CTL{values)=value to set all values at once.
Implemented CTL{enums} to match against strings in enum list.
Added 'default' (guess method) initialization configuration.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-08-18 15:01:44 +02:00
Jaroslav Kysela
0c02a4e3d2 alsactl init - add ATTR{dBmin} and ATTR{dBmax}
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-08-18 12:39:26 +02:00
Jaroslav Kysela
460ff35c39 alsactl init - fixed enumeration string setting, update Lenovo T61 config (dB)
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-08-14 17:51:46 +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
e02535b1a8 alsactl init - add dB and percentual CTL{value} parsing for integer values
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-08-14 14:08:22 +02:00
Jaroslav Kysela
11684b3c8b alsactl init - allow enum specification by name strings
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-08-14 11:21:59 +02:00
Jaroslav Kysela
24fe765fa6 alsactl init configuration syntax changes
- change SYSFS_DEVICE to CONFIG{sysfs_device}
- INCLUDE key now handles also directories
- RESULT key can assign value now
- EXIT="return" operation returns from included file immediately

Default 00main and hda configuration files changes:

- handle preinit and postinit directories

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-08-13 20:49:07 +02:00
Jaroslav Kysela
7b3c488e4e alsactl init: added support for Lenovo T61
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-07-31 16:40:06 +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