From 4510625d375cea59ef6cf011b7c7b67b30f43d3a Mon Sep 17 00:00:00 2001 From: NiLuJe Date: Mon, 29 Feb 2016 16:59:15 +0100 Subject: [PATCH 1/5] Unbreak native screensavers on Kindle >= 5.7.2 Which I broke the last time I touched this. NOTE: I'm not quire sure why the bbsave/bbrestore on stop/resume did a double check (screensaver & charging), because that effectiely disabled it when charging, which I don't quite understand... Also makes sure the needsScreenRefreshAfterResume flag is honored on Kindles, because we need it on FW >= 5.7.2 Note that this *breaks* the behavior with passcode enabled, which was unwittingly fixed in said previous changes... re #1811 --- frontend/device/generic/device.lua | 15 +++++++++++++-- platform/kindle/koreader.sh | 4 ++-- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/frontend/device/generic/device.lua b/frontend/device/generic/device.lua index 8833a12df..eb5796555 100644 --- a/frontend/device/generic/device.lua +++ b/frontend/device/generic/device.lua @@ -78,21 +78,32 @@ end -- ONLY used for Kindle devices function Device:intoScreenSaver() local UIManager = require("ui/uimanager") - if self.charging_mode == false and self.screen_saver_mode == false then + if self.screen_saver_mode == false then self.screen:saveCurrentBB() self.screen_saver_mode = true end UIManager:sendEvent(Event:new("FlushSettings")) + -- On FW >= 5.7.2, we sigstop awesome, but we need it to show stuff... + if os.getenv("AWESOME_STOPPED") == "yes" then + os.execute("killall -cont awesome") + end end -- ONLY used for Kindle devices function Device:outofScreenSaver() - if self.screen_saver_mode == true and self.charging_mode == false then + -- On FW >= 5.7.2, put awesome to sleep again... + if os.getenv("AWESOME_STOPPED") == "yes" then + os.execute("killall -stop awesome") + end + if self.screen_saver_mode == true then -- wait for native system update screen before we recover saved -- Blitbuffer. util.usleep(1500000) self.screen:restoreFromSavedBB() self:resume() + if self:needsScreenRefreshAfterResume() then + self.screen:refreshFull() + end end self.screen_saver_mode = false end diff --git a/platform/kindle/koreader.sh b/platform/kindle/koreader.sh index 61e871407..4f451e093 100755 --- a/platform/kindle/koreader.sh +++ b/platform/kindle/koreader.sh @@ -41,7 +41,7 @@ if [ "${INIT_TYPE}" == "upstart" ] ; then fi # Keep track of what we do with pillow... -AWESOME_STOPPED="no" +export AWESOME_STOPPED="no" PILLOW_HARD_DISABLED="no" PILLOW_SOFT_DISABLED="no" @@ -297,9 +297,9 @@ if [ "${STOP_FRAMEWORK}" == "no" -a "${INIT_TYPE}" == "upstart" ] ; then # NOTE: Try to leave the user with a slightly more useful FB content than our own last screen... cat /var/tmp/koreader-fb.dump > /dev/fb0 rm -f /var/tmp/koreader-fb.dump + lipc-set-prop com.lab126.appmgrd start app://com.lab126.booklet.home # NOTE: In case we ever need an extra full flash refresh... #eips -s w=${SCREEN_X_RES},h=${SCREEN_Y_RES} -f - lipc-set-prop com.lab126.appmgrd start app://com.lab126.booklet.home fi if [ "${PILLOW_SOFT_DISABLED}" == "yes" ] ; then logmsg "Restoring the status bar . . ." From 278f060c2a7852eef93fcf855e6181b3b57abb12 Mon Sep 17 00:00:00 2001 From: NiLuJe Date: Mon, 29 Feb 2016 17:09:44 +0100 Subject: [PATCH 2/5] Disable the Kindle passcode while we're running Because we cannot deal with it properly... We'd need to be able to stop eating all input, and have a lot of luck with refresh timings to actually have the popup visible at the right time. TL;DR: it's a mess, kill it with fire. Fix #1811 --- platform/kindle/koreader.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/platform/kindle/koreader.sh b/platform/kindle/koreader.sh index 4f451e093..ce2329f75 100755 --- a/platform/kindle/koreader.sh +++ b/platform/kindle/koreader.sh @@ -44,6 +44,7 @@ fi export AWESOME_STOPPED="no" PILLOW_HARD_DISABLED="no" PILLOW_SOFT_DISABLED="no" +PASSCODE_DISABLED="no" # Keep track of if we were started through KUAL FROM_KUAL="no" @@ -166,6 +167,14 @@ if [ -d /mnt/us/linkfonts/fonts ] ; then fi fi +# check if we need to disable the system passcode, because it messes with us in fun and interesting (and, more to the point, intractable) ways... +# NOTE: The most egregious one being that it inhibits the power button event on wakeup until the passcode is validated, which we can't do, since we capture all input... +if [ -f "/var/local/system/userpasswdenabled" ] ; then + logmsg "Disabling system passcode . . ." + rm -f "/var/local/system/userpasswdenabled" + PASSCODE_DISABLED="yes" +fi + # check if we are supposed to shut down the Amazon framework if [ "${STOP_FRAMEWORK}" == "yes" ] ; then logmsg "Stopping the framework . . ." @@ -315,3 +324,8 @@ if [ "${INIT_TYPE}" == "upstart" -o "$(uname -r)" == "2.6.31-rt11-lab126" ] ; th iptables -D INPUT -i wlan0 -p tcp --dport 49152:49162 -j ACCEPT fi +if [ "${PASSCODE_DISABLED}" == "yes" ] ; then + logmsg "Restoring system passcode . . ." + touch "/var/local/system/userpasswdenabled" +fi + From b0c2821ed8b38574d54ebdd73e4dc301ff5987f2 Mon Sep 17 00:00:00 2001 From: NiLuJe Date: Mon, 29 Feb 2016 18:09:24 +0100 Subject: [PATCH 3/5] More accurate comment. I think better on a full stomach ;p. --- platform/kindle/koreader.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/kindle/koreader.sh b/platform/kindle/koreader.sh index ce2329f75..ece131488 100755 --- a/platform/kindle/koreader.sh +++ b/platform/kindle/koreader.sh @@ -168,7 +168,7 @@ if [ -d /mnt/us/linkfonts/fonts ] ; then fi # check if we need to disable the system passcode, because it messes with us in fun and interesting (and, more to the point, intractable) ways... -# NOTE: The most egregious one being that it inhibits the power button event on wakeup until the passcode is validated, which we can't do, since we capture all input... +# NOTE: The most egregious one being that it inhibits the outOfScreenSaver event on wakeup until the passcode is validated, which we can't do, since we capture all input... if [ -f "/var/local/system/userpasswdenabled" ] ; then logmsg "Disabling system passcode . . ." rm -f "/var/local/system/userpasswdenabled" From aa0450ab5da1e8525abbaa66aeb48649e4520336 Mon Sep 17 00:00:00 2001 From: NiLuJe Date: Mon, 29 Feb 2016 18:22:52 +0100 Subject: [PATCH 4/5] Fix volumd's USBMS splash screen on FW 5.7.x That clears up my previous queries abour the dual checks ;p. --- frontend/device/generic/device.lua | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/frontend/device/generic/device.lua b/frontend/device/generic/device.lua index eb5796555..db739d537 100644 --- a/frontend/device/generic/device.lua +++ b/frontend/device/generic/device.lua @@ -78,24 +78,24 @@ end -- ONLY used for Kindle devices function Device:intoScreenSaver() local UIManager = require("ui/uimanager") - if self.screen_saver_mode == false then + if self.charging_mode == false and self.screen_saver_mode == false then self.screen:saveCurrentBB() self.screen_saver_mode = true + -- On FW >= 5.7.2, we sigstop awesome, but we need it to show stuff... + if os.getenv("AWESOME_STOPPED") == "yes" then + os.execute("killall -cont awesome") + end end UIManager:sendEvent(Event:new("FlushSettings")) - -- On FW >= 5.7.2, we sigstop awesome, but we need it to show stuff... - if os.getenv("AWESOME_STOPPED") == "yes" then - os.execute("killall -cont awesome") - end end -- ONLY used for Kindle devices function Device:outofScreenSaver() - -- On FW >= 5.7.2, put awesome to sleep again... - if os.getenv("AWESOME_STOPPED") == "yes" then - os.execute("killall -stop awesome") - end - if self.screen_saver_mode == true then + if self.screen_saver_mode == true and self.charging_mode == false then + -- On FW >= 5.7.2, put awesome to sleep again... + if os.getenv("AWESOME_STOPPED") == "yes" then + os.execute("killall -stop awesome") + end -- wait for native system update screen before we recover saved -- Blitbuffer. util.usleep(1500000) @@ -151,12 +151,22 @@ function Device:resume() end function Device:usbPlugIn() if self.charging_mode == false and self.screen_saver_mode == false then self.screen:saveCurrentBB() + -- On FW >= 5.7.2, we sigstop awesome, but we need it to show stuff... + if os.getenv("AWESOME_STOPPED") == "yes" then + os.execute("killall -cont awesome") + end end self.charging_mode = true end function Device:usbPlugOut() if self.charging_mode == true and self.screen_saver_mode == false then + -- On FW >= 5.7.2, put awesome to sleep again... + if os.getenv("AWESOME_STOPPED") == "yes" then + os.execute("killall -stop awesome") + end + -- Same as when going out of screensaver, wait for the native system + util.usleep(1500000) self.screen:restoreFromSavedBB() self.screen:refreshFull() end From 7d0c354ffb9efd29ff80f989aca33582e87d5da3 Mon Sep 17 00:00:00 2001 From: NiLuJe Date: Mon, 29 Feb 2016 19:49:37 +0100 Subject: [PATCH 5/5] Unbreak battery status refresh on resume on Kindle Went kaput w/ #1854 --- frontend/device/generic/device.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/frontend/device/generic/device.lua b/frontend/device/generic/device.lua index db739d537..8f20197da 100644 --- a/frontend/device/generic/device.lua +++ b/frontend/device/generic/device.lua @@ -104,6 +104,7 @@ function Device:outofScreenSaver() if self:needsScreenRefreshAfterResume() then self.screen:refreshFull() end + self.powerd:refreshCapacity() end self.screen_saver_mode = false end @@ -169,6 +170,7 @@ function Device:usbPlugOut() util.usleep(1500000) self.screen:restoreFromSavedBB() self.screen:refreshFull() + self.powerd:refreshCapacity() end --@TODO signal filemanager for file changes 13.06 2012 (houqp)