All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCHES] Integrate minimal systemd support in alsa-utils
@ 2010-11-23  2:16 Lennart Poettering
  2010-11-23  6:07 ` Takashi Iwai
                   ` (4 more replies)
  0 siblings, 5 replies; 24+ messages in thread
From: Lennart Poettering @ 2010-11-23  2:16 UTC (permalink / raw)
  To: tiwai, ALSA Development Mailing List, jkysela, Kay Sievers

[-- Attachment #1: Type: text/plain, Size: 914 bytes --]

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

-- 
Lennart Poettering - Red Hat, Inc.

[-- Attachment #2: 0001-Move-asound.state-location-to-var-lib-alsa.patch --]
[-- Type: text/x-diff, Size: 2238 bytes --]

>From c5b414489626fcd46d792ab96db06e254dfeff90 Mon Sep 17 00:00:00 2001
From: David B. Harris <david@eelf.ddts.net>
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(-)

diff --git a/alsaconf/alsaconf.in b/alsaconf/alsaconf.in
index ccc1b37..b9815d1 100644
--- a/alsaconf/alsaconf.in
+++ b/alsaconf/alsaconf.in
@@ -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
diff --git a/alsactl/alsactl.1 b/alsactl/alsactl.1
index eb3cbd1..eb5968c 100644
--- a/alsactl/alsactl.1
+++ b/alsactl/alsactl.1
@@ -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
diff --git a/alsactl/alsactl.c b/alsactl/alsactl.c
index 3b5dfda..59f0738 100644
--- a/alsactl/alsactl.c
+++ b/alsactl/alsactl.c
@@ -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;
-- 
1.7.3.2


[-- Attachment #3: 0002-alsactl-systemd-and-udev-hookup.patch --]
[-- Type: text/x-diff, Size: 7268 bytes --]

>From 2925d59fd4a451ab36e704ea09984a6a70c358a7 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
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

diff --git a/Makefile.am b/Makefile.am
index 9951c46..62e1ba6 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -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)
diff --git a/alsactl/.gitignore b/alsactl/.gitignore
new file mode 100644
index 0000000..56ab3a2
--- /dev/null
+++ b/alsactl/.gitignore
@@ -0,0 +1,3 @@
+alsa-store.service
+alsa-restore.service
+90-alsa-restore.rules
diff --git a/alsactl/90-alsa-restore.rules.in b/alsactl/90-alsa-restore.rules.in
new file mode 100644
index 0000000..0bcee5b
--- /dev/null
+++ b/alsactl/90-alsa-restore.rules.in
@@ -0,0 +1,2 @@
+ACTION=="add", SUBSYSTEM=="sound", KERNEL=="controlC*", KERNELS=="card*", \
+        RUN+="@sbindir@/alsactl restore $attr{number}"
diff --git a/alsactl/Makefile.am b/alsactl/Makefile.am
index 359f73a..9a2d30e 100644
--- a/alsactl/Makefile.am
+++ b/alsactl/Makefile.am
@@ -10,5 +10,51 @@ EXTRA_DIST=alsactl.1 alsactl_init.xml
 alsactl_SOURCES=alsactl.c state.c utils.c init_parse.c
 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
+
+if HAVE_SYSTEMD
+
+systemdsystemunit_DATA = \
+	alsa-store.service \
+	alsa-restore.service
+
+install-data-hook:
+	$(MKDIR_P) -m 0755 \
+		$(DESTDIR)$(systemdsystemunitdir)/basic.target.wants \
+		$(DESTDIR)$(systemdsystemunitdir)/shutdown.target.wants
+	( cd $(DESTDIR)$(systemdsystemunitdir)/basic.target.wants && \
+	        rm -f alsa-restore.service && \
+		$(LN_S) ../alsa-restore.service alsa-restore.service )
+	( cd $(DESTDIR)$(systemdsystemunitdir)/shutdown.target.wants && \
+	        rm -f alsa-store.service && \
+		$(LN_S) ../alsa-store.service alsa-store.service )
+
+endif
+
+edit = \
+	sed $(SED) -r 's,@sbindir\@,$(sbindir),g' < $< > $@ || rm $@
+
+alsa-store.service: alsa-store.service.in
+	$(edit)
+
+alsa-restore.service: alsa-restore.service.in
+	$(edit)
+
+90-alsa-restore.rules: 90-alsa-restore.rules.in
+	$(edit)
+
+EXTRA_DIST += \
+	alsa-store.service.in \
+	alsa-restore.service.in \
+	90-alsa-restore.rules.in
+
+CLEANFILES = \
+	alsa-store.service \
+	alsa-restore.service \
+	90-alsa-restore.rules
+
 %.7: %.xml
 	xmlto man $?
diff --git a/alsactl/alsa-restore.service.in b/alsactl/alsa-restore.service.in
new file mode 100644
index 0000000..e97d196
--- /dev/null
+++ b/alsactl/alsa-restore.service.in
@@ -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
diff --git a/alsactl/alsa-store.service.in b/alsactl/alsa-store.service.in
new file mode 100644
index 0000000..0e2823c
--- /dev/null
+++ b/alsactl/alsa-store.service.in
@@ -0,0 +1,9 @@
+[Unit]
+Description=Store Sound Card State
+DefaultDependencies=no
+Before=shutdown.target
+
+[Service]
+Type=oneshot
+ExecStart=@sbindir@/alsactl store
+StandardOutput=syslog
diff --git a/configure.in b/configure.in
index 31fd581..54ea74c 100644
--- a/configure.in
+++ b/configure.in
@@ -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 \
-- 
1.7.3.2


[-- Attachment #4: Type: text/plain, Size: 160 bytes --]

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* Re: [PATCHES] Integrate minimal systemd support in alsa-utils
  2010-11-23  2:16 [PATCHES] Integrate minimal systemd support in alsa-utils Lennart Poettering
@ 2010-11-23  6:07 ` Takashi Iwai
  2010-11-23  6:16 ` Takashi Iwai
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 24+ messages in thread
From: Takashi Iwai @ 2010-11-23  6:07 UTC (permalink / raw)
  To: Lennart Poettering; +Cc: ALSA Development Mailing List, Kay Sievers, jkysela

At Tue, 23 Nov 2010 03:16:58 +0100,
Lennart Poettering wrote:
> 
> >From c5b414489626fcd46d792ab96db06e254dfeff90 Mon Sep 17 00:00:00 2001
> From: David B. Harris <david@eelf.ddts.net>
> 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


> ---
>  alsaconf/alsaconf.in |    4 ++--
>  alsactl/alsactl.1    |    4 ++--
>  alsactl/alsactl.c    |    2 +-
>  3 files changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/alsaconf/alsaconf.in b/alsaconf/alsaconf.in
> index ccc1b37..b9815d1 100644
> --- a/alsaconf/alsaconf.in
> +++ b/alsaconf/alsaconf.in
> @@ -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
> diff --git a/alsactl/alsactl.1 b/alsactl/alsactl.1
> index eb3cbd1..eb5968c 100644
> --- a/alsactl/alsactl.1
> +++ b/alsactl/alsactl.1
> @@ -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
> diff --git a/alsactl/alsactl.c b/alsactl/alsactl.c
> index 3b5dfda..59f0738 100644
> --- a/alsactl/alsactl.c
> +++ b/alsactl/alsactl.c
> @@ -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;
> -- 
> 1.7.3.2
> 

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCHES] Integrate minimal systemd support in alsa-utils
  2010-11-23  2:16 [PATCHES] Integrate minimal systemd support in alsa-utils Lennart Poettering
  2010-11-23  6:07 ` Takashi Iwai
@ 2010-11-23  6:16 ` Takashi Iwai
  2010-11-23 17:05   ` Kay Sievers
  2010-11-23  7:08 ` David Henningsson
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 24+ messages in thread
From: Takashi Iwai @ 2010-11-23  6:16 UTC (permalink / raw)
  To: Lennart Poettering; +Cc: ALSA Development Mailing List, Kay Sievers, jkysela

At Tue, 23 Nov 2010 03:16:58 +0100,
Lennart Poettering wrote:
> 
> 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.

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

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCHES] Integrate minimal systemd support in alsa-utils
  2010-11-23  2:16 [PATCHES] Integrate minimal systemd support in alsa-utils Lennart Poettering
  2010-11-23  6:07 ` Takashi Iwai
  2010-11-23  6:16 ` Takashi Iwai
@ 2010-11-23  7:08 ` David Henningsson
  2010-11-23 11:42   ` Lennart Poettering
  2010-11-23  9:44 ` Jaroslav Kysela
  2010-11-24 17:55 ` Colin Guthrie
  4 siblings, 1 reply; 24+ messages in thread
From: David Henningsson @ 2010-11-23  7:08 UTC (permalink / raw)
  To: mznyfn; +Cc: tiwai, ALSA Development Mailing List, Kay Sievers, jkysela

On 2010-11-23 03:16, Lennart Poettering wrote:
> 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).

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.

> 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.

-- 
David Henningsson, Canonical Ltd.
http://launchpad.net/~diwic

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCHES] Integrate minimal systemd support in alsa-utils
  2010-11-23  2:16 [PATCHES] Integrate minimal systemd support in alsa-utils Lennart Poettering
                   ` (2 preceding siblings ...)
  2010-11-23  7:08 ` David Henningsson
@ 2010-11-23  9:44 ` Jaroslav Kysela
  2010-11-23 14:43   ` Lennart Poettering
  2010-11-24 17:55 ` Colin Guthrie
  4 siblings, 1 reply; 24+ messages in thread
From: Jaroslav Kysela @ 2010-11-23  9:44 UTC (permalink / raw)
  To: Lennart Poettering
  Cc: Takashi Iwai, ALSA Development Mailing List, Kay Sievers, jkysela

On Tue, 23 Nov 2010, Lennart Poettering wrote:

> 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.

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.

> 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 <perex@perex.cz>
Linux Kernel Sound Maintainer
ALSA Project, Red Hat, Inc.

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCHES] Integrate minimal systemd support in alsa-utils
  2010-11-23  7:08 ` David Henningsson
@ 2010-11-23 11:42   ` Lennart Poettering
  2010-11-23 13:55     ` David Henningsson
  0 siblings, 1 reply; 24+ messages in thread
From: Lennart Poettering @ 2010-11-23 11:42 UTC (permalink / raw)
  To: David Henningsson
  Cc: tiwai, ALSA Development Mailing List, Kay Sievers, jkysela

On Tue, 23.11.10 08:08, David Henningsson (david.henningsson@canonical.com) wrote:

> >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.

> 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.

> >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

-- 
Lennart Poettering - Red Hat, Inc.

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCHES] Integrate minimal systemd support in alsa-utils
  2010-11-23 11:42   ` Lennart Poettering
@ 2010-11-23 13:55     ` David Henningsson
  2010-11-23 14:58       ` Daniel Chen
  0 siblings, 1 reply; 24+ messages in thread
From: David Henningsson @ 2010-11-23 13:55 UTC (permalink / raw)
  To: Lennart Poettering; +Cc: ALSA Development Mailing List

On 2010-11-23 12:42, Lennart Poettering wrote:
> On Tue, 23.11.10 08:08, David Henningsson (david.henningsson@canonical.com) wrote:
>
>>> 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.

Ok.

>> 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?

>>> 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.

> 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.)

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.

-- 
David Henningsson, Canonical Ltd.
http://launchpad.net/~diwic

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCHES] Integrate minimal systemd support in alsa-utils
  2010-11-23  9:44 ` Jaroslav Kysela
@ 2010-11-23 14:43   ` Lennart Poettering
  2010-11-23 14:53     ` Jaroslav Kysela
  0 siblings, 1 reply; 24+ messages in thread
From: Lennart Poettering @ 2010-11-23 14:43 UTC (permalink / raw)
  To: Jaroslav Kysela
  Cc: Takashi Iwai, ALSA Development Mailing List, Kay Sievers, jkysela

[-- Attachment #1: Type: text/plain, Size: 1324 bytes --]

On Tue, 23.11.10 10:44, Jaroslav Kysela (perex@perex.cz) wrote:

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.
> 
> 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.

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.

> > 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

-- 
Lennart Poettering - Red Hat, Inc.

[-- Attachment #2: 0001-Move-asound.state-location-to-var-lib-alsa-and-add-c.patch --]
[-- Type: text/x-diff, Size: 4114 bytes --]

>From 9751c6f8f13116d12a4d8393d5f0b8d43e328e1d Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
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(-)

diff --git a/Makefile.am b/Makefile.am
index 62e1ba6..48a4780 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -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)
diff --git a/alsaconf/alsaconf.in b/alsaconf/alsaconf.in
index ccc1b37..cf87784 100644
--- a/alsaconf/alsaconf.in
+++ b/alsaconf/alsaconf.in
@@ -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
diff --git a/alsactl/Makefile.am b/alsactl/Makefile.am
index 9a2d30e..721b619 100644
--- a/alsactl/Makefile.am
+++ b/alsactl/Makefile.am
@@ -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
diff --git a/alsactl/alsactl.1 b/alsactl/alsactl.1
index eb3cbd1..eb5968c 100644
--- a/alsactl/alsactl.1
+++ b/alsactl/alsactl.1
@@ -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
diff --git a/alsactl/alsactl.c b/alsactl/alsactl.c
index 3b5dfda..57436f7 100644
--- a/alsactl/alsactl.c
+++ b/alsactl/alsactl.c
@@ -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;
diff --git a/configure.in b/configure.in
index 54ea74c..94a2b17 100644
--- a/configure.in
+++ b/configure.in
@@ -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 \
-- 
1.7.3.2


[-- Attachment #3: Type: text/plain, Size: 160 bytes --]

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* Re: [PATCHES] Integrate minimal systemd support in alsa-utils
  2010-11-23 14:43   ` Lennart Poettering
@ 2010-11-23 14:53     ` Jaroslav Kysela
  0 siblings, 0 replies; 24+ messages in thread
From: Jaroslav Kysela @ 2010-11-23 14:53 UTC (permalink / raw)
  To: Lennart Poettering
  Cc: Takashi Iwai, ALSA Development Mailing List, Kay Sievers, jkysela

On Tue, 23 Nov 2010, Lennart Poettering wrote:

> On Tue, 23.11.10 10:44, Jaroslav Kysela (perex@perex.cz) wrote:
>
> 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.
>>
>> 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.
>
> 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 <perex@perex.cz>
Linux Kernel Sound Maintainer
ALSA Project, Red Hat, Inc.

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCHES] Integrate minimal systemd support in alsa-utils
  2010-11-23 13:55     ` David Henningsson
@ 2010-11-23 14:58       ` Daniel Chen
  0 siblings, 0 replies; 24+ messages in thread
From: Daniel Chen @ 2010-11-23 14:58 UTC (permalink / raw)
  To: Lennart Poettering; +Cc: ALSA Development Mailing List, David Henningsson

On 2010-11-23 12:42, Lennart Poettering wrote:
>> i.e. Ubuntu duplicates the mixer init database in an init script
>> /sbin/alsa-utils which 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

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCHES] Integrate minimal systemd support in alsa-utils
  2010-11-23  6:16 ` Takashi Iwai
@ 2010-11-23 17:05   ` Kay Sievers
  2010-11-24  5:40     ` Takashi Iwai
  2010-11-26  8:36     ` Takashi Iwai
  0 siblings, 2 replies; 24+ messages in thread
From: Kay Sievers @ 2010-11-23 17:05 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: ALSA Development Mailing List, jkysela, Lennart Poettering

On Tue, Nov 23, 2010 at 07:16, Takashi Iwai <tiwai@suse.de> wrote:

> 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
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCHES] Integrate minimal systemd support in alsa-utils
  2010-11-23 17:05   ` Kay Sievers
@ 2010-11-24  5:40     ` Takashi Iwai
  2010-11-24 10:50       ` Kay Sievers
  2010-11-24 11:04       ` Kay Sievers
  2010-11-26  8:36     ` Takashi Iwai
  1 sibling, 2 replies; 24+ messages in thread
From: Takashi Iwai @ 2010-11-24  5:40 UTC (permalink / raw)
  To: Kay Sievers; +Cc: ALSA Development Mailing List, jkysela, Lennart Poettering

At Tue, 23 Nov 2010 18:05:00 +0100,
Kay Sievers wrote:
> 
> On Tue, Nov 23, 2010 at 07:16, Takashi Iwai <tiwai@suse.de> wrote:
> 
> > 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:

> 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

These come from alsa-utils, obviously.  But alsa.rpm requires
alsa-utils, so this should be OK.

> 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?

> 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. 

> 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
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCHES] Integrate minimal systemd support in alsa-utils
  2010-11-24  5:40     ` Takashi Iwai
@ 2010-11-24 10:50       ` Kay Sievers
  2010-11-24 11:08         ` Takashi Iwai
  2010-11-24 11:04       ` Kay Sievers
  1 sibling, 1 reply; 24+ messages in thread
From: Kay Sievers @ 2010-11-24 10:50 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: ALSA Development Mailing List, jkysela, Lennart Poettering

On Wed, Nov 24, 2010 at 06:40, Takashi Iwai <tiwai@suse.de> wrote:
> At Tue, 23 Nov 2010 18:05:00 +0100, Kay Sievers wrote:

>> Now that both is merged, mind putting that in openSUSE Factory?
>
> Sure.  A few questions, though:
>
>> 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
>
> These come from alsa-utils, obviously.  But alsa.rpm requires
> alsa-utils, so this should be OK.

Fine.

>> 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?

> 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
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCHES] Integrate minimal systemd support in alsa-utils
  2010-11-24  5:40     ` Takashi Iwai
  2010-11-24 10:50       ` Kay Sievers
@ 2010-11-24 11:04       ` Kay Sievers
  1 sibling, 0 replies; 24+ messages in thread
From: Kay Sievers @ 2010-11-24 11:04 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: ALSA Development Mailing List, jkysela, Lennart Poettering

On Wed, Nov 24, 2010 at 06:40, Takashi Iwai <tiwai@suse.de> wrote:
> At Tue, 23 Nov 2010 18:05:00 +0100, Kay Sievers wrote:

>> 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

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCHES] Integrate minimal systemd support in alsa-utils
  2010-11-24 10:50       ` Kay Sievers
@ 2010-11-24 11:08         ` Takashi Iwai
  0 siblings, 0 replies; 24+ messages in thread
From: Takashi Iwai @ 2010-11-24 11:08 UTC (permalink / raw)
  To: Kay Sievers; +Cc: ALSA Development Mailing List, jkysela, Lennart Poettering

At Wed, 24 Nov 2010 11:50:28 +0100,
Kay Sievers wrote:
> 
> On Wed, Nov 24, 2010 at 06:40, Takashi Iwai <tiwai@suse.de> wrote:
> > At Tue, 23 Nov 2010 18:05:00 +0100, Kay Sievers wrote:
> 
> >> Now that both is merged, mind putting that in openSUSE Factory?
> >
> > Sure.  A few questions, though:
> >
> >> 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
> >
> > These come from alsa-utils, obviously.  But alsa.rpm requires
> > alsa-utils, so this should be OK.
> 
> Fine.
> 
> >> 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?

Yes, we can.

> > 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
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCHES] Integrate minimal systemd support in alsa-utils
  2010-11-23  2:16 [PATCHES] Integrate minimal systemd support in alsa-utils Lennart Poettering
                   ` (3 preceding siblings ...)
  2010-11-23  9:44 ` Jaroslav Kysela
@ 2010-11-24 17:55 ` Colin Guthrie
  2010-11-24 19:47   ` Lennart Poettering
  4 siblings, 1 reply; 24+ messages in thread
From: Colin Guthrie @ 2010-11-24 17:55 UTC (permalink / raw)
  To: alsa-devel

'Twas brillig, and Lennart Poettering at 23/11/10 02:16 did gyre and gimble:
> +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

-- 

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/]

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCHES] Integrate minimal systemd support in alsa-utils
  2010-11-24 17:55 ` Colin Guthrie
@ 2010-11-24 19:47   ` Lennart Poettering
  2010-11-25 21:45     ` Colin Guthrie
  0 siblings, 1 reply; 24+ messages in thread
From: Lennart Poettering @ 2010-11-24 19:47 UTC (permalink / raw)
  To: Colin Guthrie; +Cc: alsa-devel

On Wed, 24.11.10 17:55, Colin Guthrie (gmane@colin.guthr.ie) wrote:

> 
> 'Twas brillig, and Lennart Poettering at 23/11/10 02:16 did gyre and gimble:
> > +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

-- 
Lennart Poettering - Red Hat, Inc.

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCHES] Integrate minimal systemd support in alsa-utils
  2010-11-24 19:47   ` Lennart Poettering
@ 2010-11-25 21:45     ` Colin Guthrie
  0 siblings, 0 replies; 24+ messages in thread
From: Colin Guthrie @ 2010-11-25 21:45 UTC (permalink / raw)
  To: alsa-devel

[-- Attachment #1: Type: text/plain, Size: 1358 bytes --]

'Twas brillig, and Lennart Poettering at 24/11/10 19:47 did gyre and gimble:
> On Wed, 24.11.10 17:55, Colin Guthrie (gmane@colin.guthr.ie) wrote:
> 
>>
>> 'Twas brillig, and Lennart Poettering at 23/11/10 02:16 did gyre and gimble:
>>> +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.

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.


> 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

-- 

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/]

[-- Attachment #2: 0001-alsactl-Add-a-with-udev-rules-dir-configure-option.patch --]
[-- Type: text/x-patch, Size: 1752 bytes --]

>From aee9d692defc05f2599363f0456cc837c3ef9a05 Mon Sep 17 00:00:00 2001
From: Colin Guthrie <cguthrie@mandriva.org>
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(-)

diff --git a/alsactl/Makefile.am b/alsactl/Makefile.am
index 721b619..5cfc415 100644
--- a/alsactl/Makefile.am
+++ b/alsactl/Makefile.am
@@ -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
 
diff --git a/configure.in b/configure.in
index 94a2b17..5b3491d 100644
--- a/configure.in
+++ b/configure.in
@@ -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
-- 
1.7.3.2


[-- Attachment #3: Type: text/plain, Size: 160 bytes --]

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* Re: [PATCHES] Integrate minimal systemd support in alsa-utils
  2010-11-23 17:05   ` Kay Sievers
  2010-11-24  5:40     ` Takashi Iwai
@ 2010-11-26  8:36     ` Takashi Iwai
  2010-11-26 11:50       ` Kay Sievers
  1 sibling, 1 reply; 24+ messages in thread
From: Takashi Iwai @ 2010-11-26  8:36 UTC (permalink / raw)
  To: Kay Sievers; +Cc: ALSA Development Mailing List, jkysela, Lennart Poettering

At Tue, 23 Nov 2010 18:05:00 +0100,
Kay Sievers wrote:
> 
> On Tue, Nov 23, 2010 at 07:16, Takashi Iwai <tiwai@suse.de> wrote:
> 
> > 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.

Now I fixed all these on OBS multimedia:libs project.
The only question is the below one:

> 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
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCHES] Integrate minimal systemd support in alsa-utils
  2010-11-26  8:36     ` Takashi Iwai
@ 2010-11-26 11:50       ` Kay Sievers
  2010-11-26 11:57         ` Takashi Iwai
  0 siblings, 1 reply; 24+ messages in thread
From: Kay Sievers @ 2010-11-26 11:50 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: ALSA Development Mailing List, jkysela, Lennart Poettering

On Fri, Nov 26, 2010 at 09:36, Takashi Iwai <tiwai@suse.de> wrote:
> At Tue, 23 Nov 2010 18:05:00 +0100,
> Kay Sievers wrote:
>>
>> On Tue, Nov 23, 2010 at 07:16, Takashi Iwai <tiwai@suse.de> wrote:
>>
>> > 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.
>
> Now I fixed all these on OBS multimedia:libs project.
> The only question is the below one:
>
>> 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
>

Yes, so:
  systemctl start alsasound.service
works, and the old init script is not started anymore by the SVSV compat code.

> corresponding to /etc/init.d/alsasound, while keeping
> /etc/init.d/alsasound as is?

Yes, for non-systemd boots.

> 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
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCHES] Integrate minimal systemd support in alsa-utils
  2010-11-26 11:50       ` Kay Sievers
@ 2010-11-26 11:57         ` Takashi Iwai
  2010-11-30  6:12           ` Kay Sievers
  0 siblings, 1 reply; 24+ messages in thread
From: Takashi Iwai @ 2010-11-26 11:57 UTC (permalink / raw)
  To: Kay Sievers; +Cc: ALSA Development Mailing List, jkysela, Lennart Poettering

At Fri, 26 Nov 2010 12:50:00 +0100,
Kay Sievers wrote:
> 
> On Fri, Nov 26, 2010 at 09:36, Takashi Iwai <tiwai@suse.de> wrote:
> > At Tue, 23 Nov 2010 18:05:00 +0100,
> > Kay Sievers wrote:
> >>
> >> On Tue, Nov 23, 2010 at 07:16, Takashi Iwai <tiwai@suse.de> wrote:
> >>
> >> > 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.
> >
> > Now I fixed all these on OBS multimedia:libs project.
> > The only question is the below one:
> >
> >> 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
> >
> 
> Yes, so:
>   systemctl start alsasound.service
> works, and the old init script is not started anymore by the SVSV compat code.
> 
> > corresponding to /etc/init.d/alsasound, while keeping
> > /etc/init.d/alsasound as is?
> 
> Yes, for non-systemd boots.
> 
> > 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
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCHES] Integrate minimal systemd support in alsa-utils
  2010-11-26 11:57         ` Takashi Iwai
@ 2010-11-30  6:12           ` Kay Sievers
  2010-11-30  7:06             ` Takashi Iwai
  0 siblings, 1 reply; 24+ messages in thread
From: Kay Sievers @ 2010-11-30  6:12 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: ALSA Development Mailing List, jkysela, Lennart Poettering

On Fri, Nov 26, 2010 at 12:57, Takashi Iwai <tiwai@suse.de> wrote:
> 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
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCHES] Integrate minimal systemd support in alsa-utils
  2010-11-30  6:12           ` Kay Sievers
@ 2010-11-30  7:06             ` Takashi Iwai
  2010-11-30  9:35               ` Kay Sievers
  0 siblings, 1 reply; 24+ messages in thread
From: Takashi Iwai @ 2010-11-30  7:06 UTC (permalink / raw)
  To: Kay Sievers; +Cc: ALSA Development Mailing List, jkysela, Lennart Poettering

At Tue, 30 Nov 2010 07:12:41 +0100,
Kay Sievers wrote:
> 
> On Fri, Nov 26, 2010 at 12:57, Takashi Iwai <tiwai@suse.de> wrote:
> > 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?

> 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
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCHES] Integrate minimal systemd support in alsa-utils
  2010-11-30  7:06             ` Takashi Iwai
@ 2010-11-30  9:35               ` Kay Sievers
  0 siblings, 0 replies; 24+ messages in thread
From: Kay Sievers @ 2010-11-30  9:35 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: ALSA Development Mailing List, jkysela, Lennart Poettering

On Tue, Nov 30, 2010 at 08:06, Takashi Iwai <tiwai@suse.de> wrote:
> At Tue, 30 Nov 2010 07:12:41 +0100,
> Kay Sievers wrote:
>>
>> On Fri, Nov 26, 2010 at 12:57, Takashi Iwai <tiwai@suse.de> wrote:
>> > 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.

>> 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
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2010-11-30  9:36 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-23  2:16 [PATCHES] Integrate minimal systemd support in alsa-utils Lennart Poettering
2010-11-23  6:07 ` Takashi Iwai
2010-11-23  6:16 ` Takashi Iwai
2010-11-23 17:05   ` Kay Sievers
2010-11-24  5:40     ` Takashi Iwai
2010-11-24 10:50       ` Kay Sievers
2010-11-24 11:08         ` Takashi Iwai
2010-11-24 11:04       ` Kay Sievers
2010-11-26  8:36     ` Takashi Iwai
2010-11-26 11:50       ` Kay Sievers
2010-11-26 11:57         ` Takashi Iwai
2010-11-30  6:12           ` Kay Sievers
2010-11-30  7:06             ` Takashi Iwai
2010-11-30  9:35               ` Kay Sievers
2010-11-23  7:08 ` David Henningsson
2010-11-23 11:42   ` Lennart Poettering
2010-11-23 13:55     ` David Henningsson
2010-11-23 14:58       ` Daniel Chen
2010-11-23  9:44 ` Jaroslav Kysela
2010-11-23 14:43   ` Lennart Poettering
2010-11-23 14:53     ` Jaroslav Kysela
2010-11-24 17:55 ` Colin Guthrie
2010-11-24 19:47   ` Lennart Poettering
2010-11-25 21:45     ` Colin Guthrie

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.