Integrate minimal systemd support in alsa-utils
PATCH 1/1 Integrate minimal systemd support in alsa-utils
Heya,
Up to this point most distributions have been using different init scripts/udev rules files to save/restore mixer settings at boot/hotplug/shutdown. Please see my two attached patches for alsa-utils which add standardized, simplified support for this.
The first patch is stolen from Debian/Ubuntu, which moves asound.state to /var/lib, which is a more appropriate place, since /etc might be read-only.
The second patch includes a minimal udev rule (executed synchronously, enabled on all systems, regardless of systemd is used or not) and two systemd service files (executed asynchronously at boot/shutdown, only enabled if built with systemd support).
Given that most big distributions are moving to adopt systemd sooner or later it would be great to have support for this in the upstream package to avoid further balkanization how things are done here.
Lennart
Signature · 1 line
Lennart Poettering - Red Hat, Inc.
Quoted 1 line
From
c5b414489626fcd46d792ab96db06e254dfeff90Mon Sep 17 00:00:00 2001
From: David B. Harris <[email protected]>
Date: Tue, 23 Nov 2010 02:59:18 +0100
Subject: [PATCH 1/2] Move asound.state location to /var/lib/alsa/
/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.
--- alsaconf/alsaconf.in | 4 ++-- alsactl/alsactl.1 | 4 ++-- alsactl/alsactl.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-)
alsaconf/alsaconf.in +2 -2
@@ -956,8 +956,8 @@ If you have a big amplifier, lower your volumes or say no. aplay -N $TESTSOUND fi fi - if [ ! -r /etc/asound.state ]; then - xecho "Saving the mixer setup used for this in /etc/asound.state." + if [ ! -r /var/lib/alsa/asound.state ]; then + xecho "Saving the mixer setup used for this in /var/lib/alsa/asound.state." $sbindir/alsactl store fi clear
alsactl/alsactl.1 +2 -2
@@ -43,7 +43,7 @@ Print alsactl version number. .TP \fI\-f, \-\-file\fP -Select the configuration file to use. The default is /etc/asound.state. +Select the configuration file to use. The default is /var/lib/alsa/asound.state. .TP \fI\-F, \-\-force\fP
@@ -90,7 +90,7 @@ The configuration file for init. By default, PREFIX/share/alsa/init/00main is used. .SH FILES -\fI/etc/asound.state\fP (or whatever file you specify with the +\fI/var/lib/alsa/asound.state\fP (or whatever file you specify with the \fB\-f\fP flag) is used to store current settings for your soundcards. The settings include all the usual soundcard mixer settings. More importantly, alsactl is
alsactl/alsactl.c +1 -1
@@ -30,7 +30,7 @@#include <alsa/asoundlib.h> #include "alsactl.h" -#define SYS_ASOUNDRC "/etc/asound.state" +#define SYS_ASOUNDRC "/var/lib/alsa/asound.state"int debugflag =0 ;int force_restore =1 ;
Signature · 1 line
1.7.3.2
Quoted 1 line
From
2925d59fd4a451ab36e704ea09984a6a70c358a7Mon Sep 17 00:00:00 2001
From: Lennart Poettering <[email protected]>
Date: Tue, 23 Nov 2010 01:45:08 +0100
Subject: [PATCH 2/2] alsactl: systemd and udev hookup
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.
--- Makefile.am | 3 ++ alsactl/.gitignore | 3 ++ alsactl/90-alsa-restore.rules.in | 2 + alsactl/Makefile.am | 46 ++++++++++++++++++++++++++++++++++++++ alsactl/alsa-restore.service.in | 11 +++++++++ alsactl/alsa-store.service.in | 9 +++++++ configure.in | 17 +++++++++++-- 7 files changed, 88 insertions(+), 3 deletions(-) create mode 100644 alsactl/.gitignore create mode 100644 alsactl/90-alsa-restore.rules.in create mode 100644 alsactl/alsa-restore.service.in create mode 100644 alsactl/alsa-store.service.in
Makefile.am +3 -0
@@ -37,3 +37,6 @@ dist-hook: else \ $(TAR) --create --verbose --file=- $(distdir) | bzip2 -c -9 > $(distdir).tar.bz2 ; \ fi + +DISTCHECK_CONFIGURE_FLAGS = \ + --with-systemdsystemunitdir=$$dc_install_base/$(systemdsystemunitdir)
alsactl/.gitignore new file +3 -0
@@ -0,0 +1,3 @@ +alsa-store.service +alsa-restore.service +90-alsa-restore.rules
alsactl/90-alsa-restore.rules.in new file +2 -0
@@ -0,0 +1,2 @@ +ACTION=="add", SUBSYSTEM=="sound", KERNEL=="controlC*", KERNELS=="card*", \ + RUN+="@sbindir@/alsactl restore $attr{number}"
alsactl/Makefile.am +46 -0
51 lines not on this page · raw message
alsactl/alsa-restore.service.in new file +11 -0
@@ -0,0 +1,11 @@ +[Unit] +Description=Restore Sound Card State +DefaultDependencies=no +After=sysinit.target +Before=shutdown.target +Conflicts=shutdown.target + +[Service] +Type=oneshot +ExecStart=-@sbindir@/alsactl restore +StandardOutput=syslog
alsactl/alsa-store.service.in new file +9 -0
@@ -0,0 +1,9 @@ +[Unit] +Description=Store Sound Card State +DefaultDependencies=no +Before=shutdown.target + +[Service] +Type=oneshot +ExecStart=@sbindir@/alsactl store +StandardOutput=syslog
configure.in +14 -3
@@ -26,6 +26,7 @@ fi AC_PROG_CC dnl AC_PROG_CXX AC_PROG_INSTALL +AC_PROG_MKDIR_P AC_PROG_LN_S AM_PATH_ALSA(1.0.16)
@@ -130,7 +131,7 @@ if test x$alsamixer = xtrue; then CURSES_CFLAGS=`ncursesw5-config --cflags` curseslib="ncursesw" else - AC_CHECK_LIB(ncursesw, initscr, + AC_CHECK_LIB(ncursesw, initscr, [ CURSESINC='<ncurses.h>'; CURSESLIB='-lncursesw'; curseslib="ncursesw"]) fi if test -n "$CURSESINC"; then
@@ -147,12 +148,12 @@ if test x$alsamixer = xtrue; then CURSES_CFLAGS=`ncurses5-config --cflags` curseslib="ncurses" else - AC_CHECK_LIB(ncurses, initscr, + AC_CHECK_LIB(ncurses, initscr, [ CURSESINC='<ncurses.h>'; CURSESLIB='-lncurses'; curseslib="ncurses"]) fi fi if test "$curseslib" = "curses" -o "$curseslib" = "auto"; then - AC_CHECK_LIB(curses, initscr, + AC_CHECK_LIB(curses, initscr, [ CURSESINC='<curses.h>'; CURSESLIB='-lcurses'; curseslib="curses"]) fi if test -z "$CURSESINC"; then
@@ -278,6 +279,16 @@ SAVE_UTIL_VERSION AC_SUBST(LIBRT) +dnl Check for systemd +PKG_PROG_PKG_CONFIG +AC_ARG_WITH([systemdsystemunitdir], + AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]), + [], [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)]) +if test "x$with_systemdsystemunitdir" != xno; then + AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir]) +fi +AM_CONDITIONAL(HAVE_SYSTEMD, [test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != xno ]) + AC_OUTPUT(Makefile alsactl/Makefile alsactl/init/Makefile \ alsamixer/Makefile amidi/Makefile amixer/Makefile \ m4/Makefile po/Makefile.in \
Signature · 1 line
1.7.3.2
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
At Tue, 23 Nov 2010 03:16:58 +0100,
Quoted 9 lines · Lennart Poettering
Quoted 2 lines
From
c5b414489626fcd46d792ab96db06e254dfeff90Mon Sep 17 00:00:00 2001From: David B. Harris <[email protected]>
Date: Tue, 23 Nov 2010 02:59:18 +0100
Subject: [PATCH 1/2] Move asound.state location to/var/lib/alsa//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.
Could you add configure option to specify the path instead of replacing the fixed path?
I don't mind to change the default path, but dropping the old path is no good approach, since alsa-utils is still used by many old distros.
thanks,
Takashi
Quoted 59 lines
--- alsaconf/alsaconf.in | 4 ++-- alsactl/alsactl.1 | 4 ++-- alsactl/alsactl.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-)alsaconf/alsaconf.in +2
-2@@ -956,8 +956,8 @@ If you have a big amplifier, lower your volumes or say no. aplay -N $TESTSOUND fi fi - if [ ! -r /etc/asound.state ]; then - xecho "Saving the mixer setup used for this in /etc/asound.state." + if [ ! -r /var/lib/alsa/asound.state ]; then + xecho "Saving the mixer setup used for this in /var/lib/alsa/asound.state." $sbindir/alsactl store fi clearalsactl/alsactl.1 +2
-2@@ -43,7 +43,7 @@ Print alsactl version number. .TP \fI\-f, \-\-file\fP -Select the configuration file to use. The default is /etc/asound.state. +Select the configuration file to use. The default is /var/lib/alsa/asound.state. .TP \fI\-F, \-\-force\fP@@ -90,7 +90,7 @@ The configuration file for init. By default, PREFIX/share/alsa/init/00main is used. .SH FILES -\fI/etc/asound.state\fP (or whatever file you specify with the +\fI/var/lib/alsa/asound.state\fP (or whatever file you specify with the \fB\-f\fP flag) is used to store current settings for your soundcards. The settings include all the usual soundcard mixer settings. More importantly, alsactl isalsactl/alsactl.c +1
-1@@ -30,7 +30,7 @@#include <alsa/asoundlib.h> #include "alsactl.h" -#define SYS_ASOUNDRC "/etc/asound.state" +#define SYS_ASOUNDRC "/var/lib/alsa/asound.state"int debugflag =0 ;int force_restore =1 ;Signature · 1 line
1.7.3.2
At Tue, 23 Nov 2010 03:16:58 +0100,
Quoted 12 lines · Lennart Poettering
Heya,
Up to this point most distributions have been using different init
scripts/udevrules files to save/restore mixer settings at boot/hotplug/shutdown. Please see my two attached patches for alsa-utils which add standardized, simplified support for this.The first patch is stolen from Debian/Ubuntu, which moves asound.state to
/var/lib, which is a more appropriate place, since /etc might be read-only.
Quoted 8 lines
The second patch includes a minimal udev rule (executed synchronously, enabled on all systems, regardless of systemd is used or not) and two systemd service files (executed asynchronously at boot/shutdown, only enabled if built with systemd support).
Given that most big distributions are moving to adopt systemd sooner or later it would be great to have support for this in the upstream package to avoid further balkanization how things are done here.
The second patch looks good to me. It doesn't break, at least. I'm going to apply it unless anyone else has specific objection.
thanks,
Takashi
Quoted 7 lines · Lennart Poettering
Heya,
Up to this point most distributions have been using different init
scripts/udevrules files to save/restore mixer settings at boot/hotplug/shutdown. Please see my two attached patches for alsa-utils which add standardized, simplified support for this.
Quoted 8 lines
The first patch is stolen from Debian/Ubuntu, which moves asound.state to
/var/lib, which is a more appropriate place, since /etc might be read-only.The second patch includes a minimal udev rule (executed synchronously, enabled on all systems, regardless of systemd is used or not) and two systemd service files (executed asynchronously at boot/shutdown, only enabled if built with systemd support).
Lennart,
Could you clarify how this affects/changes behaviour for distros not running systemd?
Also, I personally don't like the idea of saving the mixer state at shutdown. (Although I know Ubuntu has that as well.) Too many times I have cranked up the volume for some reason, then turned the computer off, only to find the login sound at maximum volume.
Quoted 2 lines
Given that most big distributions are moving to adopt systemd sooner or later
That assumption is not necessarily true at this point. AFAIK, it remains to be seen. That said, I don't mind a systemd patch into alsa-utils, as long as it doesn't break or bloat anything for non-systemd distros.
Signature · 2 lines
David Henningsson, Canonical Ltd. http://launchpad.net/~diwic
Jaroslav Kysela
AppliedQuoted 10 lines · Lennart Poettering
Heya,
Up to this point most distributions have been using different init
scripts/udevrules files to save/restore mixer settings at boot/hotplug/shutdown. Please see my two attached patches for alsa-utils which add standardized, simplified support for this.The first patch is stolen from Debian/Ubuntu, which moves asound.state to
/var/lib, which is a more appropriate place, since /etc might be read-only.
This will break users which upgrade the package manually from sources and /var/lib/alsa directory is not created. I think that the 'make install' rules should create this directory and also alsaconf should check/create this directory if it does not exists.
Quoted 8 lines
The second patch includes a minimal udev rule (executed synchronously, enabled on all systems, regardless of systemd is used or not) and two systemd service files (executed asynchronously at boot/shutdown, only enabled if built with systemd support).
Given that most big distributions are moving to adopt systemd sooner or later it would be great to have support for this in the upstream package to avoid further balkanization how things are done here.
I applied this second patch to the alsa-utils repo.
Jaroslav
-----
Jaroslav Kysela <[email protected]>
Linux Kernel Sound Maintainer
ALSA Project, Red Hat, Inc.
Quoted 9 lines · David Henningsson
Quoted 4 lines
The second patch includes a minimal udev rule (executed synchronously, enabled on all systems, regardless of systemd is used or not) and two systemd service files (executed asynchronously at boot/shutdown, only enabled if built with systemd support).
Lennart,
Could you clarify how this affects/changes behaviour for distros not running systemd?
As I wrote above it won't even be installed if systemd is not around.
Quoted 4 lines
Also, I personally don't like the idea of saving the mixer state at shutdown. (Although I know Ubuntu has that as well.) Too many times I have cranked up the volume for some reason, then turned the computer off, only to find the login sound at maximum volume.
Then disable it. And since you don't run systemd you won't even have to do that explicitly.
Quoted 7 lines
Quoted 2 lines
Given that most big distributions are moving to adopt systemd sooner or later
That assumption is not necessarily true at this point. AFAIK, it remains to be seen. That said, I don't mind a systemd patch into alsa-utils, as long as it doesn't break or bloat anything for non-systemd distros.
Well, this thing is far less "bloaty" then what Ubuntu is currently doing. i.e. Ubuntu duplicates the mixer init database in an init script /sbin/alsa-utils which is moved there for weird reasons. I can only encourage you to drop that "bloat" and rely on the mixer init database that comes with alsa, like everybody else.
(Sorry, the word "bloat" just sets me off)
But anyway, if you don't have systemd, you won't even see these files. Nothing changes for you.
(Also note that Ubuntu is currently asynchronously executing said init script from an udev rule. That means that by the time a device added event reaches PA the mixer has not been configured properly yet, which can confused PA quite a bit. Hence please make sure to drop the execution of said init script from the udev rule, either by simply adopting the code this patch includes, or by making your current rule synchronous. Thanks.)
Lennart
Signature · 1 line
Lennart Poettering - Red Hat, Inc.
Quoted 7 lines · Lennart Poettering
Quoted 5 lines · David Henningsson
Quoted 4 lines
The second patch includes a minimal udev rule (executed synchronously, enabled on all systems, regardless of systemd is used or not) and two systemd service files (executed asynchronously at boot/shutdown, only enabled if built with systemd support).
Quoted 6 lines
Quoted 4 lines
Lennart,
Could you clarify how this affects/changes behaviour for distros not running systemd?
As I wrote above it won't even be installed if systemd is not around.
Ok.
Quoted 7 lines
Quoted 4 lines
Also, I personally don't like the idea of saving the mixer state at shutdown. (Although I know Ubuntu has that as well.) Too many times I have cranked up the volume for some reason, then turned the computer off, only to find the login sound at maximum volume.
Then disable it. And since you don't run systemd you won't even have to do that explicitly.
Ok; so the question is whether we should even have such a rule, and if so, should it be enabled by default? Do other people than you and me have an opinion here?
Quoted 9 lines
Quoted 7 lines
Quoted 2 lines
Given that most big distributions are moving to adopt systemd sooner or later
That assumption is not necessarily true at this point. AFAIK, it remains to be seen. That said, I don't mind a systemd patch into alsa-utils, as long as it doesn't break or bloat anything for non-systemd distros.
Well, this thing is far less "bloaty"
It is not bloating at all (at least not by my standard) if it's not even installed, don't worry.
Quoted 11 lines
then what Ubuntu is currently
doing. i.e. Ubuntu duplicates the mixer init database in an init script/sbin/alsa-utilswhich is moved there for weird reasons. I can only encourage you to drop that "bloat" and rely on the mixer init database that comes with alsa, like everybody else.(Sorry, the word "bloat" just sets me off)
But anyway, if you don't have systemd, you won't even see these files. Nothing changes for you.
Quoted 7 lines
(Also note that Ubuntu is currently asynchronously executing said init script from an udev rule. That means that by the time a device added event reaches PA the mixer has not been configured properly yet, which can confused PA quite a bit. Hence please make sure to drop the execution of said init script from the udev rule, either by simply adopting the code this patch includes, or by making your current rule synchronous. Thanks.)
Thanks for the tip, reducing upstream delta is always a good thing. IIRC some of it is inherited from Debian, so it wouldn't hurt for me to find out a little more about this at that level.
Signature · 2 lines
David Henningsson, Canonical Ltd. http://launchpad.net/~diwic
On Tue, 23.11.10 10:44, Jaroslav Kysela ([email protected]) wrote:
Heya,
Quoted 5 lines
Quoted 5 lines
Up to this point most distributions have been using different init
scripts/udevrules files to save/restore mixer settings at boot/hotplug/shutdown. Please see my two attached patches for alsa-utils which add standardized, simplified support for this.
Quoted 8 lines
Quoted 3 lines
The first patch is stolen from Debian/Ubuntu, which moves asound.state to
/var/lib, which is a more appropriate place, since /etc might be read-only.This will break users which upgrade the package manually from sources and
/var/lib/alsadirectory is not created. I think that the 'make install' rules should create this directory and also alsaconf should check/create this directory if it does not exists.
See attached patch. This will now ensure the directory is created both at install time and when alsaconf is run.
Also, I made the path configurable, as requested by Takashi, however set the default to /var/lib/alsa.
Quoted 5 lines
Quoted 3 lines
Given that most big distributions are moving to adopt systemd sooner or later it would be great to have support for this in the upstream package to avoid further balkanization how things are done here.
I applied this second patch to the alsa-utils repo.
Thanks!
Lennart
Signature · 1 line
Lennart Poettering - Red Hat, Inc.
Quoted 1 line
From
9751c6f8f13116d12a4d8393d5f0b8d43e328e1dMon Sep 17 00:00:00 2001
From: Lennart Poettering <[email protected]>
Date: Tue, 23 Nov 2010 02:59:18 +0100
Subject: [PATCH] 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.
--- Makefile.am | 3 +++ alsaconf/alsaconf.in | 5 +++-- alsactl/Makefile.am | 1 + alsactl/alsactl.1 | 4 ++-- alsactl/alsactl.c | 4 +++- configure.in | 6 ++++++ 6 files changed, 18 insertions(+), 5 deletions(-)
Makefile.am +3 -0
@@ -38,5 +38,8 @@ dist-hook: $(TAR) --create --verbose --file=- $(distdir) | bzip2 -c -9 > $(distdir).tar.bz2 ; \ fi +install-data-hook: + $(MKDIR_P) -m 0755 $(DESTDIR)$(ASOUND_STATE_DIR) + DISTCHECK_CONFIGURE_FLAGS = \ --with-systemdsystemunitdir=$$dc_install_base/$(systemdsystemunitdir)
alsaconf/alsaconf.in +3 -2
@@ -956,8 +956,9 @@ If you have a big amplifier, lower your volumes or say no. aplay -N $TESTSOUND fi fi - if [ ! -r /etc/asound.state ]; then - xecho "Saving the mixer setup used for this in /etc/asound.state." + mkdir -p -m 0755 @ASOUND_STATE_DIR@ + if [ ! -r @ASOUND_STATE_DIR@/asound.state ]; then + xecho "Saving the mixer setup used for this in @ASOUND_STATE_DIR@/asound.state." $sbindir/alsactl store fi clear
alsactl/Makefile.am +1 -0
@@ -8,6 +8,7 @@ endif EXTRA_DIST=alsactl.1 alsactl_init.xml alsactl_SOURCES=alsactl.c state.c utils.c init_parse.c +alsactl_CFLAGS=$(AM_CFLAGS) -DSYS_ASOUNDRC=\"$(ASOUND_STATE_DIR)/asound.state\" noinst_HEADERS=alsactl.h list.h init_sysdeps.c init_utils_string.c init_utils_run.c init_sysfs.c udevrulesdir=/lib/udev/rules.d
alsactl/alsactl.1 +2 -2
@@ -43,7 +43,7 @@ Print alsactl version number. .TP \fI\-f, \-\-file\fP -Select the configuration file to use. The default is /etc/asound.state. +Select the configuration file to use. The default is /var/lib/alsa/asound.state. .TP \fI\-F, \-\-force\fP
@@ -90,7 +90,7 @@ The configuration file for init. By default, PREFIX/share/alsa/init/00main is used. .SH FILES -\fI/etc/asound.state\fP (or whatever file you specify with the +\fI/var/lib/alsa/asound.state\fP (or whatever file you specify with the \fB\-f\fP flag) is used to store current settings for your soundcards. The settings include all the usual soundcard mixer settings. More importantly, alsactl is
alsactl/alsactl.c +3 -1
@@ -30,7 +30,9 @@#include <alsa/asoundlib.h> #include "alsactl.h" -#define SYS_ASOUNDRC "/etc/asound.state" +#ifndef SYS_ASOUNDRC +#define SYS_ASOUNDRC "/var/lib/alsa/asound.state" +#endif int debugflag =0 ;int force_restore =1 ;
configure.in +6 -0
@@ -289,6 +289,12 @@ if test "x$with_systemdsystemunitdir" != xno; then fi AM_CONDITIONAL(HAVE_SYSTEMD, [test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != xno ]) +AC_ARG_WITH(ASOUND_STATE_DIR, + AS_HELP_STRING([--with-asound-state-dir=DIR], [Directory to place asound.state file in]), + [ASOUND_STATE_DIR="$withval"], + [ASOUND_STATE_DIR="/var/lib/alsa"]) +AC_SUBST(ASOUND_STATE_DIR) + AC_OUTPUT(Makefile alsactl/Makefile alsactl/init/Makefile \ alsamixer/Makefile amidi/Makefile amixer/Makefile \ m4/Makefile po/Makefile.in \
Signature · 1 line
1.7.3.2
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Quoted 18 lines · Lennart Poettering
On Tue, 23.11.10 10:44, Jaroslav Kysela ([email protected]) wrote:
Heya,
Quoted 5 lines
Quoted 5 lines
Up to this point most distributions have been using different init
scripts/udevrules files to save/restore mixer settings at boot/hotplug/shutdown. Please see my two attached patches for alsa-utils which add standardized, simplified support for this.Quoted 8 lines
Quoted 3 lines
The first patch is stolen from Debian/Ubuntu, which moves asound.state to
/var/lib, which is a more appropriate place, since /etc might be read-only.This will break users which upgrade the package manually from sources and
/var/lib/alsadirectory is not created. I think that the 'make install' rules should create this directory and also alsaconf should check/create this directory if it does not exists.
Quoted 5 lines
See attached patch. This will now ensure the directory is created both at install time and when alsaconf is run.
Also, I made the path configurable, as requested by Takashi, however set the default to
/var/lib/alsa.
I applied your patch. Just only one comment: The better location for the install-data-hook is the alsactl/Makefile.am.
Jaroslav
-----
Jaroslav Kysela <[email protected]>
Linux Kernel Sound Maintainer
ALSA Project, Red Hat, Inc.
Quoted 2 lines · Lennart Poettering
Quoted 2 lines
i.e. Ubuntu duplicates the mixer init database in an init script
/sbin/alsa-utilswhich is moved there for weird reasons.
This is from Debian, of course, and it was moved there in Ubuntu to discourage people from running it (because it erroneously implies to people that it does magical things in alsa userspace) and because /usr might not be available. Of course when the script is removed completely, people howl. Efforts began some time ago to obsolete it (I blogged about it, even) and consolidate all its mess into the alsactl init db (patches have been sent to this mailing list, too). A nontrivial concern is that for some subset of the hard-coded (ick!) mixer controls being set in that script, there are no associated bug reports containing relevant hardware information (e.g., PCI SSID). Thus, migrating them over to the init db format is quite history-search-intensive. But, as I've stated formerly here and on pulseaudio-discuss, it's definitely deprecated (e.g., bug reports have been retitled to indicate that such-and-such an entry in the init db is needed. As I've stepped away from Ubuntu development due to $dayjob, the efforts need to be continued by others).
-Dan
Quoted 2 lines · Takashi Iwai
The second patch looks good to me. It doesn't break, at least. I'm going to apply it unless anyone else has specific objection.
Now that both is merged, mind putting that in openSUSE Factory?
We need to enable systemd services with:
--with-systemdsystemunitdir=/lib/systemd/system
list the files/dirs in:
/lib/systemd/system/*.service
/lib/udev/rules.d/*.rules
Drop the current custom udev rule:
/etc/udev/rules.d/40-alsa.rules
and use only the systemd one in /lib/udev/. It should work also for non-systemd setups.
All the naming rules for the snd/ subdir can be removed on all recent systems, only the GROUP="audio" is needed.
No rules files should be installed in /etc, all files from packages belong into /lib.
The old SYSV init script:
/etc/init.d/alsasound
should be linked to:
/lib/systemd/system/alsasound.service -> alsa-restore.service
so that the init script will not be executed on systemd bootups.
Thanks,
Kay
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
At Tue, 23 Nov 2010 18:05:00 +0100,
Quoted 7 lines · Kay Sievers
Quoted 2 lines · Takashi Iwai
The second patch looks good to me. It doesn't break, at least. I'm going to apply it unless anyone else has specific objection.
Now that both is merged, mind putting that in openSUSE Factory?
Sure. A few questions, though:
Quoted 6 lines
We need to enable systemd services with:
--with-systemdsystemunitdir=/lib/systemd/systemlist the files/dirs in:
/lib/systemd/system/*.service
/lib/udev/rules.d/*.rules
These come from alsa-utils, obviously. But alsa.rpm requires alsa-utils, so this should be OK.
Quoted 4 lines
Drop the current custom udev rule:
/etc/udev/rules.d/40-alsa.rules
and use only the systemd one in/lib/udev/. It should work also for non-systemd setups.
Do you mean I copy systemd's rules file to alsa.rpm...?
We need a rules file for non-systemd (i.e. without systemd.rpm), so someone still needs to provide a udev stuff for sound, I suppose?
Quoted 5 lines
All the naming rules for the snd/ subdir can be removed on all recent systems, only the GROUP="audio" is needed.
No rules files should be installed in /etc, all files from packages belong into /lib.
OK.
Quoted 5 lines
The old SYSV init script:
/etc/init.d/alsasound
should be linked to:
/lib/systemd/system/alsasound.service-> alsa-restore.service
so that the init script will not be executed on systemd bootups.
OK, this is easy.
thanks,
Takashi
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Quoted 9 lines · Takashi Iwai
Quoted 1 line · Kay Sievers
Now that both is merged, mind putting that in openSUSE Factory?
Sure. A few questions, though:
Quoted 3 lines
We need to enable systemd services with:
--with-systemdsystemunitdir=/lib/systemd/system
Quoted 6 lines
Quoted 3 lines
list the files/dirs in:
/lib/systemd/system/*.service
/lib/udev/rules.d/*.rulesThese come from alsa-utils, obviously. But alsa.rpm requires alsa-utils, so this should be OK.
Fine.
Quoted 6 lines
Quoted 4 lines
Drop the current custom udev rule:
/etc/udev/rules.d/40-alsa.rules
and use only the systemd one in/lib/udev/. It should work also for non-systemd setups.Do you mean I copy systemd's rules file to alsa.rpm...?
Can't we just let them get installed from alsa-utils.rpm? And drop the current rule from alsa.rpm?
Quoted 2 lines
We need a rules file for non-systemd (i.e. without systemd.rpm), so someone still needs to provide a udev stuff for sound, I suppose?
Oh, we just enable --with-systemd and install the systemd files and udev rules unconditionally, they don't pull systemd.rpm in, the systemd files will jsut be ignored on SYSV boxes, but the udev rule will still be used. That should work and is how it usually works.
Kay
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Quoted 9 lines · Takashi Iwai
Quoted 5 lines · Kay Sievers
All the naming rules for the snd/ subdir can be removed on all recent systems, only the GROUP="audio" is needed.
No rules files should be installed in /etc, all files from packages belong into /lib.
OK.
Just noticed, that we have the GROUP="audio" stuff already in the main udev package. I think 40-alsa.rules can just go.
Thanks,
Kay
At Wed, 24 Nov 2010 11:50:28 +0100,
Quoted 25 lines · Kay Sievers
Quoted 9 lines · Takashi Iwai
Quoted 1 line · Kay Sievers
Now that both is merged, mind putting that in openSUSE Factory?
Sure. A few questions, though:
Quoted 3 lines
We need to enable systemd services with:
--with-systemdsystemunitdir=/lib/systemd/systemQuoted 6 lines
Quoted 3 lines
list the files/dirs in:
/lib/systemd/system/*.service
/lib/udev/rules.d/*.rulesThese come from alsa-utils, obviously. But alsa.rpm requires alsa-utils, so this should be OK.
Fine.
Quoted 5 lines
Quoted 4 lines
Drop the current custom udev rule:
/etc/udev/rules.d/40-alsa.rules
and use only the systemd one in/lib/udev/. It should work also for non-systemd setups.
Quoted 4 lines
Quoted 1 line
Do you mean I copy systemd's rules file to alsa.rpm...?
Can't we just let them get installed from alsa-utils.rpm? And drop the current rule from alsa.rpm?
Yes, we can.
Quoted 7 lines
Quoted 2 lines
We need a rules file for non-systemd (i.e. without systemd.rpm), so someone still needs to provide a udev stuff for sound, I suppose?
Oh, we just enable --with-systemd and install the systemd files and udev rules unconditionally, they don't pull systemd.rpm in, the systemd files will jsut be ignored on SYSV boxes, but the udev rule will still be used. That should work and is how it usually works.
Ah, so you mean 90-alsa-restore.rules in alsa-utils package, and drop 40-alsa.rules in the current alsa.rpm. OK, that's easy.
thanks,
Takashi
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
'Twas brillig, and Lennart Poettering at 23/11/10 02:16 did gyre and gimble:
Review
Quoted 2 lines
(quoted diff) +2
-0+udevrulesdir=/lib/udev/rules.d +
This doesn't appear to be used unless I missed something?
If it were used, I'd rather make this configurable. Obviously udev pretty much mandates this path but it's a PITA when doing non-root make installs to custom prefixes when it's hard coded like this. But like I say, this looks unused here...
Col
Signature · 10 lines
Colin Guthrie gmane(at)colin.guthr.ie http://colin.guthr.ie/ Day Job: Tribalogic Limited [http://www.tribalogic.net/] Open Source: Mageia Contributor [http://www.mageia.org/] PulseAudio Hacker [http://www.pulseaudio.org/] Trac Hacker [http://trac.edgewall.org/]
Quoted 11 lines · Colin Guthrie
'Twas brillig, and Lennart Poettering at 23/11/10 02:16 did gyre and gimble:
Review
Quoted 2 lines
(quoted diff) +2
-0+udevrulesdir=/lib/udev/rules.d +This doesn't appear to be used unless I missed something?
If it were used, I'd rather make this configurable. Obviously udev pretty much mandates this path but it's a PITA when doing non-root make installs to custom prefixes when it's hard coded like this. But like I say, this looks unused here...
Well, it still honours $(DESTDIR) logic.
It's referenced by the dist_udevrules_DATA= stanza.
Lennart
Signature · 1 line
Lennart Poettering - Red Hat, Inc.
'Twas brillig, and Lennart Poettering at 24/11/10 19:47 did gyre and gimble:
Quoted 9 lines · Colin Guthrie
Quoted 8 lines
'Twas brillig, and Lennart Poettering at 23/11/10 02:16 did gyre and gimble:
Review
Quoted 2 lines
(quoted diff) +2
-0+udevrulesdir=/lib/udev/rules.d +This doesn't appear to be used unless I missed something?
Quoted 6 lines
Quoted 4 lines
If it were used, I'd rather make this configurable. Obviously udev pretty much mandates this path but it's a PITA when doing non-root make installs to custom prefixes when it's hard coded like this. But like I say, this looks unused here...
Well, it still honours $(DESTDIR) logic.
Yeah but it's still a PITA for self-builds and (I'm told from Arun) some Gentoo stuff too.
Anyway, I've attached an entirely uncontroversial patch that fixes up any issues for those that care. Same as an earlier commit from last year in PulseAudio by Arun Raghavan.
Quoted 1 line
It's referenced by the dist_udevrules_DATA= stanza.
Ahh OK, I don't really grok auto* foo, but I can spot some pixie dust there that kinda makes sense :)
Cheers
Col
Signature · 10 lines
Colin Guthrie gmane(at)colin.guthr.ie http://colin.guthr.ie/ Day Job: Tribalogic Limited [http://www.tribalogic.net/] Open Source: Mageia Contributor [http://www.mageia.org/] PulseAudio Hacker [http://www.pulseaudio.org/] Trac Hacker [http://trac.edgewall.org/]
Quoted 1 line
From
aee9d692defc05f2599363f0456cc837c3ef9a05Mon Sep 17 00:00:00 2001
From: Colin Guthrie <[email protected]>
Date: Thu, 25 Nov 2010 21:40:25 +0000
Subject: [PATCH] alsactl: Add a --with-udev-rules-dir configure option.
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.
--- alsactl/Makefile.am | 2 -- configure.in | 6 ++++++ 2 files changed, 6 insertions(+), 2 deletions(-)
alsactl/Makefile.am +0 -2
@@ -11,8 +11,6 @@ alsactl_SOURCES=alsactl.c state.c utils.c init_parse.c alsactl_CFLAGS=$(AM_CFLAGS) -DSYS_ASOUNDRC=\"$(ASOUND_STATE_DIR)/asound.state\" noinst_HEADERS=alsactl.h list.h init_sysdeps.c init_utils_string.c init_utils_run.c init_sysfs.c -udevrulesdir=/lib/udev/rules.d - dist_udevrules_DATA = \ 90-alsa-restore.rules
configure.in +6 -0
@@ -112,6 +112,12 @@ if test x"$alsaconf" = xtrue; then fi AM_CONDITIONAL(USE_XMLTO, test x"$xmlto" = xyes) +AC_ARG_WITH( + [udev-rules-dir], + AS_HELP_STRING([--with-udev-rules-dir],[Directory where to install udev rules to (defaults to /lib/udev/rules.d)]), + [udevrulesdir=$withval], [udevrulesdir="/lib/udev/rules.d"]) +AC_SUBST(udevrulesdir) + dnl Checks for header files. AC_HEADER_STDC if test x$alsamixer = xtrue; then
Signature · 1 line
1.7.3.2
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
At Tue, 23 Nov 2010 18:05:00 +0100,
Quoted 20 lines · Kay Sievers
Quoted 2 lines · Takashi Iwai
The second patch looks good to me. It doesn't break, at least. I'm going to apply it unless anyone else has specific objection.
Now that both is merged, mind putting that in openSUSE Factory?
We need to enable systemd services with:
--with-systemdsystemunitdir=/lib/systemd/systemlist the files/dirs in:
/lib/systemd/system/*.service
/lib/udev/rules.d/*.rulesDrop the current custom udev rule:
/etc/udev/rules.d/40-alsa.rules
and use only the systemd one in/lib/udev/. It should work also for non-systemd setups.
Quoted 5 lines
All the naming rules for the snd/ subdir can be removed on all recent systems, only the GROUP="audio" is needed.
No rules files should be installed in /etc, all files from packages belong into /lib.
Now I fixed all these on OBS multimedia:libs project. The only question is the below one:
Quoted 5 lines
The old SYSV init script:
/etc/init.d/alsasound
should be linked to:
/lib/systemd/system/alsasound.service-> alsa-restore.service
so that the init script will not be executed on systemd bootups.
Do you mean to create a symlink
/lib/systemd/system/alsasound.service -> alsa-restore.service
corresponding to /etc/init.d/alsasound, while keeping /etc/init.d/alsasound as is?
If so, this will also belong to alsa-utils.rpm, I suppose. Otherwise we'll get a circular dependency.
thanks,
Takashi
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Quoted 37 lines · Takashi Iwai
At Tue, 23 Nov 2010 18:05:00 +0100,
Quoted 20 lines · Kay Sievers
Quoted 2 lines · Takashi Iwai
The second patch looks good to me. It doesn't break, at least. I'm going to apply it unless anyone else has specific objection.
Now that both is merged, mind putting that in openSUSE Factory?
We need to enable systemd services with:
--with-systemdsystemunitdir=/lib/systemd/systemlist the files/dirs in:
/lib/systemd/system/*.service
/lib/udev/rules.d/*.rulesDrop the current custom udev rule:
/etc/udev/rules.d/40-alsa.rules
and use only the systemd one in/lib/udev/. It should work also for non-systemd setups.Quoted 5 lines
All the naming rules for the snd/ subdir can be removed on all recent systems, only the GROUP="audio" is needed.
No rules files should be installed in /etc, all files from packages belong into /lib.
Now I fixed all these on OBS multimedia:libs project. The only question is the below one:
Quoted 5 lines
The old SYSV init script:
/etc/init.d/alsasound
should be linked to:
/lib/systemd/system/alsasound.service-> alsa-restore.service so that the init script will not be executed on systemd bootups.
Quoted 4 lines
Do you mean to create a symlink
/lib/systemd/system/alsasound.service-> alsa-restore.service
Yes, so:
systemctl start alsasound.service
works, and the old init script is not started anymore by the SVSV compat code.
Quoted 2 lines
corresponding to
/etc/init.d/alsasound, while keeping/etc/init.d/alsasoundas is?
Yes, for non-systemd boots.
Quoted 2 lines
If so, this will also belong to alsa-utils.rpm, I suppose. Otherwise we'll get a circular dependency.
Sure, it does not matter as long as the link is there. :)
Thanks a lot,
Kay
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
At Fri, 26 Nov 2010 12:50:00 +0100,
Quoted 51 lines · Kay Sievers
Quoted 37 lines · Takashi Iwai
At Tue, 23 Nov 2010 18:05:00 +0100,
Quoted 20 lines · Kay Sievers
Quoted 2 lines · Takashi Iwai
The second patch looks good to me. It doesn't break, at least. I'm going to apply it unless anyone else has specific objection.
Now that both is merged, mind putting that in openSUSE Factory?
We need to enable systemd services with:
--with-systemdsystemunitdir=/lib/systemd/systemlist the files/dirs in:
/lib/systemd/system/*.service
/lib/udev/rules.d/*.rulesDrop the current custom udev rule:
/etc/udev/rules.d/40-alsa.rules
and use only the systemd one in/lib/udev/. It should work also for non-systemd setups.Quoted 5 lines
All the naming rules for the snd/ subdir can be removed on all recent systems, only the GROUP="audio" is needed.
No rules files should be installed in /etc, all files from packages belong into /lib.
Now I fixed all these on OBS multimedia:libs project. The only question is the below one:
Quoted 5 lines
The old SYSV init script:
/etc/init.d/alsasound
should be linked to:
/lib/systemd/system/alsasound.service-> alsa-restore.service so that the init script will not be executed on systemd bootups.Quoted 4 lines
Do you mean to create a symlink
/lib/systemd/system/alsasound.service-> alsa-restore.serviceYes, so:
systemctl start alsasound.service
works, and the old init script is not started anymore by the SVSV compat code.Quoted 2 lines
corresponding to
/etc/init.d/alsasound, while keeping/etc/init.d/alsasoundas is?
Quoted 6 lines
Yes, for non-systemd boots.
Quoted 2 lines
If so, this will also belong to alsa-utils.rpm, I suppose. Otherwise we'll get a circular dependency.
Sure, it does not matter as long as the link is there. :)
OK, done now. I'm going to submit to FACTORY later once after checking the builds in multimedia:libs repo.
Thanks!
Takashi
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Quoted 4 lines · Takashi Iwai
At Fri, 26 Nov 2010 12:50:00 +0100, Kay Sievers wrote:
OK, done now. I'm going to submit to FACTORY later once after checking the builds in multimedia:libs repo.
Thanks! Seems to work fine for me after I created /var/run/alsa/.
That should be done in the tool itself, or just package it in the RPM?
Kay
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
At Tue, 30 Nov 2010 07:12:41 +0100,
Quoted 8 lines · Kay Sievers
Quoted 4 lines · Takashi Iwai
At Fri, 26 Nov 2010 12:50:00 +0100, Kay Sievers wrote:
OK, done now. I'm going to submit to FACTORY later once after checking the builds in multimedia:libs repo.
Thanks! Seems to work fine for me after I created
/var/run/alsa/.
Do you mean /var/lib/alsa?
Quoted 1 line
That should be done in the tool itself, or just package it in the RPM?
This should have been included in alsa-utils.rpm. I'll fix it.
thanks,
Takashi
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Quoted 4 lines · Takashi Iwai
At Tue, 30 Nov 2010 07:12:41 +0100,
Quoted 2 lines · Kay Sievers
On Fri, Nov 26, 2010 at 12:57, Takashi Iwai <[email protected]> wrote:
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
At Fri, 26 Nov 2010 12:50:00 +0100, Kay Sievers wrote:
OK, done now. I'm going to submit to FACTORY later once after checking the builds in multimedia:libs repo.
Thanks! Seems to work fine for me after I created
/var/run/alsa/.Do you mean
/var/lib/alsa?
Oh, sure, you are right.
Quoted 3 lines
Quoted 1 line
That should be done in the tool itself, or just package it in the RPM?
This should have been included in alsa-utils.rpm. I'll fix it.
Great.
Thanks,
Kay
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel