From a3fad804e3e128303d7d07ddbd4e82925856a21b Mon Sep 17 00:00:00 2001 From: WS64 Date: Wed, 27 Aug 2014 12:40:56 +0200 Subject: [PATCH] Bring back the two KOBO variables for the light This should close #856. Although still closed I will check this one back with someone from the German forum, I hope this also closes #822, but there might be still some problems with the light-bug introduced in Kobo's firmware 3.5. But since 822 is already in the state closed we can leave things as they are for now and I will reopen 822 if necessary. --- frontend/ui/device.lua | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/frontend/ui/device.lua b/frontend/ui/device.lua index 42544bf9c..6a65f71d4 100644 --- a/frontend/ui/device.lua +++ b/frontend/ui/device.lua @@ -229,6 +229,7 @@ end function Device:Suspend() if self:isKobo() then + if KOBO_LIGHT_OFF_ON_SUSPEND then self:getPowerDevice():setIntensity(0) end os.execute("./suspend.sh") end end @@ -236,20 +237,16 @@ end function Device:Resume() if self:isKobo() then os.execute("echo 0 > /sys/power/state-extended") - end - self.screen:refresh(1) - local powerd = self:getPowerDevice() - if powerd.fl ~= nil then - powerd.fl:restore() - end - -- FIXME: this conflicts with powerd.fl:restore - --[[ - if KOBO_LIGHT_ON_START and tonumber(KOBO_LIGHT_ON_START) > -1 then + local powerd = self:getPowerDevice() if powerd then - powerd:setIntensity(math.max(math.min(KOBO_LIGHT_ON_START,100),0)) + if KOBO_LIGHT_ON_START and tonumber(KOBO_LIGHT_ON_START) > -1 then + powerd:setIntensity(math.max(math.min(KOBO_LIGHT_ON_START,100),0)) + elseif powerd.fl ~= nil then + powerd.fl:restore() + end end end - --]] + self.screen:refresh(1) self.screen_saver_mode = false end