DBoxLCD: keep tidy when no device is found
authorMirakels <mirakels@openpli.org>
Fri, 4 Dec 2015 10:27:05 +0000 (11:27 +0100)
committerMirakels <mirakels@openpli.org>
Fri, 4 Dec 2015 10:27:05 +0000 (11:27 +0100)
If the dbox device is not found there is no point in allocating
buffers and trying to do brightness and contrast control

lib/gdi/lcd.cpp

index aed9f44..3714670 100644 (file)
@@ -124,11 +124,11 @@ eDBoxLCD::eDBoxLCD()
                        lcd_type = 3;
                }
                eDebug("[eDboxLCD] xres=%d, yres=%d, bpp=%d lcd_type=%d", xres, yres, bpp, lcd_type);
+
+               instance = this;
+               setSize(xres, yres, bpp);
        }
 #endif
-       instance = this;
-
-       setSize(xres, yres, bpp);
 }
 
 void eDBoxLCD::setInverted(unsigned char inv)
@@ -146,6 +146,8 @@ void eDBoxLCD::setFlipped(bool onoff)
 int eDBoxLCD::setLCDContrast(int contrast)
 {
 #ifndef NO_LCD
+       if (lcdfd < 0)
+               return(0);
 
 #ifndef LCD_IOCTL_SRV
 #define LCDSET                  0x1000
@@ -170,6 +172,9 @@ int eDBoxLCD::setLCDContrast(int contrast)
 int eDBoxLCD::setLCDBrightness(int brightness)
 {
 #ifndef NO_LCD
+       if (lcdfd < 0)
+               return(0);
+
        eDebug("[eDboxLCD] setLCDBrightness %d", brightness);
        FILE *f=fopen("/proc/stb/lcd/oled_brightness", "w");
        if (!f)