summaryrefslogtreecommitdiff
path: root/firmware/target/hosted/backlight-unix.c
diff options
context:
space:
mode:
authorSolomon Peachy <pizza@shaftnet.org>2020-10-01 22:03:21 -0400
committerSolomon Peachy <pizza@shaftnet.org>2020-10-02 02:24:42 +0000
commit9ee618e8891638027d05114250190f215bc01a63 (patch)
tree8fca5b761f8b7cdfa27eabb973b531bb011974e1 /firmware/target/hosted/backlight-unix.c
parentf4f3255edf95fcecf5ceb9586a529c7600a7cb13 (diff)
downloadrockbox-9ee618e8891638027d05114250190f215bc01a63.tar.gz
rockbox-9ee618e8891638027d05114250190f215bc01a63.zip
hosted: Fix overzealous spamming of backlight and lcd enable
This caused random delays in LCD activity, and also caused key inputs to go nuts Change-Id: Ie483c86f7461455308f8c5f8999df313521c6b55
Diffstat (limited to 'firmware/target/hosted/backlight-unix.c')
-rw-r--r--firmware/target/hosted/backlight-unix.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/firmware/target/hosted/backlight-unix.c b/firmware/target/hosted/backlight-unix.c
index 28bda52b20..06da05e487 100644
--- a/firmware/target/hosted/backlight-unix.c
+++ b/firmware/target/hosted/backlight-unix.c
@@ -44,20 +44,28 @@ bool backlight_hw_init(void)
44 return true; 44 return true;
45} 45}
46 46
47static int last_bl = -1;
48
47void backlight_hw_on(void) 49void backlight_hw_on(void)
48{ 50{
51 if (last_bl != 1) {
49#ifdef HAVE_LCD_ENABLE 52#ifdef HAVE_LCD_ENABLE
50 lcd_enable(true); 53 lcd_enable(true);
51#endif 54#endif
52 sysfs_set_int(sysfs_bl_power, 0); 55 sysfs_set_int(sysfs_bl_power, 0);
56 last_bl = 1;
57 }
53} 58}
54 59
55void backlight_hw_off(void) 60void backlight_hw_off(void)
56{ 61{
57 sysfs_set_int(sysfs_bl_power, 1); 62 if (last_bl != 0) {
63 sysfs_set_int(sysfs_bl_power, 1);
58#ifdef HAVE_LCD_ENABLE 64#ifdef HAVE_LCD_ENABLE
59 lcd_enable(false); 65 lcd_enable(false);
60#endif 66#endif
67 last_bl = 0;
68 }
61} 69}
62 70
63void backlight_hw_brightness(int brightness) 71void backlight_hw_brightness(int brightness)