Merge pull request #702 from NiLuJe/master

Some more Kindle tweaks
pull/710/head
Huang Xin 10 years ago
commit 1c2b53bec9

@ -45,4 +45,10 @@ function ReaderActivityIndicator:onStopActivityIndicator()
return true
end
function ReaderActivityIndicator:coda()
if self.lipc_handle then
self.lipc_handle:close()
end
end
return ReaderActivityIndicator

@ -8,7 +8,7 @@ local KindlePowerD = BasePowerD:new{
kt_kpw_capacity = "/sys/devices/system/yoshi_battery/yoshi_battery0/battery_capacity",
kpw_charging = "/sys/devices/platform/aplite_charger.0/charging",
kt_charging = "/sys/devices/platform/fsl-usb2-udc/charging",
flIntensity = nil,
battCapacity = nil,
is_charging = nil,
@ -26,9 +26,9 @@ end
function KindlePowerD:init(model)
local lipc = require("liblipclua")
if lipc then
self.lipc_handle = lipc.init("com.github.koreader")
self.lipc_handle = lipc.init("com.github.koreader.kindlepowerd")
end
if model == "KindleTouch" then
self.batt_capacity_file = self.kt_kpw_capacity
self.is_charging_file = self.kt_charging
@ -83,4 +83,10 @@ function KindlePowerD:isChargingHW()
return self.is_charging == 1
end
function KindlePowerD:coda()
if self.lipc_handle then
self.lipc_handle:close()
end
end
return KindlePowerD

@ -26,6 +26,18 @@
"priority": 4,
"action": "/mnt/us/koreader/koreader.sh",
"params": "--framework_stop"
},
{
"name": "Start the filemanager (ASAP)",
"priority": 5,
"action": "/mnt/us/koreader/koreader.sh",
"params": "--asap /mnt/us/documents"
},
{
"name": "Open the last document (ASAP)",
"priority": 6,
"action": "/mnt/us/koreader/koreader.sh",
"params": "--asap"
}
]
}

@ -34,24 +34,37 @@ logmsg()
# Keep track of what we do with pillow...
PILLOW_DISABLED="no"
# Detect if we were started by KUAL by checking our nice value...
if [ "$(nice)" == "5" ] ; then
# Yield a bit to let stuff stop properly...
logmsg "Hush now . . ."
# NOTE: This may or may not be terribly useful...
usleep 250000
# Kindlet threads spawn with a nice value of 5, we aim for the same -2 as the KF8 reader
logmsg "Be nice!"
renice -n -7 $$
fi
# Keep track of if we were started through KUAL
FROM_KUAL="no"
# By default, don't stop the framework.
if [ "$1" == "--framework_stop" ] ; then
shift 1
STOP_FRAMEWORK="yes"
NO_SLEEP="no"
elif [ "$1" == "--asap" ] ; then
# Start as soon as possible, without sleeping to workaround UI quirks
shift 1
NO_SLEEP="yes"
STOP_FRAMEWORK="no"
else
STOP_FRAMEWORK="no"
NO_SLEEP="no"
fi
# Detect if we were started by KUAL by checking our nice value...
if [ "$(nice)" == "5" ] ; then
FROM_KUAL="yes"
if [ "${NO_SLEEP}" == "no" ] ; then
# Yield a bit to let stuff stop properly...
logmsg "Hush now . . ."
# NOTE: This may or may not be terribly useful...
usleep 250000
fi
# Kindlet threads spawn with a nice value of 5, we aim for the same -2 as the KF8 reader
logmsg "Be nice!"
renice -n -7 $$
fi
# we're always starting from our working directory
@ -120,8 +133,16 @@ if [ "${STOP_FRAMEWORK}" == "no" -a "${INIT_TYPE}" == "upstart" ] ; then
# 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: Leave the framework time to refresh the screen, so we don't start before it has finished redrawing after collapsing pillow/the chrome bar
usleep 250000
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
# NOTE: If we were started from KUAL, we risk getting a list item to popup right over us, so, wait some more...
# The culprit appears to be a I WindowManager:flashTimeoutExpired:window=Root 0 0 600x30
if [ "${FROM_KUAL}" == "yes" ] ; then
logmsg "Playing possum to wait for the window manager . . ."
usleep 2500000
fi
fi
fi
fi

@ -1 +1 @@
Subproject commit 25deec728a94d9546e38f494bc47b26808742008
Subproject commit a6bdb7cd75fa58d5073b522aa4d8de7a3273c68b

@ -38,10 +38,17 @@ local ReaderUI = require("apps/reader/readerui")
local Profiler = nil
function exitReader()
local KindlePowerD = require("ui/device/kindlepowerd")
local ReaderActivityIndicator = require("apps/reader/modules/readeractivityindicator")
G_reader_settings:close()
input.closeAll()
-- Close lipc handles
KindlePowerD:coda()
ReaderActivityIndicator:coda()
if not util.isEmulated() then
if Device:isKindle3() or (Device:getModel() == "KindleDXG") then
-- send double menu key press events to trigger screen refresh

Loading…
Cancel
Save