mirror of
https://github.com/koreader/koreader
synced 2024-11-10 01:10:34 +00:00
Final fixes for kobo suspend
This commit is contained in:
parent
afd4a2d920
commit
a2ff9b9a9b
@ -152,18 +152,16 @@ function Device:outofScreenSaver()
|
||||
self.screen_saver_mode = false
|
||||
end
|
||||
|
||||
function Device:Suspend()
|
||||
UIManager:show(InfoMessage:new{
|
||||
text = _("Standby"),
|
||||
timeout = 4,
|
||||
})
|
||||
Screen:refresh(0)
|
||||
function Device:prepareSuspend()
|
||||
local fl = self:getFrontlight()
|
||||
if fl ~= nil then
|
||||
fl:sleep()
|
||||
fl.fl:sleep()
|
||||
end
|
||||
util.usleep(1500000)
|
||||
Screen:refresh(0)
|
||||
self.screen_saver_mode = true
|
||||
end
|
||||
|
||||
function Device:Suspend()
|
||||
os.execute("./kobo_suspend.sh")
|
||||
end
|
||||
|
||||
@ -173,19 +171,11 @@ function Device:Resume()
|
||||
Screen:refresh(0)
|
||||
local fl = self:getFrontlight()
|
||||
if fl ~= nil then
|
||||
fl:resume()
|
||||
fl.fl:restore()
|
||||
end
|
||||
self.screen_saver_mode = false
|
||||
end
|
||||
|
||||
function Device:Power()
|
||||
if self.screen_saver_mode == true then
|
||||
self:Resume()
|
||||
else
|
||||
self:Suspend()
|
||||
end
|
||||
end
|
||||
|
||||
function Device:usbPlugIn()
|
||||
--os.execute("echo 'usb in' >> /mnt/us/event_test.txt")
|
||||
if self.charging_mode == false and self.screen_saver_mode == false then
|
||||
|
@ -293,11 +293,16 @@ function UIManager:run()
|
||||
Device:usbPlugOut()
|
||||
elseif input_event == "Light" then
|
||||
Device:getFrontlight():toggle()
|
||||
elseif input_event == "Power" then
|
||||
Device:Power()
|
||||
elseif input_event == "Suspend" then
|
||||
Device:Suspend()
|
||||
elseif input_event == "Resume" then
|
||||
elseif (input_event == "Power" and not Device.screen_saver_mode) or
|
||||
input_event == "Suspend" then
|
||||
UIManager:show(InfoMessage:new{
|
||||
text = _("Standby"),
|
||||
timeout = 1,
|
||||
})
|
||||
Device:prepareSuspend()
|
||||
UIManager:scheduleIn(0.5, function() Device:Suspend() end)
|
||||
elseif (input_event == "Power" and Device.screen_saver_mode) or
|
||||
input_event == "Resume" then
|
||||
Device:Resume()
|
||||
else
|
||||
self:sendEvent(input_event)
|
||||
|
Loading…
Reference in New Issue
Block a user