bugfix: hack swipe to unlock after going out of screensaver

by feeding a fake tap at the bottom of the screen
pull/2/merge
chrox 11 years ago
parent d00ee9b6de
commit 819467df0b

@ -1,6 +1,8 @@
Device = { Device = {
screen_saver_mode = false, screen_saver_mode = false,
charging_mode = false, charging_mode = false,
survive_screen_saver = false,
touch_dev = nil,
model = nil, model = nil,
} }
@ -79,6 +81,14 @@ function Device:isTouchDevice()
return (self.model == "KindlePaperWhite") or (self.model == "KindleTouch") or util.isEmulated() return (self.model == "KindlePaperWhite") or (self.model == "KindleTouch") or util.isEmulated()
end end
function Device:setTouchInputDev(dev)
self.touch_dev = dev
end
function Device:getTouchInputDev()
return self.touch_dev
end
function Device:intoScreenSaver() function Device:intoScreenSaver()
--os.execute("echo 'screensaver in' >> /mnt/us/event_test.txt") --os.execute("echo 'screensaver in' >> /mnt/us/event_test.txt")
if self.charging_mode == false and self.screen_saver_mode == false then if self.charging_mode == false and self.screen_saver_mode == false then
@ -102,6 +112,7 @@ function Device:outofScreenSaver()
--os.execute("killall -stop cvm") --os.execute("killall -stop cvm")
Screen:restoreFromSavedBB() Screen:restoreFromSavedBB()
Screen:refresh(0) Screen:refresh(0)
self.survive_screen_saver = true
end end
self.screen_saver_mode = false self.screen_saver_mode = false
end end

@ -275,6 +275,7 @@ function Input:init()
local dev_mod = Device:getModel() local dev_mod = Device:getModel()
if dev_mod ~= "KindleTouch" then if dev_mod ~= "KindleTouch" then
-- event0 in KindleTouch is "WM8962 Beep Generator" (useless) -- event0 in KindleTouch is "WM8962 Beep Generator" (useless)
Device:setTouchInputDev("/dev/input/event0")
input.open("/dev/input/event0") input.open("/dev/input/event0")
end end
if dev_mod ~= "KindleTouch" and dev_mod ~= "KindlePaperWhite" then if dev_mod ~= "KindleTouch" and dev_mod ~= "KindlePaperWhite" then
@ -285,6 +286,7 @@ function Input:init()
if dev_mod == "KindlePaperWhite" then if dev_mod == "KindlePaperWhite" then
print("Auto-detected Kindle PaperWhite") print("Auto-detected Kindle PaperWhite")
elseif dev_mod == "KindleTouch" then elseif dev_mod == "KindleTouch" then
Device:setTouchInputDev("/dev/input/event3")
input.open("/dev/input/event2") -- Home button input.open("/dev/input/event2") -- Home button
input.open("/dev/input/event3") -- touchscreen input.open("/dev/input/event3") -- touchscreen
-- KT does have one key! -- KT does have one key!

@ -34,11 +34,22 @@ function exitReader()
input.closeAll() input.closeAll()
if util.isEmulated() ==0 then if util.isEmulated() == 0 then
if Device:isKindle3() or (Device:getModel() == "KindleDXG") then if Device:isKindle3() or (Device:getModel() == "KindleDXG") then
-- send double menu key press events to trigger screen refresh -- send double menu key press events to trigger screen refresh
os.execute("echo 'send 139' > /proc/keypad;echo 'send 139' > /proc/keypad") os.execute("echo 'send 139' > /proc/keypad;echo 'send 139' > /proc/keypad")
end end
if Device:isTouchDevice() and Device.survive_screen_saver then
-- hack the swipe to unlock screen
local dev = Device:getTouchInputDev()
if dev then
local width, height = Screen:getWidth(), Screen:getHeight()
input.fakeTapInput(dev,
math.min(width, height)/2,
math.max(width, height)-30
)
end
end
end end
end end

Loading…
Cancel
Save