mirror of
https://github.com/koreader/koreader.git
synced 2025-12-13 20:36:53 +01:00
AutoSuspend: Handle standby scheduling in the same manner as suspend/shutdown (#8985)
Specifically, don't forcibly unschedule/schedule on every input event, instead, let the scheduled task figure out if the deadline came to pass or not ;). c.f., https://github.com/koreader/koreader/pull/8970#issuecomment-1092775830 Besides getting rid of some overhead, this allows proper scheduling after a task that would have blocked for longer than the standby timeout.
This commit is contained in:
@@ -776,12 +776,13 @@ function Kobo:standby(max_duration)
|
||||
local TimeVal = require("ui/timeval")
|
||||
local standby_time_tv = TimeVal:boottime_or_realtime_coarse()
|
||||
|
||||
logger.info("Kobo suspend: asking to enter standby . . .")
|
||||
local ret = writeToSys("standby", "/sys/power/state")
|
||||
|
||||
self.last_standby_tv = TimeVal:boottime_or_realtime_coarse() - standby_time_tv
|
||||
self.total_standby_tv = self.total_standby_tv + self.last_standby_tv
|
||||
|
||||
logger.info("Kobo suspend: asked the kernel to put subsystems to standby, ret:", ret)
|
||||
logger.info("Kobo suspend: zZz zZz zZz zZz? Write syscall returned: ", ret)
|
||||
|
||||
if max_duration then
|
||||
self.wakeup_mgr:removeTask(nil, nil, dummy)
|
||||
|
||||
Reference in New Issue
Block a user