Package: udev Version: 160-1 Severity: normal Tags: patch Hi,
I'm using GNOME with all the cool ConsoleKit stuff here and things are
working really great, but there is one problem:
Hotplugged audio devices don't get the right permissions after plugging
them in. After plugging my USB sound card in, the situation is like
this:
$ getfacl /dev/mixer1
getfacl: Removing leading '/' from absolute path names
# file: dev/mixer1
# owner: root
# group: audio
user::rw-
group::rw-
other::---
However, after logout/login or after simply switching to another VT and
back (no logout/login), this changes:
$ getfacl /dev/mixer1
getfacl: Removing leading '/' from absolute path names
# file: dev/mixer1
# owner: root
# group: audio
user::rw-
user:alexander:rw-
group::rw-
mask::rw-
other::---
This is can be explained by looking at the ConsoleKit log:
$ tail -2 /var/log/ConsoleKit/history
1282418851.871 type=SEAT_ACTIVE_SESSION_CHANGED : seat-id='Seat1'
session-id=''
1282418854.346 type=SEAT_ACTIVE_SESSION_CHANGED : seat-id='Seat1'
session-id='Session435'
So by switching the VT or by logging out/logging in, you can cause
ConsoleKit to update the permissions on the local devices. Great!
But why doesn't it work directly after plugging the device in?
I found an answer to this on the Pulseaudio mailing list [1]. The author
of the original post reports [2]:
[...]
I have now figured this one out for myself. It turned out to be quite
simple. I only needed to add a file, say 60-sound.rules containing the
following line:
SUBSYSTEM=="sound", ENV{ACL_MANAGE}="1"
[...]
He is then asked why this is necessary [3]:
[...]
Hmm, strange.. I'm not sure what your /lib/udev/rules.d/70-acl.rules has
in it but mine has:
[colin at jimmy udev]$ grep sound.*ACL_MANAGE
/lib/udev/rules.d/70-acl.rules
SUBSYSTEM=="sound", ENV{ACL_MANAGE}="1"
SUBSYSTEM=="input", SUBSYSTEMS=="sound", ENV{ACL_MANAGE}="1"
[...]
The answer to this is [4]:
[...]
Debian udev maintainer insist on creating own rules instead of using
upstream ones.
[...]
So I looked at the Debian version of /lib/udev/rules.d/70-acl.rules and
found that the code actually applying the ACLs is protected by some sort
of IF clause:
ENV{ACL_MANAGE}!="1", GOTO="acl_end"
# Glib is not declared as a package dependency, so check that it is
actually
# installed before running udev-acl.
TEST!="/lib/libglib-2.0.so.0", GOTO="acl_end"
# apply ACL for all locally logged in users
TEST=="/var/run/ConsoleKit/database", \
RUN+="udev-acl --action=$env{ACTION} --device=$env{DEVNAME}"
LABEL="acl_end"
However a quick grep
$ grep -r ACL_MANAGE /lib/udev/rules.d/
/lib/udev/rules.d/61-gnome-bluetooth-rfkill.rules:ENV{ACL_MANAGE}=="0",
GOTO="gnome_bluetooth_end"
/lib/udev/rules.d/60-nvidia-kernel-common.rules:ENV{ACL_MANAGE}=="0",
GOTO="nvidia_end"
/lib/udev/rules.d/60-nvidia-kernel-common.rules:ENV{ACL_MANAGE}="1"
/lib/udev/rules.d/70-acl.rules:ENV{ACL_MANAGE}!="1", GOTO="acl_end"
shows that only third party packages are using the ACL_MANAGE variable.
The code in `70-acl.rules' actually uses some sort of TAGging to
determine whether to update ACLs. So I applied the attached (trivial)
patch and now hotplugging works instantly - I plug my sound card in and
can use it without any further arrangements.
So unless current behaviour is intentional, I suggest applying the
attached patch (please note that the patch is against udev 160-1).
Best regards
Alexander Kurtz
[1]
https://tango.0pointer.de/pipermail/pulseaudio-discuss/2010-August/007608.html
[2]
https://tango.0pointer.de/pipermail/pulseaudio-discuss/2010-August/007672.html
[3]
https://tango.0pointer.de/pipermail/pulseaudio-discuss/2010-August/007673.html
[4]
https://tango.0pointer.de/pipermail/pulseaudio-discuss/2010-August/007676.html
--- orig/lib/udev/rules.d/70-acl.rules 2010-07-12 03:24:40.000000000 +0200
+++ /lib/udev/rules.d/70-acl.rules 2010-08-21 21:15:06.112615670 +0200
@@ -72,6 +72,7 @@
LABEL="acl_apply"
+TAG=="udev-acl", ENV{ACL_MANAGE}="1"
ENV{ACL_MANAGE}!="1", GOTO="acl_end"
# Glib is not declared as a package dependency, so check that it is actually
signature.asc
Description: This is a digitally signed message part

