After the previous patch to install udev rules it is impossible to do a
non-root, custom-prefix make install. This is generally not a problem
when building official packages but it can be a pain for developers
and debuggers etc.
This is essentially the same patch as was already made in PulseAudio
in commit e8a5746f2fcae59bfd18d39b621509b3ef130453.
Signed-off-by: Colin Guthrie <gmane@colin.guthr.ie>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
.... 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>
Add minimal systemd and udev support to alsactl so that mixer settings
are restored at boot, when sound cards are plugged in and saved on
shutdown.
This is similar to existing udev/init script solutions in various
distributions.
Note that alsactl is called both synchronously from the udev rules as
well as asynchronously at boot. This is intended, and to ensure two
things:
- At boot the asound.state file might not be readable, since it resides
on a different file system. That means exclusively restoring sound card
settings from udev rules will no suffice, since if the rule is
executed at early boot (for example within udev settle) then the file
will no be readable and cannot be restored.
- We need to ensure that applications monitoring sound cards coming and
going (such as PA) must not get these events before the mixer settings
have been restored. That means the mixer settings must be restored
synchronously withing the udev rules, before the events are passed on
to the apps.
That basically means we need to restore the settings once in udev, to
deal with sound cards becoming available during runtime. And once in
early boot to deal with coldplugged soundcards whose data files might
not have been available at time of plugging. Hence we call alsactl
twice: one from the udev rule, and once from he systemd unit file.
Signed-off-by: Lennart Poettering <mznyfn@0pointer.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
The inactive controls are stored, but they are not restored
when they are marked inactive in the state file or in the
driver.
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Make the comment node a separate node in the state file (join=0), and
move it after the other fields of the respective control.
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
When the range of a control has changed between driver versions, it is a
good idea to restore the same dB value of the control. However,
computing the dB value by interpolating betweem the min/max dB values
duplicates alsa-lib's TLV functions and does not even work for controls
with a linear dB range.
A simple conversion to dB and back can be done if we add the dB value(s)
to the saved state.
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Reserving new space from the stack in every loop iteration is not
necessary, so move the call to snd_ctl_elem_id_alloca outside where it
is executed only once.
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
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>
Also, make the initialization & restore logic for one card similar to
multiple card initialization & restore.
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
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>
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>
Initialize Speaker volume to 0dB as well as Headphone when Master
is present. Also initialize Headphone,1 for machines with dual
headphones.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
- handle virtual master for T61 and TM8100
- when master volume control is available, initialize PCM & CD playback
volumes to 0dB
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
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>
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>
Some HDA codecs have shifted dB range (-34.5dB - 12dB) for PCM and CD
inputs. Use default 0dB value for them.
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Another bug/issue I tripped over when compiling alsa-utils in an
environment using uClibc to supply the C library functions. Here I have
enabled some old BSD style functions. The attached patch will honor
them if they are enabled.
Without this patch I get a redefined error during compile.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Fix check when driver contains more controls than state file. In this case,
initialization procedure should be run, too.
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
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>
This way the compiler can assume more information about their
interface for optimisation.
Signed-off-by: Diego E. 'Flameeyes' Pettenò <flameeyes@gmail.com>
Added the check of xmlto program in configure script.
Also added --disable-xmlto configure option for systems with a broken
or older xmlto that doesn't work properly.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
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>
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>
- 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>
Use snd_ctl_elem_type_name() to detect the value of the type comment
instead of using hardcoded strings.
The types list now also includes the BYTES type (Debian bug 481515).
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
When using alsactl to save or restore the card settings, it currently
skips over controls that don't have the appropriate read/write
permissions. It should also skip over inactive controls, otherwise it
will get an error when it tries to access that control, and will fail to
save the card state (or fully restore it.)
From: Dave Dillow <dave@thedillows.org>
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.
When alsactl saved state has dB level information and an attribute
of a control element is changed after save (e.g. volume range is
changed), try to restore the values to keep the same dB level.
This change requires the new alsa-lib functions for TLV dB
conversion, so we check it in configure (until AM_PATH_ALSA(1.0.16)
works).
Make "alsactl restore" a bit more robust. Now it tries to parse the
compound items in the case that the number of channels was changed.
The former mono-value is expanded to all channels.
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>
Support store/restore of user-defined controls.
Also, the numid is no longer checked when -F option is given.
The element is determined only from the given name, iface, index, device and
subdevice.
This patch converts hyphens to minus signs in the man pages (for options,
emails, or command line examples).
This patch also closes one font modifier in iecset.1.
(s/\fIfalse\fI,/\fIfalse\fP,/)
Signed-off-by: Nicolas FRANCOIS <nicolas.francois@centraliens.net>