add support for /proc/stb/fp/oled_brightness
authorAndreas Monzner <andreas.monzner@multimedia-labs.de>
Tue, 19 Aug 2008 10:26:17 +0000 (10:26 +0000)
committerAndreas Monzner <andreas.monzner@multimedia-labs.de>
Tue, 19 Aug 2008 10:26:17 +0000 (10:26 +0000)
lib/gdi/lcd.cpp

index ac273c61730a9638425a65a9d46c2d7abe0c8b70..5fe1c3ad0926770050a1cb850542b2863ed01f55 100644 (file)
@@ -95,18 +95,27 @@ int eDBoxLCD::setLCDContrast(int contrast)
 
 int eDBoxLCD::setLCDBrightness(int brightness)
 {
-       int fp;
-       if((fp=open("/dev/dbox/fp0", O_RDWR))<=0)
+       eDebug("setLCDBrightness %d", brightness);
+       FILE *f=fopen("/proc/stb/fp/oled_brightness", "w");
+       if (f)
        {
-               eDebug("[LCD] can't open /dev/dbox/fp0");
-               return(-1);
+               if (fprintf(f, "%d", brightness) == 0)
+                       eDebug("write /proc/stb/fp/oled_brightness failed!! (%m)");
+               fclose(f);
        }
-
-       if(ioctl(fp, FP_IOCTL_LCD_DIMM, &brightness))
+       else
        {
-               eDebug("[LCD] can't set lcd brightness");
+               int fp;
+               if((fp=open("/dev/dbox/fp0", O_RDWR))<=0)
+               {
+                       eDebug("[LCD] can't open /dev/dbox/fp0");
+                       return(-1);
+               }
+
+               if(ioctl(fp, FP_IOCTL_LCD_DIMM, &brightness)<=0)
+                       eDebug("[LCD] can't set lcd brightness (%m)");
+               close(fp);
        }
-       close(fp);
        return(0);
 }