You are not logged in.

#1 2018-02-24 10:55:46

8472
Member
From: Slovakia
Registered: 2010-05-15
Posts: 83

udev rule for laptop backlight in sys class ownership not working

Hi,

up to systemd's 237.0*, I've been using the tmpfiles.d to change the ownership in /sys/class/* for the display or keyboard backlight to work for non-root user.
After systemd's 237.31> update (at least that were the packages available in Arch's repos, recently) onwards something's changed, that the tmpfiles.d is loaded at startup earlier than the backlight objects in /sys/class/* are created.

Thus I've decided to try changing that ownership via udev.

looking at device '/devices/platform/asus-nb-wmi/leds/asus::kbd_backlight':
    KERNEL=="asus::kbd_backlight"
    SUBSYSTEM=="leds"
    DRIVER==""
    ATTR{brightness}=="0"
    ATTR{max_brightness}=="3"
    ATTR{trigger}=="[none] kbd-scrolllock kbd-numlock kbd-capslock kbd-kanalock kbd-shiftlock kbd-altgrlock kbd-ctrllock kbd-altlock kbd-shiftllock kbd-shiftrlock kbd-ctrlllock kbd-ctrlrlock disk-activity ide-disk mtd nand-disk cpu cpu0 cpu1 cpu2 cpu3 panic usb-gadget usb-host AC0-online BAT0-charging-or-full BAT0-charging BAT0-full BAT0-charging-blink-full-solid rfkill-any rfkill0 phy0rx phy0tx phy0assoc phy0radio bluetooth-power hci0-power rfkill1 "

  looking at parent device '/devices/platform/asus-nb-wmi':
    KERNELS=="asus-nb-wmi"
    SUBSYSTEMS=="platform"
    DRIVERS=="asus-nb-wmi"
    ATTRS{driver_override}=="(null)"

looking at device '/devices/pci0000:00/0000:00:02.0/drm/card0/card0-eDP-1/intel_backlight':
    KERNEL=="intel_backlight"
    SUBSYSTEM=="backlight"
    DRIVER==""
    ATTR{actual_brightness}=="826"
    ATTR{bl_power}=="0"
    ATTR{brightness}=="826"
    ATTR{max_brightness}=="937"
    ATTR{type}=="raw"

Udev rules like:

SUBSYSTEM=="backlight", RUN+="/path/sysclasspermissions.sh"
SUBSYSTEM=="leds", KERNEL=="*kbd_backlight", RUN+="/path/sysclasspermissions.sh"

or

SUBSYSTEM=="leds", ACTION=="add", KERNEL=="asus::kbd_backlight", DRIVERS=="asus-nb-wmi", ATTR{brightness}="3"

work perfectly.

But I would like to get rid of calling some script and rather change the ownership directly.
Somehow I'm unable to replace it with parameters like OWNER="something", GROUP="something" (at the end of the line, of course).
The 'udevadm test' doesn't say a word about the ownership, although when calling the "RUN+=" or "ATTR{brightness}="3"" it is displayed alright.
Any idea pls, what am I doing wrong?

thx


Logic clearly dictates that the needs of the many outweigh the needs of the few.

Offline

Board footer

Powered by FluxBB