From 3bd349301417ed09736b8ca3a8e461716bd2e4cc Mon Sep 17 00:00:00 2001 From: Glen Sawyer Date: Mon, 28 Dec 2020 11:09:10 -0700 Subject: [PATCH] Fix double-pressing reMarkable 2 power button twice to wake up (#7065) --- frontend/device/remarkable/device.lua | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/frontend/device/remarkable/device.lua b/frontend/device/remarkable/device.lua index f6f1f6f0f..de5e37b71 100644 --- a/frontend/device/remarkable/device.lua +++ b/frontend/device/remarkable/device.lua @@ -141,10 +141,22 @@ function Remarkable:setDateTime(year, month, day, hour, min, sec) return os.execute(command) == 0 end -function Remarkable:suspend() +function Remarkable1:suspend() os.execute("systemctl suspend") end +function Remarkable2:suspend() + os.execute("systemctl suspend") + -- While device is suspended, when the user presses the power button and wakes up the device, + -- a "Power" event is NOT sent. + -- So we schedule a manual `UIManager:resume` call just far enough in the future that it won't + -- trigger before the `systemctl suspend` command finishes suspending the device + local UIManager = require("ui/uimanager") + UIManager:scheduleIn(0.5, function() + UIManager:resume() + end) +end + function Remarkable:resume() end