You are not logged in.
I've been trying to grant my non-root user write access to "/sys/class/backlight/intel_backlight/brightness" so I can control the brightness from a non-root application.
I've tried defining a udev rule as outlined in this section on the wiki, but I'm not having much luck with it.
The wiki suggests that I add a file, "/etc/udev/rules.d/backlight.rules", and put the following inside it (substituting "acpi_video0" with the name of the directory I find in "/sys/class/backlight"):
ACTION=="add", SUBSYSTEM=="backlight", KERNEL=="acpi_video0", GROUP="video", MODE="0664"
This would suggest that having the following as the contents of the file would give the desired effect, but that's not what I'm experiencing.
ACTION=="add", SUBSYSTEM=="backlight", KERNEL=="intel_backlight", GROUP="video", MODE="0664"
I've made sure that the "video" group exists and that the user in question is a member of said group. Rebooting seems to change nothing.
$ ls -l /sys/class/backlight/intel_backlight/
total 0
-r--r--r-- 1 root root 4096 Nov 2 18:05 actual_brightness
-rw-r--r-- 1 root root 4096 Nov 2 18:05 bl_power
-rw-r--r-- 1 root root 4096 Nov 2 18:04 brightness
lrwxrwxrwx 1 root root 0 Nov 2 18:05 device ot 4096 Nov 2 18:05 bl_power
-rw-r--r-- 1 root root 4096 Nov 2 18:04 brightness
lrwxrwxrwx 1 root root 0 Nov 2 18:05 device -> ../../card0-eDP-1
-r--r--r-- 1 root root 4096 Nov 2 18:04 max_brightness
drwxr-xr-x 2 root root 0 Nov 2 18:05 power
-r--r--r-- 1 root root 4096 Nov 2 18:05 scale
lrwxrwxrwx 1 root root 0 Nov 2 18:04 subsystem -> ../../../../../../../class/backlight
-r--r--r-- 1 root root 4096 Nov 2 18:04 type
-rw-r--r-- 1 root root 4096 Nov 2 18:04 uevent
As "ls -l" is showing, the owner of the "brightness" file still has read/write permissions and all others have read permissions, even if the udev rule would suggest otherwise.
I tried running "udevadm test /sys/class/backlight/intel_backlight" to see if there somehow was a conflicting file, but that wasn't the case.
Last edited by maroider (2020-11-04 12:10:12)
Offline
I checked the current link in the wiki and it is funny, because I went through it a couple of months ago and the description was different. I got it working with a different udev rule. Maybe you can try with this one and see how it goes. Here is my /etc/udev/rules.d/backlight.rules
RUN+="/bin/chgrp wheel /sys/class/backlight/intel_backlight/brightness"
RUN+="/bin/chmod g+w /sys/class/backlight/intel_backlight/brightness"
I believe you should change wheel for video if your user is a member of the video group, but other than that, that is pretty much it.
Offline
Thanks a lot, those udev rules did the trick :)
My poor batteries can now be less strained.
It is strange that what the wiki perscribes doesn't work, but it must've worked for someone at some point for i to be on the wiki, right?
I'm not sure if I should mark this as solved, though, since it's still not clear why the udev rule perscribed by the wiki doesn't work for me.
Offline
Glad it worked.
Imo you should make it as solved (I am no moderator though) because other people might have similar issues and perhaps would like to know what works and what does not.
Offline
I checked the current link in the wiki and it is funny, because I went through it a couple of months ago and the description was different. I got it working with a different udev rule. Maybe you can try with this one and see how it goes. Here is my /etc/udev/rules.d/backlight.rules
RUN+="/bin/chgrp wheel /sys/class/backlight/intel_backlight/brightness" RUN+="/bin/chmod g+w /sys/class/backlight/intel_backlight/brightness"
I believe you should change wheel for video if your user is a member of the video group, but other than that, that is pretty much it.
thank you very much. I've made it work also for me.
Offline