xf86-video-intel: 2 commits - src/sna/sna_display.c src/uxa/intel_display.c

Chris Wilson ickle at kemper.freedesktop.org
Thu Feb 13 17:27:20 CET 2014


 src/sna/sna_display.c   |    8 ++++++++
 src/uxa/intel_display.c |    8 ++++++++
 2 files changed, 16 insertions(+)

New commits:
commit 9a9f6a9487201e4c80338e771eec28067f044240
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Thu Feb 13 16:18:43 2014 +0000

    uxa: Check for access to backlight interface
    
    Before attaching properties to any connector, check that we can indeed
    control the backlight through the sysfs interface by doing an access
    check. If the xserver is started without root privileges, we cannot
    write through /sys/class/backlight and so should take care not to
    advertise that we can.
    
    Reported-by: Hans de Geode <hdegeode at redhat.com>
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/uxa/intel_display.c b/src/uxa/intel_display.c
index a4e04ec..e1b2920 100644
--- a/src/uxa/intel_display.c
+++ b/src/uxa/intel_display.c
@@ -298,6 +298,14 @@ intel_output_backlight_get_max(xf86OutputPtr output)
 	char path[BACKLIGHT_PATH_LEN], val[BACKLIGHT_VALUE_LEN];
 	int fd, max = 0;
 
+	/* We are used as an initial check to see if we can
+	 * control the backlight, so first test if we can set values.
+	 */
+	sprintf(path, "%s/%s/brightness",
+		BACKLIGHT_CLASS, intel_output->backlight_iface);
+	if (access(path, R_OK | W_OK))
+		return -1;
+
 	sprintf(path, "%s/%s/max_brightness",
 		BACKLIGHT_CLASS, intel_output->backlight_iface);
 	fd = open(path, O_RDONLY);
commit 611490a176d9bfd136f4340f7c31e0e0f0beea4e
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Thu Feb 13 16:18:43 2014 +0000

    sna: Check for access to backlight interface
    
    Before attaching properties to any connector, check that we can indeed
    control the backlight through the sysfs interface by doing an access
    check. If the xserver is started without root privileges, we cannot
    write through /sys/class/backlight and so should take care not to
    advertise that we can.
    
    Reported-by: Hans de Geode <hdegeode at redhat.com>
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c
index 85003bf..54e45ff 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -447,6 +447,14 @@ sna_output_backlight_get_max(xf86OutputPtr output)
 	char path[1024], val[BACKLIGHT_VALUE_LEN];
 	int fd, max = 0;
 
+	/* We are used as an initial check to see if we can
+	 * control the backlight, so first test if we can set values.
+	 */
+	sprintf(path, "%s/%s/brightness",
+		BACKLIGHT_CLASS, sna_output->backlight_iface);
+	if (access(path, R_OK | W_OK))
+		return -1;
+
 	sprintf(path, "%s/%s/max_brightness",
 		BACKLIGHT_CLASS, sna_output->backlight_iface);
 	fd = open(path, O_RDONLY);


More information about the xorg-commit mailing list