sna: Hook up a backlight udev monitor for external changes
authorChris Wilson <chris@chris-wilson.co.uk>
Thu, 5 Jun 2014 21:43:37 +0000 (22:43 +0100)
committerChris Wilson <chris@chris-wilson.co.uk>
Fri, 6 Jun 2014 07:12:38 +0000 (08:12 +0100)
commitc6cd10f536e099277cdc46643725a5a50ea8b525
tree2b96e76cc7869f5dad02fa2b3b84d3e96d5d286a
parentb545e10c50cbb2dd6f9fd53369667bed0d8f1b51
sna: Hook up a backlight udev monitor for external changes

Changes to the backlights are notified through uevents. Hooking up a
udev monitor to listen out for external changes to the backlight (e.g.
through ACPI function keys, or by the user writing to
/sys/class/backlight directly) is easier than enabling polling on the
backlight sysfs file using X's select() mechanism.

Since we listen to backlight changes, we have to be careful not to
confuse the side-effects of disabling connectors (which may cause either
ourselves or the kernel to turn off the backlight) with the user value.

Many thanks to Alexander Mezin for the suggestion to use udev for
tracking the notifications for external changes to the backlight.

Reported-by: Alexander Mezin <mezin.alexander@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=79699
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
src/sna/sna.h
src/sna/sna_display.c