Gentoo Archives: gentoo-user

From: Andrea Momesso <momesso.andrea@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Permissions of files in /sys/
Date: Fri, 09 Jan 2009 16:28:42
Message-Id: 94f5c8410901090828g1f55b87du9b35c70a88bca00d@mail.gmail.com
In Reply to: Re: [gentoo-user] Permissions of files in /sys/ by Paul Hartman
1 On Wed, Jan 7, 2009 at 9:47 PM, Paul Hartman
2 <paul.hartman+gentoo@×××××.com> wrote:
3 > On Wed, Jan 7, 2009 at 8:29 AM, Momesso Andrea <momesso.andrea@×××××.com> wrote:
4 >> I'd like to make the file /sys/class/backlight/asus-laptop/brightness
5 >> writeable for users, so that I don't need to be root anymore to change
6 >> the brightness.
7 >>
8 >> Of course I can chown or chmod ot in local.start but I'm asking if there
9 >> is a cleaner way.
10 >
11 > I guess you need to use udevinfo to get the important information
12 > about /sys/class/backlight/asus-laptop/brightness and then write up a
13 > rule, slap it into a file in /etc/udev/rules.d/ and enjoy your new
14 > permissions. :) I don't have that device on my system so I can't
15 > really suggest anything more specific.
16 >
17 > Here's a udev rules HOWTO that might help:
18 >
19 > http://www.reactivated.net/writing_udev_rules.html
20 >
21 > (specifically "Controlling permissions and ownership")
22 >
23 > Good luck :)
24 > Paul
25 >
26 >
27
28 It looks like I cannot simply write a rule to change that permission...
29 After experiencing some failures I guess that udev rules can change
30 permissions on /dev/ files, but not on /sys/ files...
31
32 This is my case:
33
34 # udevadm info -a -p /sys/class/backlight/asus-laptop/
35
36 looking at device '/class/backlight/asus-laptop':
37 KERNEL=="asus-laptop"
38 SUBSYSTEM=="backlight"
39 DRIVER==""
40 ATTR{bl_power}=="0"
41 ATTR{brightness}=="5"
42 ATTR{actual_brightness}=="5"
43 ATTR{max_brightness}=="15"
44
45 And this is the rule I added in /etc/udev/rules.d/10-local.rules
46
47 KERNEL=="asus-laptop", SUBSYSTEM=="backlight", GROUP="video", MODE="0660"
48
49 After a reboot I still get this:
50
51 # ls -la /sys/class/backlight/asus-laptop
52 total 0
53 drwxr-xr-x 3 root root 0 2009-01-09 15:18 .
54 drwxr-xr-x 3 root root 0 2009-01-09 15:18 ..
55 -r--r--r-- 1 root root 4096 2009-01-09 15:18 actual_brightness
56 -rw-r--r-- 1 root root 4096 2009-01-09 15:19 bl_power
57 -rw-r--r-- 1 root root 4096 2009-01-09 17:02 brightness
58 -r--r--r-- 1 root root 4096 2009-01-09 15:18 max_brightness
59 drwxr-xr-x 2 root root 0 2009-01-09 15:19 power
60 lrwxrwxrwx 1 root root 0 2009-01-09 15:18 subsystem -> ../../backlight
61 -rw-r--r-- 1 root root 4096 2009-01-09 15:18 uevent
62
63 Googling a bit I found some solutions [1] [2], but all of them are
64 changing the permissions at every
65 boot. It works, but it looks to me a bit unclean...
66 [1] http://wiki.laptop.org/go/Xfce_keybindings#Adjust_screen_brightness_buttons
67 [2] http://www.thinkwiki.org/wiki/Automatically_reduce_brightness
68
69 --
70 Momesso (TopperH) Andrea
71 http://topperh.blogspot.com
72 Jabber: topper_harley@××××××.org
73 ICQ: 224179391

Replies

Subject Author
Re: [gentoo-user] Permissions of files in /sys/ Momesso Andrea <momesso.andrea@×××××.com>