From 9882ed594f5886f1cfffa8025b905e936293fd65 Mon Sep 17 00:00:00 2001 From: Carsten Haitzler Date: Fri, 8 Jul 2011 02:17:44 +0000 Subject: [PATCH] handle hooglands silly tablet kernel. :) SVN revision: 61140 --- src/bin/e_backlight_main.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/bin/e_backlight_main.c b/src/bin/e_backlight_main.c index a7f5debb4..21d562f72 100644 --- a/src/bin/e_backlight_main.c +++ b/src/bin/e_backlight_main.c @@ -149,6 +149,18 @@ main(int argc, } closedir(dirp); } + if (maxlevel <= 0) + { + struct stat st; + + snprintf(file, sizeof(file), "/sys/class/leds/lcd-backlight/brightness"); + if (stat(file, &st) >= 0) + { + maxstr = read_file("/sys/devices/leds/lcd-backlight/max_brightness"); + maxlevel = 255; + if (maxstr) maxlevel = atoi(maxstr); + } + } if (maxlevel > 0) { curlevel = ((maxlevel * level) + (500 / maxlevel)) / 1000;