[systemd-devel] brightness in tmpfiles.d

Kay Sievers kay at vrfy.org
Mon Aug 12 14:54:15 PDT 2013


On Mon, Aug 12, 2013 at 11:27 PM, Mantas Mikulėnas <grawity at gmail.com> wrote:
> On Mon, Aug 12, 2013 at 11:40 PM, Christian Hesse <list at eworm.de> wrote:
>> Hello everybody,
>>
>> I have a file /etc/tmpfiles.d/brightness.conf containing this line:
>>
>> w /sys/class/backlight/acpi_video0/brightness - - - - 10
>>
>> This used to set the brightness on boot, but broke lately. The path is
>> correct, so I assume this is a race condition. Any chance to get this work
>> again?
>
> Sure, and it involves *not* using tmpfiles.d.
>
> I cannot know for sure, but yes, it is likely that it *is* a race
> condition – tmpfiles.d being run before the relevant module gets
> inserted, device gets detected, or whatever. And the usual way for
> working with events like device detection is to write an udev rule
> that triggers after that specific device has appeared:
>
> ACTION=="add", SUBSYSTEM=="backlight",
>     KERNEL=="acpi_video0", ATTR{brightness}="10"
>
> (I'm not 100% sure if the KERNEL match is correct. The rest should work.)

Looks fine.

Remembering brightness sounds pretty useful for everyone. In the
longer run, it should probably be handled like ALSA restore for the
sound volume, with a service that writes it to /var/lib and reads it
from there ...

Kay


More information about the systemd-devel mailing list