Minor Kobo startup script cleanups (#6144)

* Minor tweaks to Kobo env setup

* Bump base

(Pickup https://github.com/koreader/koreader-base/pull/1099)
reviewable/pr6099/r3
NiLuJe 4 years ago committed by GitHub
parent 6e9de06fab
commit 12675be065
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1 +1 @@
Subproject commit 0c48e7b57277fb34f424e1402cc909875248a573
Subproject commit 989d3a92b90872b67430fd7fae88ac84e52c05bc

@ -8,7 +8,7 @@ KOREADER_DIR="${0%/*}"
cd "${KOREADER_DIR}" || exit
# Attempt to switch to a sensible CPUFreq governor when that's not already the case...
current_cpufreq_gov="$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor)"
IFS= read -r current_cpufreq_gov <"/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor"
# NOTE: We're being fairly conservative here, because what's used and what's available varies depending on HW...
if [ "${current_cpufreq_gov}" != "ondemand" ] && [ "${current_cpufreq_gov}" != "interactive" ]; then
# NOTE: Go with ondemand, because it's likely to be the lowest common denominator.
@ -86,7 +86,7 @@ if [ "${VIA_NICKEL}" = "true" ]; then
FROM_KFMON="false"
if pkill -0 kfmon; then
# That's a start, now check if KFMon truly is our parent...
if [ "$(pidof kfmon)" -eq "${PPID}" ]; then
if [ "$(pidof -s kfmon)" -eq "${PPID}" ]; then
FROM_KFMON="true"
fi
fi
@ -100,7 +100,7 @@ if [ "${VIA_NICKEL}" = "true" ]; then
# If we were spawned outside of Nickel, we'll need a few extra bits from its own env...
if [ "${FROM_NICKEL}" = "false" ]; then
# Siphon a few things from nickel's env (namely, stuff exported by rcS *after* on-animator.sh has been launched)...
eval "$(xargs -n 1 -0 <"/proc/$(pidof nickel)/environ" | grep -e DBUS_SESSION_BUS_ADDRESS -e NICKEL_HOME -e WIFI_MODULE -e LANG -e WIFI_MODULE_PATH -e INTERFACE 2>/dev/null)"
eval "$(xargs -n 1 -0 <"/proc/$(pidof -s nickel)/environ" | grep -s -F -e DBUS_SESSION_BUS_ADDRESS -e NICKEL_HOME -e WIFI_MODULE -e LANG -e WIFI_MODULE_PATH -e INTERFACE)"
export DBUS_SESSION_BUS_ADDRESS NICKEL_HOME WIFI_MODULE LANG WIFI_MODULE_PATH INTERFACE
fi
@ -119,12 +119,22 @@ else
fi
# check whether PLATFORM & PRODUCT have a value assigned by rcS
if [ -z "${PRODUCT}" ]; then
eval "$(xargs -n 1 -0 <"/proc/$(pidof -s udevd)/environ" | grep -s -F -e PRODUCT)"
export PRODUCT
fi
if [ -z "${PRODUCT}" ]; then
PRODUCT="$(/bin/kobo_config.sh 2>/dev/null)"
export PRODUCT
fi
# PLATFORM is used in koreader for the path to the WiFi drivers (as well as when restarting nickel)
if [ -z "${PLATFORM}" ]; then
eval "$(xargs -n 1 -0 <"/proc/$(pidof -s udevd)/environ" | grep -s -F -e PLATFORM)"
export PLATFORM
fi
if [ -z "${PLATFORM}" ]; then
PLATFORM="freescale"
if dd if="/dev/mmcblk0" bs=512 skip=1024 count=1 | grep -q "HW CONFIG"; then
@ -148,7 +158,7 @@ fi
# We'll want to ensure Portrait rotation to allow us to use faster blitting codepaths @ 8bpp,
# so remember the current one before fbdepth does its thing.
ORIG_FB_ROTA="$(cat /sys/class/graphics/fb0/rotate)"
IFS= read -r ORIG_FB_ROTA <"/sys/class/graphics/fb0/rotate"
echo "Original fb rotation is set @ ${ORIG_FB_ROTA}" >>crash.log 2>&1
# In the same vein, swap to 8bpp,
@ -159,7 +169,7 @@ echo "Original fb rotation is set @ ${ORIG_FB_ROTA}" >>crash.log 2>&1
# NOTE: Even though both pickel & Nickel appear to restore their preferred fb setup, we'll have to do it ourselves,
# as they fail to flip the grayscale flag properly. Plus, we get to play nice with every launch method that way.
# So, remember the current bitdepth, so we can restore it on exit.
ORIG_FB_BPP="$(./fbdepth -g)"
IFS= read -r ORIG_FB_BPP <"/sys/class/graphics/fb0/bits_per_pixel"
echo "Original fb bitdepth is set @ ${ORIG_FB_BPP}bpp" >>crash.log 2>&1
# Sanity check...
case "${ORIG_FB_BPP}" in

Loading…
Cancel
Save