Kobo: Offer to power off if the power button is held for at least 3 seconds

This commit is contained in:
Cosmin Gorgovan
2016-04-26 23:30:52 +01:00
parent 18c0cee18f
commit 19338cb439
4 changed files with 53 additions and 9 deletions

View File

@@ -258,20 +258,26 @@ function Input:handleKeyBoardEv(ev)
end
end
if ev.value == EVENT_VALUE_KEY_RELEASE then
if keycode == "Light" then
return keycode
elseif keycode == "Power" then
-- Kobo generates Power keycode only, we need to decide whether it's
-- power-on or power-off ourselves.
if self.device.screen_saver_mode then
if keycode == "Power" then
-- Kobo generates Power keycode only, we need to decide whether it's
-- power-on or power-off ourselves.
if self.device.screen_saver_mode then
if ev.value == EVENT_VALUE_KEY_RELEASE then
return "Resume"
else
return "Suspend"
end
else
if ev.value == EVENT_VALUE_KEY_PRESS then
return "PowerPress"
elseif ev.value == EVENT_VALUE_KEY_RELEASE then
return "PowerRelease"
end
end
end
if ev.value == EVENT_VALUE_KEY_RELEASE and keycode == "Light" then
return keycode
end
-- handle modifier keys
if self.modifiers[keycode] ~= nil then
if ev.value == EVENT_VALUE_KEY_PRESS then