Commit Graph

11 Commits

Author SHA1 Message Date
Hans de Goede 40bd45fb80 backlight: Fix compiler error
/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-06-18 14:11:05 +01:00
Chris Wilson 0b92b1285c backlight: Make search routine for device specific backlight common
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-02-20 19:22:03 +00:00
Mark Kettenis c91af569ee backlight: Build fixes for OpenBSD
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-18 19:04:09 +00:00
Hans de Goede b5229c6e15 backlight: Drop rights before executing pkexec
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-17 18:38:54 +00:00
Hans de Goede 27a9dc4ce8 backlight: Use System instead of system when checking for pkexec
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-17 18:38:45 +00:00
Hans de Goede 06066b7269 backlight: Explain better why we support both pkexec and suid root for the 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-17 17:02:01 +00:00
Chris Wilson 6b5c2b4515 backlight: tidy use of BACKLIGHT_CLASS
Use string concantenation to simply the sprintf slightly.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-02-15 21:03:49 +00:00
Chris Wilson eb7d2b19e2 backlight: Reject user overrides on OpenBSD
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-15 21:02:11 +00:00
Chris Wilson 268842a47f backlight: Amalgamate hardcoded priority tables
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-15 20:56:24 +00:00
Jan Alexander Steffens (heftig) b71f3d8bd4 Backlight helper build fixes
Don't hardcode $(prefix)/libexec

Fix install hook when DESTDIR is set

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=75028
2014-02-15 17:39:01 +00:00
Chris Wilson 3d629c91cf intel: Add a helper for setting backlight without root rights
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>
2014-02-15 15:33:47 +00:00