summaryrefslogtreecommitdiff
path: root/src/backlight.c
AgeCommit message (Collapse)Author
2017-02-16backlight: Provide backlight_find_for_device() stub for BSDChris Wilson
BSD implements a single backlight controller interface and doesn't need the sysfs searching of Linux. Just report that there is no per-device backlight to fallback to using the ioctl (and in the process avoid calling undefined functions inside the BSD block). Reported-by: David Shao <davshao@gmail.com> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99833
2016-11-18backlight: Protect iface writes against signal interruptionsChris Wilson
Handle EINTR (and EAGAIN) by repeating until the write is complete. References: https://bugs.freedesktop.org/show_bug.cgi?id=98759 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-06-17backlight: Factor known names into preferred interfacesChris Wilson
Since the /sys/device/backlight never turned up we face an issue with disambiguating the backlight on multi-GPU devices. Both intel_backlight and nv_backlight are presented are raw interfaces, and on modern systems the ACPI interface is defunct, so we need a way to distinguish them. So, we fallback to our priority table of known interfaces and rank them accordingly, first by class (platform, native, raw) and then by priority. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-04-29backlight: Do not hang forever if helper pid is -1Olivier Fourdan
Backlight helper PID is set to -1 by default, if for some reason it's not set, we may end up with waitpid(-1, ...) which will hang forever. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90230 Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
2015-03-25Use AC_HEADER_MAJOR to find how to include major()Chris Wilson
We need to include <sys/mkdev.h> on Solaris. Reported-by: Richard Palo <richard@netbsd.org> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89763 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-01-26backlight.c: test for featuresPatrick Welche
Signed-off-by: Patrick Welche <prlw1@cam.ac.uk>
2014-11-04backlight: bl_power uses 0 for on and 4 for offChris Wilson
The backlight/bl_power file didn't obey the obvious semantics, but instead operates using some interesting framebuffer API. Oh well. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-10-11backlight: Open bl_power using WRONLY for writing.Chris Wilson
Jan spotted that we open the bl_power file using O_RDONLY and then attempt to write the new power state into it. This fails... Reported-by: Jan Steffens Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-09-11backlight: Expose interface to switch backlight on/off entirelyChris Wilson
A feature in recent kernels is to disambiguate between the meaning of brightness=0, between disabling the the backlight entirely or setting the lowest valid brightness. As such, we now have an extra knob in sysfs to explicitly request that the backlight be turned off. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-08-21backlight: Move the fd out of the select rangeChris Wilson
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-08-04backlight: Fix regressionEdward Sheldrake
The backlight xrandr property is missing unless the backlight level was 0 on starting X, regression introduced in commit f9e7ac7db7b0331131aa1df3a90d4b2692949efa Author: Chris Wilson <chris@chris-wilson.co.uk> Date: Wed Jul 23 21:53:31 2014 +0100 backlight: Set structure to safe values when not initialised Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=82146
2014-07-23backlight: Set structure to safe values when not initialisedChris Wilson
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-18backlight: Fix compiler errorHans de Goede
/usr/include/xorg/os.h around line 579 reads: extern _X_EXPORT char * strndup(const char *str, size_t n); However strndup is already defined by glibc, and this redefine causes a compile error. This gets triggered because backlight.c does: Without first doing: Causing HAVE_STRNDUP to not be defined. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2014-02-20backlight: Make search routine for device specific backlight commonChris Wilson
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-02-18backlight: Build fixes for OpenBSDMark Kettenis
Chris would like to humbly apologise for making these changes to the OpenBSD code blind, and to thank Mark and Jonathan for their support and understanding.
2014-02-17backlight: Drop rights before executing pkexecHans de Goede
Event though we've failed to open the backlight normally, we may still be running under a suid-root xserver, so drop any elevated rights before executing what we hope will be pkxec. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2014-02-17backlight: Use System instead of system when checking for pkexecHans de Goede
Even though we've failed to open the backlight normally, we may still be running under a suid-root xserver, so use the servers build in System instead of system so as to properly drop root rights. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2014-02-17backlight: Explain better why we support both pkexec and suid root for the ↵Hans de Goede
helper Update the comment about trying suid-root first with some explanations of why pkexec may be preferable in some cases. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2014-02-15backlight: tidy use of BACKLIGHT_CLASSChris Wilson
Use string concantenation to simply the sprintf slightly. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-02-15backlight: Reject user overrides on OpenBSDChris Wilson
We only handle the singular wscons OpenBSD interface for backlight, so explicitly reject any user requests for something else. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-02-15backlight: Amalgamate hardcoded priority tablesChris Wilson
Our fallback path for finding the backlight interface uses a hardcoded table of known backlight controllers in proirity order. Rather than maintain this table twice in the midst of the KMS logic, push it to the new set of common backlight routines. This incorporates bugfixes from SNA to handle unknown backlights, but usable, gracefully. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-02-15Backlight helper build fixesJan Alexander Steffens (heftig)
Don't hardcode $(prefix)/libexec Fix install hook when DESTDIR is set Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=75028
2014-02-15intel: Add a helper for setting backlight without root rightsChris Wilson
Once the xserver stops running as root on kms capabable systems, we will need some other way to access the backlight. The approach taken in this patch moves most of the heavy lifting to a helper that runs with root privileges and pipes our requested brightness into the sysfs backlight interface. Where required, we use pkexec to launch the helper with the elevated privilege. v2: Amalgamate much more of the duplicate code. Keep the daemon and pipe alive for the lifetime of the backlight interface. Provide an alternative for systems without PolicyKit. Signed-off-by: Hans de Goede <hdegoede@redhat.com> [v1] Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>