You are not logged in.

#1 2018-06-08 19:14:09

bbaserdem
Member
Registered: 2017-07-27
Posts: 43

Udev rule for keyboard light not working

I have ASUS GL702ZC. I added the following udev rule to be able to write the brightness of the backlight for users in video group;

cat /etc/udev/rules.d/11-backlight.rules 
ACTION=="add", SUBSYSTEM=="backlight", KERNEL=="amdgpu_bl0", RUN+="/bin/chgrp video /sys/class/backlight/%k/brightness"
ACTION=="add", SUBSYSTEM=="backlight", KERNEL=="amdgpu_bl0", RUN+="/bin/chmod g+w /sys/class/backlight/%k/brightness"

Which works fine, and I can control the backlight fine using brightnessctl or doing cat on /sys/class/backlight/amdgpu_bl0/brightness

ls -l /sys/class/backlight/amdgpu_bl0/
total 0
drwxr-xr-x 2 root root     0 Jun  8 15:10 power
-r--r--r-- 1 root root  4096 Jun  8 15:10 actual_brightness
-rw-r--r-- 1 root root  4096 Jun  8 15:10 bl_power
-rw-rw-r-- 1 root video 4096 Jun  8 14:10 brightness
lrwxrwxrwx 1 root root     0 Jun  8 15:10 device -> ../../../0000:0c:00.0
-r--r--r-- 1 root root  4096 Jun  8 14:10 max_brightness
lrwxrwxrwx 1 root root     0 Jun  8 14:10 subsystem -> ../../../../../../class/backlight
-r--r--r-- 1 root root  4096 Jun  8 14:10 type
-rw-r--r-- 1 root root  4096 Jun  8 14:10 uevent

I tried the same for keyboard backlighting;

cat /etc/udev/rules.d/12-kbd.rules 
ACTION=="add", SUBSYSTEM=="leds", KERNEL=="asus::kbd_backlight", RUN+="/bin/chgrp video /sys/class/leds/%k/brightness"
ACTION=="add", SUBSYSTEM=="leds", KERNEL=="asus::kbd_backlight", RUN+="/bin/chmod g+w /sys/class/leds/%k/brightness"

However, (even when I have no udev rules after this one) something else changes the group ownership. This used to work fine before a kernel update.

ls -l /sys/class/leds/asus::kbd_backlight/
total 0
drwxr-xr-x 2 root root     0 Jun  8 15:12 power
-rw-rw-r-- 1 root input 4096 Jun  8 14:10 brightness
lrwxrwxrwx 1 root root     0 Jun  8 15:12 device -> ../../../0003:0B05:1837.0002
-r--r--r-- 1 root root  4096 Jun  8 14:10 max_brightness
lrwxrwxrwx 1 root root     0 Jun  8 14:10 subsystem -> ../../../../../../../../../../class/leds
-rw-r--r-- 1 root root  4096 Jun  8 15:12 trigger
-rw-r--r-- 1 root root  4096 Jun  8 14:10 uevent

I can change the group by using sudo, and then I can control the keyboard lights again. But why is the second udev rule not working whereas the first one works?

(Also is there a way I can expand the SUBSYTEM in the string? Like i can do %k with KERNEL?)

Last edited by bbaserdem (2018-06-10 15:35:57)

Offline

Board footer

Powered by FluxBB