You are not logged in.

#1 2012-08-18 21:51:18

pks
Member
From: Germany
Registered: 2012-07-20
Posts: 110

Backlight controlled by udev rule

Hey guys.

I'm trying to modify the monitor's brightness with udev. As you can guess, it does not work. Neither is the brightness reduced, nor are permissions changed. For testing purposes, I tried removing ACTION and TEST filters, without success. Following rule is what I've currently got:

ACTION=="add", SUBSYSTEM=="backlight", TEST=="brightness", ATTR{brightness}="1", GROUP="video"

My current system uses the Nvidia driver, but I've also tried it on a system with Intel GPU without success. I've attached udevadm info's output for the backlight device.

looking at device '/devices/virtual/backlight/apple_backlight':
    KERNEL=="apple_backlight"
    SUBSYSTEM=="backlight"
    DRIVER==""
    ATTR{type}=="platform"
    ATTR{brightness}=="1"
    ATTR{bl_power}=="0"
    ATTR{max_brightness}=="15"
    ATTR{actual_brightness}=="1"

Offline

#2 2012-08-18 22:20:13

brebs
Member
Registered: 2007-04-03
Posts: 3,742

Re: Backlight controlled by udev rule

Here's 2 command-line methods for Nvidia brightness adjustment.

Offline

#3 2012-08-19 05:50:55

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: Backlight controlled by udev rule

I would recommend using the method that brebs suggested.  Is there a reason why you are set on using udev to do this?  With systemd, today I discovered I can use the tmpfile.d directory to determine my backlight setting on boot.  While with SysV I used the above method in my rc.local, which also worked great.

Offline

#4 2012-08-19 15:16:47

pks
Member
From: Germany
Registered: 2012-07-20
Posts: 110

Re: Backlight controlled by udev rule

I've used both solutions before, first with rc.local and tmpfiles.d after switiching to systemd. I've asked about some other hardware-related things in #systemd, and they told me that it's recommended to use udev rules for hardware parameter modification, as it might otherwise be racy.

Offline

#5 2012-08-19 16:03:51

brebs
Member
Registered: 2007-04-03
Posts: 3,742

Re: Backlight controlled by udev rule

AFAIK, the only racy thing is to ensure that "modprobe nvidia" is run first, if using a script.

Offline

#6 2012-08-19 18:24:12

pks
Member
From: Germany
Registered: 2012-07-20
Posts: 110

Re: Backlight controlled by udev rule

Exactly. If using a script that might be possible, but not for using tmpfiles. It might just be perfectionism, but I really don't want to use scriptfiles and (even though it is working) it does not seem right to use tmpfiles if udev rules are the most correct way to go.

Offline

#7 2012-08-19 18:52:21

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: Backlight controlled by udev rule

Interesting... I have not run into any issues with using tmpfiles so far, but I was also unaware that this was the wrong way to go about it.  Unfortunately I am uneducated in teh ways of udev rules, but would be greatly interested if you find a solution.

Offline

Board footer

Powered by FluxBB