2
0
mirror of https://github.com/koreader/koreader synced 2024-11-16 06:12:56 +00:00

kindle: allow stopping the framework on 5.X

this reclaims a bunch of memory useful on low memory devices
This commit is contained in:
yparitcher 2022-08-07 14:11:03 -04:00
parent 55c0fc6190
commit c4a802c486
3 changed files with 26 additions and 3 deletions

View File

@ -121,6 +121,26 @@ local function hasSpecialOffers()
end
end
local function frameworkStopped()
if os.getenv("STOP_FRAMEWORK") == "yes" then
local haslipc, lipc = pcall(require, "liblipclua")
if not (haslipc and lipc) then
logger.warn("could not load liblibclua")
return
end
local lipc_handle = lipc.init("com.lab126.kaf")
if not lipc_handle then
logger.warn("could not get lipc handle")
return
end
local frameworkStarted = lipc_handle:register_int_property("frameworkStarted", "r")
frameworkStarted.value = 1
lipc_handle:set_string_property("com.lab126.blanket", "unload", "splash")
lipc_handle:set_string_property("com.lab126.blanket", "unload", "screensaver")
return lipc_handle
end
end
local Kindle = Generic:new{
model = "Kindle",
isKindle = yes,
@ -150,6 +170,7 @@ local Kindle = Generic:new{
canHWDither = no,
-- The time the device went into suspend
suspend_time = 0,
framework_lipc_handle = frameworkStopped()
}
function Kindle:initNetworkManager(NetworkMgr)
@ -997,6 +1018,10 @@ function KindleTouch:exit()
self.screen:_MTK_ToggleFastMode(false)
end
if self.framework_lipc_handle then
self.framework_lipc_handle:close()
end
Generic.exit(self)
if self.isSpecialOffers then

View File

@ -25,7 +25,6 @@
},
{
"name": "Start KOReader (no framework)",
"if": "\"Kindle2\" -m \"KindleDX\" -m \"KindleDXG\" -m \"Kindle3\" -m \"Kindle4\" -m || || || ||",
"priority": 4,
"action": "/mnt/us/koreader/koreader.sh",
"params": "--kual --framework_stop",

View File

@ -56,6 +56,7 @@ if [ "${INIT_TYPE}" = "upstart" ]; then
fi
# Keep track of what we do with pillow...
export STOP_FRAMEWORK="no"
export AWESOME_STOPPED="no"
export CVM_STOPPED="no"
export VOLUMD_STOPPED="no"
@ -87,12 +88,10 @@ elif [ "${1}" = "--asap" ]; then
# Start as soon as possible, without sleeping to workaround UI quirks
shift 1
NO_SLEEP="yes"
STOP_FRAMEWORK="no"
REEXEC_FLAGS="${REEXEC_FLAGS} --asap"
# Don't sleep during eips calls either...
export EIPS_NO_SLEEP="true"
else
STOP_FRAMEWORK="no"
NO_SLEEP="no"
fi