summaryrefslogtreecommitdiffstats
path: root/firmware/target/hosted/lcd-linuxfb.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/hosted/lcd-linuxfb.c')
-rw-r--r--firmware/target/hosted/lcd-linuxfb.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/firmware/target/hosted/lcd-linuxfb.c b/firmware/target/hosted/lcd-linuxfb.c
index 6a57be9e40..8edb82757f 100644
--- a/firmware/target/hosted/lcd-linuxfb.c
+++ b/firmware/target/hosted/lcd-linuxfb.c
@@ -53,15 +53,15 @@ void lcd_init_device(void)
panicf("Cannot open framebuffer: %s\n", fb_dev);
}
- /* get fixed and variable information */
- if(ioctl(fd, FBIOGET_FSCREENINFO, &finfo) < 0)
+ if (fcntl( fd, F_SETFD, FD_CLOEXEC ) < 0)
{
- panicf("Cannot read framebuffer fixed information");
+ panicf("Can't set CLOEXEC");
}
- if(ioctl(fd, FBIOGET_VSCREENINFO, &vinfo) < 0)
+ /* get fixed and variable information */
+ if(ioctl(fd, FBIOGET_FSCREENINFO, &finfo) < 0)
{
- panicf("Cannot read framebuffer variable information");
+ panicf("Cannot read framebuffer fixed information");
}
#if 0
@@ -76,12 +76,17 @@ void lcd_init_device(void)
* values returned by the driver for line_length */
/* map framebuffer */
- framebuffer = mmap(0, FRAMEBUFFER_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
+ framebuffer = mmap(NULL, FRAMEBUFFER_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
if((void *)framebuffer == MAP_FAILED)
{
panicf("Cannot map framebuffer");
}
+ if(ioctl(fd, FBIOGET_VSCREENINFO, &vinfo) < 0)
+ {
+ panicf("Cannot read framebuffer variable information");
+ }
+
memset(framebuffer, 0, finfo.smem_len);
#ifdef HAVE_LCD_ENABLE
@@ -104,7 +109,11 @@ void lcd_enable(bool on)
{
if (fd < 0) return;
+ if (lcd_active() == on)
+ return;
+
lcd_set_active(on);
+
if (on)
{
send_event(LCD_EVENT_ACTIVATION, NULL);