kindle: allow stopping the framework on 5.X

this reclaims a bunch of memory useful on low memory devices
reviewable/pr9442/r1
yparitcher 2 years ago
parent 55c0fc6190
commit c4a802c486

@ -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

@ -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",

@ -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

Loading…
Cancel
Save