summaryrefslogtreecommitdiffstats
path: root/minui/graphics_fbdev.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'minui/graphics_fbdev.cpp')
-rw-r--r--minui/graphics_fbdev.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/minui/graphics_fbdev.cpp b/minui/graphics_fbdev.cpp
index 997e9cac2..512a7d0e7 100644
--- a/minui/graphics_fbdev.cpp
+++ b/minui/graphics_fbdev.cpp
@@ -59,11 +59,25 @@ minui_backend* open_fbdev() {
static void fbdev_blank(minui_backend* backend __unused, bool blank)
{
+#if defined(TW_NO_SCREEN_BLANK) && defined(TW_BRIGHTNESS_PATH) && defined(TW_MAX_BRIGHTNESS)
+ int fd;
+ char brightness[4];
+ snprintf(brightness, 4, "%03d", TW_MAX_BRIGHTNESS/2);
+
+ fd = open(TW_BRIGHTNESS_PATH, O_RDWR);
+ if (fd < 0) {
+ perror("cannot open LCD backlight");
+ return;
+ }
+ write(fd, blank ? "000" : brightness, 3);
+ close(fd);
+#else
int ret;
ret = ioctl(fb_fd, FBIOBLANK, blank ? FB_BLANK_POWERDOWN : FB_BLANK_UNBLANK);
if (ret < 0)
perror("ioctl(): blank");
+#endif
}
static void set_displayed_framebuffer(unsigned n)