Skip to contentSkip to conversation

alsactl: Check existence of `alsactl` in udev rule

PATCH In review Paul Menzel 2 participants 4 messages Dec 28, 2016 – Dec 30, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 alsactl: Check existence of `alsactl` in udev rule

From: Jordi Mallach <[email protected]>
Date: Thu, 10 Jan 2013 00:17:58 +0000

Include the line TEST=="/usr/sbin/alsactl" in the udev rule, to properly fix the state restoring for users with split /usr filesystems
[1].

Upstream the patch from the Debian package [2].

[1] https://bugs.debian.org/670490
    "Debian Bug report logs - #670490 alsa-utils: Restore sound volume
     in udev"
[2] https://sources.debian.net/src/alsa-utils/1.1.2-1/debian/patches/udev_test_alsactl.patch/

---
Please apply with git am saved-messages.mbox.

 alsactl/90-alsa-restore.rules.in | 4 ++--

 1 file changed, 2 insertions(+), 2 deletions(-)
alsactl/90-alsa-restore.rules.in +0 -0
index c0c1b23..f190b85 100644
@@ -2,7 +2,7 @@ ACTION=="add", SUBSYSTEM=="sound", KERNEL=="controlC*", KERNELS!="card*", TEST==

 GOTO="alsa_restore_end"

 LABEL="alsa_restore_go"
-TEST!="@daemonswitch@", RUN+="@sbindir@/alsactl restore $attr{device/number}" -TEST=="@daemonswitch@", RUN+="@sbindir@/alsactl nrestore $attr{device/number}" +TEST!="@daemonswitch@", TEST=="@sbindir@/alsactl", RUN+="@sbindir@/alsactl restore $attr{device/number}" +TEST=="@daemonswitch@", TEST=="@sbindir@/alsactl", RUN+="@sbindir@/alsactl nrestore $attr{device/number}"
 LABEL="alsa_restore_end"
--
2.11.0

#1 lore raw
Quoted 8 lines · Paul Menzel

From: Jordi Mallach <[email protected]>
Date: Thu, 10 Jan 2013 00:17:58 +0000

Include the line TEST=="/usr/sbin/alsactl" in the udev rule, to properly fix the state restoring for users with split /usr filesystems
[1].

This doesn't sound like a real "fix". It means that the whole save/restore mechanism will be silently lost, right?

thanks,

Takashi

Quoted 28 lines

Upstream the patch from the Debian package [2].

[1] https://bugs.debian.org/670490
    "Debian Bug report logs - #670490 alsa-utils: Restore sound volume
     in udev"
[2] https://sources.debian.net/src/alsa-utils/1.1.2-1/debian/patches/udev_test_alsactl.patch/

---
Please apply with git am saved-messages.mbox.

 alsactl/90-alsa-restore.rules.in | 4 ++--

 1 file changed, 2 insertions(+), 2 deletions(-)
alsactl/90-alsa-restore.rules.in +0 -0
index c0c1b23..f190b85 100644
@@ -2,7 +2,7 @@ ACTION=="add", SUBSYSTEM=="sound", KERNEL=="controlC*", KERNELS!="card*", TEST==

 GOTO="alsa_restore_end"

 LABEL="alsa_restore_go"

alsactl/90-alsa-restore.rules.in +2 -2
-TEST!="@daemonswitch@", RUN+="@sbindir@/alsactl restore $attr{device/number}"
-TEST=="@daemonswitch@", RUN+="@sbindir@/alsactl nrestore $attr{device/number}"
+TEST!="@daemonswitch@", TEST=="@sbindir@/alsactl", RUN+="@sbindir@/alsactl restore $attr{device/number}"
+TEST=="@daemonswitch@", TEST=="@sbindir@/alsactl", RUN+="@sbindir@/alsactl nrestore $attr{device/number}"
Quoted 4 lines


 LABEL="alsa_restore_end"
--
2.11.0

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#2 lore raw

Am Donnerstag, den 29.12.2016, 14:28 +0100 schrieb Takashi Iwai:

Quoted 6 lines
Quoted 4 lines · Paul Menzel

From: Jordi Mallach <[email protected]>
Date: Thu, 10 Jan 2013 00:17:58 +0000

Quoted 7 lines
Quoted 4 lines

Include the line TEST=="/usr/sbin/alsactl" in the udev rule, to properly fix the state restoring for users with split /usr filesystems
[1].

This doesn't sound like a real "fix". It means that the whole save/restore mechanism will be silently lost, right?

Well, if the binary alsactl is not available, it shouldn’t be run.

But you are right, it depends on the system setup, what happens.

See the description of commit de7c3eff (alsactl: systemd and udev hookup).

Quoted 5 lines

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

Thanks,

Paul

Quoted 31 lines
Quoted 31 lines

Upstream the patch from the Debian package [2].

[1] https://bugs.debian.org/670490
    "Debian Bug report logs - #670490 alsa-utils: Restore sound volume
     in udev"
[2] https://sources.debian.net/src/alsa-utils/1.1.2-1/debian/patches/udev_test_alsactl.patch/

---
Please apply with git am saved-messages.mbox.

 alsactl/90-alsa-restore.rules.in | 4 ++--

 1 file changed, 2 insertions(+), 2 deletions(-)
alsactl/90-alsa-restore.rules.in +0 -0
index c0c1b23..f190b85 100644
@@ -2,7 +2,7 @@ ACTION=="add", SUBSYSTEM=="sound", KERNEL=="controlC*", KERNELS!="card*", TEST==

 GOTO="alsa_restore_end"

 LABEL="alsa_restore_go"

alsactl/90-alsa-restore.rules.in +2 -2
-TEST!="@daemonswitch@", RUN+="@sbindir@/alsactl restore $attr{device/number}"
-TEST=="@daemonswitch@", RUN+="@sbindir@/alsactl nrestore $attr{device/number}"
+TEST!="@daemonswitch@", TEST=="@sbindir@/alsactl", RUN+="@sbindir@/alsactl restore $attr{device/number}"
+TEST=="@daemonswitch@", TEST=="@sbindir@/alsactl", RUN+="@sbindir@/alsactl nrestore $attr{device/number}"


 LABEL="alsa_restore_end"
--
2.11.0

#3 lore raw
Quoted 16 lines · Paul Menzel

Am Donnerstag, den 29.12.2016, 14:28 +0100 schrieb Takashi Iwai:

Quoted 6 lines
Quoted 4 lines · Paul Menzel

From: Jordi Mallach <[email protected]>
Date: Thu, 10 Jan 2013 00:17:58 +0000

Quoted 7 lines
Quoted 4 lines

Include the line TEST=="/usr/sbin/alsactl" in the udev rule, to properly fix the state restoring for users with split /usr filesystems
[1].

This doesn't sound like a real "fix". It means that the whole save/restore mechanism will be silently lost, right?

Quoted 12 lines

Well, if the binary alsactl is not available, it shouldn’t be run.

But you are right, it depends on the system setup, what happens.

See the description of commit de7c3eff (alsactl: systemd and udev hookup).

Quoted 5 lines

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

Yeah, if you allow a separate /usr partition to be mounted later, all stuff executed in udev rules should be put in either /bin or /sbin. The same is true for /var/lib/alsa.

And yet the question is whether we should suppress the error in such a case. When suppressed, user might not notice what went wrong. Meanwhile an error message is annoying if you know it.

Takashi

Quoted 22 lines

Thanks,

Paul

Quoted 15 lines
Quoted 15 lines

Upstream the patch from the Debian package [2].

[1] https://bugs.debian.org/670490
    "Debian Bug report logs - #670490 alsa-utils: Restore sound volume
     in udev"
[2] https://sources.debian.net/src/alsa-utils/1.1.2-1/debian/patches/udev_test_alsactl.patch/

---
Please apply with git am saved-messages.mbox.

 alsactl/90-alsa-restore.rules.in | 4 ++--

 1 file changed, 2 insertions(+), 2 deletions(-)
Quoted 16 lines
Quoted 8 lines
Quoted 8 lines
alsactl/90-alsa-restore.rules.in +0 -0
index c0c1b23..f190b85 100644
@@ -2,7 +2,7 @@ ACTION=="add", SUBSYSTEM=="sound", KERNEL=="controlC*", KERNELS!="card*", TEST==

 GOTO="alsa_restore_end"

 LABEL="alsa_restore_go"

Quoted 8 lines
Quoted 8 lines
alsactl/90-alsa-restore.rules.in +2 -2
-TEST!="@daemonswitch@", RUN+="@sbindir@/alsactl restore $attr{device/number}"
-TEST=="@daemonswitch@", RUN+="@sbindir@/alsactl nrestore $attr{device/number}"
+TEST!="@daemonswitch@", TEST=="@sbindir@/alsactl", RUN+="@sbindir@/alsactl restore $attr{device/number}"
+TEST=="@daemonswitch@", TEST=="@sbindir@/alsactl", RUN+="@sbindir@/alsactl nrestore $attr{device/number}"


 LABEL="alsa_restore_end"
--
2.11.0

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel