From 55fa3db6a14322882b32f328a80bba0f4bd464db Mon Sep 17 00:00:00 2001 From: NiLuJe Date: Fri, 16 Oct 2015 02:32:32 +0200 Subject: [PATCH 1/4] Minor tweak to handle FW 5.6.5 better... When launching KOReader with the framework up from KUAL... Our gentle hide/unhide method doesn't work anymore, which leads to various issues, the most obvious being not getting a refresh to the default UI on exit... --- platform/kindle/koreader.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/platform/kindle/koreader.sh b/platform/kindle/koreader.sh index 79576fd3c..32896dca7 100755 --- a/platform/kindle/koreader.sh +++ b/platform/kindle/koreader.sh @@ -261,8 +261,14 @@ if [ "${STOP_FRAMEWORK}" == "no" -a "${INIT_TYPE}" == "upstart" ] ; then #lipc-set-prop com.lab126.pillow disableEnablePillow enable logmsg "Restoring the status bar . . ." lipc-set-prop com.lab126.pillow interrogatePillow '{"pillowId": "default_status_bar", "function": "nativeBridge.showMe();"}' - # Poke the search bar too, so that we get a proper refresh ;) - lipc-set-prop com.lab126.pillow interrogatePillow '{"pillowId": "search_bar", "function": "nativeBridge.hideMe(); nativeBridge.showMe();"}' + # And now we want to poke something to refresh the UI... + if [ "$(printf "%.3s" $(grep '^Kindle 5' /etc/prettyversion.txt 2>&1 | sed -n -r 's/^(Kindle)([[:blank:]]*)([[:digit:].]*)(.*?)$/\3/p' | tr -d '.'))" -ge "565" ] ; then + # FIXME: The old search_bar method doesn't seem to work anymore since FW 5.6.5... Get at least the homescreen back. We're still missing the men :/. + lipc-set-prop com.lab126.appmgrd start app://com.lab126.booklet.home + else + # Poke the search bar too, so that we get a proper refresh ;) + lipc-set-prop com.lab126.pillow interrogatePillow '{"pillowId": "search_bar", "function": "nativeBridge.hideMe(); nativeBridge.showMe();"}' + fi fi fi From 5979f9f855a1901541c4ed4773482008fb3ce3fb Mon Sep 17 00:00:00 2001 From: NiLuJe Date: Fri, 16 Oct 2015 02:40:03 +0200 Subject: [PATCH 2/4] Better and more complete status bar handling. When runnning from KUAL on FW >= 5.6.5 --- platform/kindle/koreader.sh | 38 ++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/platform/kindle/koreader.sh b/platform/kindle/koreader.sh index 32896dca7..b6b6bbad1 100755 --- a/platform/kindle/koreader.sh +++ b/platform/kindle/koreader.sh @@ -177,12 +177,18 @@ fi if [ "${STOP_FRAMEWORK}" == "no" -a "${INIT_TYPE}" == "upstart" ] ; then count=$(lipc-get-prop -eiq com.github.koreader.kpvbooklet.timer count) if [ "$count" == "" -o "$count" == "0" ] ; then - #logmsg "Disabling pillow . . ." - #lipc-set-prop com.lab126.pillow disableEnablePillow disable - logmsg "Hiding the status bar . . ." - # NOTE: One more great find from eureka (http://www.mobileread.com/forums/showpost.php?p=2454141&postcount=34) - lipc-set-prop com.lab126.pillow interrogatePillow '{"pillowId": "default_status_bar", "function": "nativeBridge.hideMe();"}' - PILLOW_DISABLED="yes" + # NOTE: We want to disable the status bar (at the very least). Unfortunately, the soft hide/unhide method doesn't work properly anymore since FW 5.6.5... + if [ "$(printf "%.3s" $(grep '^Kindle 5' /etc/prettyversion.txt 2>&1 | sed -n -r 's/^(Kindle)([[:blank:]]*)([[:digit:].]*)(.*?)$/\3/p' | tr -d '.'))" -ge "565" ] ; then + # FIXME: So we resort to killing pillow completely on FW >= 5.6.5... + logmsg "Disabling pillow . . ." + lipc-set-prop com.lab126.pillow disableEnablePillow disable + PILLOW_HARD_DISABLED="yes" + else + logmsg "Hiding the status bar . . ." + # NOTE: One more great find from eureka (http://www.mobileread.com/forums/showpost.php?p=2454141&postcount=34) + lipc-set-prop com.lab126.pillow interrogatePillow '{"pillowId": "default_status_bar", "function": "nativeBridge.hideMe();"}' + PILLOW_SOFT_DISABLED="yes" + fi if [ "${NO_SLEEP}" == "no" ] ; then # NOTE: Leave the framework time to refresh the screen, so we don't start before it has finished redrawing after collapsing the title bar usleep 250000 @@ -253,22 +259,16 @@ if [ "${STOP_FRAMEWORK}" == "yes" ] ; then fi fi -# display chrome bar (upstart & framework up only) +# Display chrome bar if need be (upstart & framework up only) if [ "${STOP_FRAMEWORK}" == "no" -a "${INIT_TYPE}" == "upstart" ] ; then - # Only if we actually killed it... - if [ "${PILLOW_DISABLED}" == "yes" ] ; then - #logmsg "Enabling pillow . . ." - #lipc-set-prop com.lab126.pillow disableEnablePillow enable + # Depending on the FW version, we may have handled things in two different manners... + if [ "${PILLOW_HARD_DISABLED}" == "yes" ] ; then + logmsg "Enabling pillow . . ." + lipc-set-prop com.lab126.pillow disableEnablePillow enable + fi + if [ "${PILLOW_SOFT_DISABLED}" == "yes" ] ; then logmsg "Restoring the status bar . . ." lipc-set-prop com.lab126.pillow interrogatePillow '{"pillowId": "default_status_bar", "function": "nativeBridge.showMe();"}' - # And now we want to poke something to refresh the UI... - if [ "$(printf "%.3s" $(grep '^Kindle 5' /etc/prettyversion.txt 2>&1 | sed -n -r 's/^(Kindle)([[:blank:]]*)([[:digit:].]*)(.*?)$/\3/p' | tr -d '.'))" -ge "565" ] ; then - # FIXME: The old search_bar method doesn't seem to work anymore since FW 5.6.5... Get at least the homescreen back. We're still missing the men :/. - lipc-set-prop com.lab126.appmgrd start app://com.lab126.booklet.home - else - # Poke the search bar too, so that we get a proper refresh ;) - lipc-set-prop com.lab126.pillow interrogatePillow '{"pillowId": "search_bar", "function": "nativeBridge.hideMe(); nativeBridge.showMe();"}' - fi fi fi From bfb2ee703aebc0b8c4a4332bd8a8326609b2c05a Mon Sep 17 00:00:00 2001 From: NiLuJe Date: Fri, 16 Oct 2015 02:49:39 +0200 Subject: [PATCH 3/4] Force poll the battery when showing the menu. Making sure to always show up to date info. Also fix the battery polling cache invalidation logic to actually work? Should make it behave properly on devices where we handle resuming ourselves. --- frontend/device/generic/powerd.lua | 3 ++- frontend/ui/widget/touchmenu.lua | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/frontend/device/generic/powerd.lua b/frontend/device/generic/powerd.lua index 920ca0a65..036f2b300 100644 --- a/frontend/device/generic/powerd.lua +++ b/frontend/device/generic/powerd.lua @@ -74,7 +74,8 @@ function BasePowerD:getCapacity() end function BasePowerD:refreshCapacity() - self:getCapacityHW() + -- We want our next getCapacity call to actually pull up to date info instead of a cached value ;) + self.capacity_pulled_count = self.capacity_cached_count end function BasePowerD:isCharging() diff --git a/frontend/ui/widget/touchmenu.lua b/frontend/ui/widget/touchmenu.lua index 77c375f78..a23cd44e5 100644 --- a/frontend/ui/widget/touchmenu.lua +++ b/frontend/ui/widget/touchmenu.lua @@ -381,6 +381,8 @@ function TouchMenu:init() } self.bar:switchToTab(self.last_index or 1) + -- Make sure we always show an up to date battery status when first opening the menu... + Device:getPowerDevice():refreshCapacity() self:updateItems() end From 29f14491e1954b4131a5f0a59892f0376a811d13 Mon Sep 17 00:00:00 2001 From: NiLuJe Date: Fri, 16 Oct 2015 02:54:07 +0200 Subject: [PATCH 4/4] Forgot this bit in a previous commit. --- platform/kindle/koreader.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/platform/kindle/koreader.sh b/platform/kindle/koreader.sh index b6b6bbad1..c39f1e1df 100755 --- a/platform/kindle/koreader.sh +++ b/platform/kindle/koreader.sh @@ -41,7 +41,8 @@ if [ "${INIT_TYPE}" == "upstart" ] ; then fi # Keep track of what we do with pillow... -PILLOW_DISABLED="no" +PILLOW_HARD_DISABLED="no" +PILLOW_SOFT_DISABLED="no" # Keep track of if we were started through KUAL FROM_KUAL="no"