From patchwork Fri Jun 13 09:05:52 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Henningsson X-Patchwork-Id: 4347731 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 0135B9F314 for ; Fri, 13 Jun 2014 09:07:08 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 08FC920266 for ; Fri, 13 Jun 2014 09:07:07 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id DC65120219 for ; Fri, 13 Jun 2014 09:07:04 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id C4598261A29; Fri, 13 Jun 2014 11:07:03 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-0.2 required=5.0 tests=BAYES_00, UNPARSEABLE_RELAY, URIBL_BLACK autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id EA2E2261A3D; Fri, 13 Jun 2014 11:06:14 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id E4AE0261A3D; Fri, 13 Jun 2014 11:06:13 +0200 (CEST) Received: from youngberry.canonical.com (youngberry.canonical.com [91.189.89.112]) by alsa0.perex.cz (Postfix) with ESMTP id DB2C7261A8C for ; Fri, 13 Jun 2014 11:05:50 +0200 (CEST) Received: from hd9483857.selulk5.dyn.perspektivbredband.net ([217.72.56.87] helo=[192.168.8.102]) by youngberry.canonical.com with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1WvNQk-00034q-63; Fri, 13 Jun 2014 09:05:50 +0000 Message-ID: <539ABEF0.7020508@canonical.com> Date: Fri, 13 Jun 2014 11:05:52 +0200 From: David Henningsson User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 MIME-Version: 1.0 To: Jaroslav Kysela , tiwai@suse.de, alsa-devel@alsa-project.org References: <1402647348-25604-1-git-send-email-david.henningsson@canonical.com> <539AB5C7.6020501@perex.cz> In-Reply-To: <539AB5C7.6020501@perex.cz> Cc: 1289730@bugs.launchpad.net Subject: Re: [alsa-devel] [RFC PATCH] alsactl: Do not run udev rule before datadir is mounted X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP On 2014-06-13 10:26, Jaroslav Kysela wrote: > Date 13.6.2014 10:15, David Henningsson wrote: >> The 90-alsa-restore.rules udev rule is primarily meant to handle hotplugging, >> but sometimes it is also run before /usr is mounted, >> and alsactl restore depends on /usr/share/alsa being present. >> >> If /usr/share/alsa is not present, we're so early in the boot >> process that alsa-restore.service (or upstart equivalent) will >> run later on. >> >> BugLink: https://bugs.launchpad.net/bugs/1289730 >> Signed-off-by: David Henningsson >> --- >> >> I'm not really sure of all quirks in the boot process, and I haven't tested the >> patch either, hence the RFC above. Do you think it makes sense? > > Yes, I think that's ok. Takashi? > >> Should we also add @sbindir@ to the things to test for? > > It shouldn't harm anything. Could you prepare a new patch? Sure, please find it attached. I was also considering adding something under /var as well, but I didn't do that, because I think it will fall back to an "alsactl init" in that case (right?), so it still makes some sense to run alsactl without /var. > >> alsactl/90-alsa-restore.rules.in | 2 +- >> alsactl/Makefile.am | 1 + >> configure.ac | 1 + >> 3 files changed, 3 insertions(+), 1 deletion(-) >> >> diff --git a/alsactl/90-alsa-restore.rules.in b/alsactl/90-alsa-restore.rules.in >> index c68119d..c83c6b5 100644 >> --- a/alsactl/90-alsa-restore.rules.in >> +++ b/alsactl/90-alsa-restore.rules.in >> @@ -1,4 +1,4 @@ >> -ACTION=="add", SUBSYSTEM=="sound", KERNEL=="controlC*", KERNELS!="card*", GOTO="alsa_restore_go" >> +ACTION=="add", SUBSYSTEM=="sound", KERNEL=="controlC*", KERNELS!="card*", TEST=="@datadir@", GOTO="alsa_restore_go" >> GOTO="alsa_restore_end" >> >> LABEL="alsa_restore_go" >> diff --git a/alsactl/Makefile.am b/alsactl/Makefile.am >> index b862412..afbedb3 100644 >> --- a/alsactl/Makefile.am >> +++ b/alsactl/Makefile.am >> @@ -44,6 +44,7 @@ endif >> >> edit = \ >> $(SED) -r -e 's,@sbindir\@,$(sbindir),g' \ >> + -e 's,@datadir\@,$(mydatadir),g' \ >> -e 's,@daemonswitch\@,$(ALSACTL_DAEMONSWITCH),g' \ >> < $< > $@ || rm $@ >> >> diff --git a/configure.ac b/configure.ac >> index 7e6894a..a4d2db3 100644 >> --- a/configure.ac >> +++ b/configure.ac >> @@ -292,6 +292,7 @@ AC_DEFINE_UNQUOTED(SOUNDSDIR, "$soundsdir", [directory containing sample data]) >> >> mydatadir="$dir/alsa" >> AC_DEFINE_UNQUOTED(DATADIR, "$mydatadir", [directory containing alsa configuration]) >> +AC_SUBST(mydatadir) >> >> AC_ARG_WITH(testsound, >> AS_HELP_STRING([--with-testsound=file], [give the path of test sound file for alsaconf]), >> > > From 09a4abb5560448eb434a33fc237d578e14666940 Mon Sep 17 00:00:00 2001 From: David Henningsson Date: Fri, 13 Jun 2014 10:04:25 +0200 Subject: [PATCH] alsactl: Do not run udev rule before datadir/sbindir are both mounted Sometimes 90-alsa-restore.rules is run before /usr is mounted, and alsactl restore depends on /usr/share/alsa being present. If /usr/share/alsa is not present, we're so early in the boot process that alsa-restore.service (or upstart equivalent) will run later on. BugLink: https://bugs.launchpad.net/bugs/1289730 Signed-off-by: David Henningsson --- alsactl/90-alsa-restore.rules.in | 2 +- alsactl/Makefile.am | 1 + configure.ac | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/alsactl/90-alsa-restore.rules.in b/alsactl/90-alsa-restore.rules.in index c68119d..80fc043 100644 --- a/alsactl/90-alsa-restore.rules.in +++ b/alsactl/90-alsa-restore.rules.in @@ -1,4 +1,4 @@ -ACTION=="add", SUBSYSTEM=="sound", KERNEL=="controlC*", KERNELS!="card*", GOTO="alsa_restore_go" +ACTION=="add", SUBSYSTEM=="sound", KERNEL=="controlC*", KERNELS!="card*", TEST=="@sbindir@", TEST=="@datadir@", GOTO="alsa_restore_go" GOTO="alsa_restore_end" LABEL="alsa_restore_go" diff --git a/alsactl/Makefile.am b/alsactl/Makefile.am index b862412..afbedb3 100644 --- a/alsactl/Makefile.am +++ b/alsactl/Makefile.am @@ -44,6 +44,7 @@ endif edit = \ $(SED) -r -e 's,@sbindir\@,$(sbindir),g' \ + -e 's,@datadir\@,$(mydatadir),g' \ -e 's,@daemonswitch\@,$(ALSACTL_DAEMONSWITCH),g' \ < $< > $@ || rm $@ diff --git a/configure.ac b/configure.ac index 7e6894a..a4d2db3 100644 --- a/configure.ac +++ b/configure.ac @@ -292,6 +292,7 @@ AC_DEFINE_UNQUOTED(SOUNDSDIR, "$soundsdir", [directory containing sample data]) mydatadir="$dir/alsa" AC_DEFINE_UNQUOTED(DATADIR, "$mydatadir", [directory containing alsa configuration]) +AC_SUBST(mydatadir) AC_ARG_WITH(testsound, AS_HELP_STRING([--with-testsound=file], [give the path of test sound file for alsaconf]), -- 1.9.1