[reMarkable] Don't use KOReader suspend/screensaver/autosuspend when Oxide is running (#8900)

* Ignore hardware sleep button

When running KOReader with a launcher, having the power button trigger the Power event conflicts with the launcher's built-in screensaver (see https://github.com/koreader/koreader/issues/8891). This commit ignores the hardware power button in KOReader and lets the launcher handle sleep and wake normally.

* Disable autosuspend

If a launcher is active, there will be no way to un-suspend because the power button is ignored by KOReader and handled by the launcher.

* Ignore power button only if Oxide is running

Same with disabling auto suspend
reviewable/pr8940/r1
Will 2 years ago committed by GitHub
parent d761b62076
commit c04fba943d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,5 +1,6 @@
local Generic = require("device/generic/device") -- <= look at this file!
local TimeVal = require("ui/timeval")
local PluginShare = require("pluginshare")
local logger = require("logger")
local ffi = require("ffi")
local C = ffi.C
@ -112,12 +113,28 @@ end
function Remarkable:init()
local oxide_running = os.execute("systemctl is-active --quiet tarnish") == 0
logger.info(string.format("Oxide running?: %s", oxide_running))
-- experiment
-- logger.info("PPID:")
-- local parent_process = os.execute("echo $PPID")
-- os.execute("ps | grep $PPID")
-- logger.info(string.format("parent proccess is oxide?: %s", parent_process_is_oxide))
self.screen = require("ffi/framebuffer_mxcfb"):new{device = self, debug = logger.dbg}
self.powerd = require("device/remarkable/powerd"):new{
device = self,
capacity_file = self.battery_path,
status_file = self.status_path,
}
local event_map = require("device/remarkable/event_map")
-- If we are launched while Oxide is running, remove Power from the event map
if oxide_running then
event_map[116] = nil
end
self.input = require("device/input"):new{
device = self,
event_map = require("device/remarkable/event_map"),
@ -140,6 +157,11 @@ function Remarkable:init()
self.screen.native_rotation_mode = rotation_mode
self.screen.cur_rotation_mode = rotation_mode
if oxide_running then
-- Disable autosuspend on this device
PluginShare.pause_auto_suspend = true
end
Generic.init(self)
end
@ -212,3 +234,4 @@ if isRm2 then
else
return Remarkable1
end

Loading…
Cancel
Save