Proper Forma support (#4414)

* Enforce a known rotation on startup, to make sure we handle touch input coordinates properly.
* Proper FrontLight warmth support (thanks to @cairnsh & @pazos in #4291)!
* Fix the PageTurn buttons mapping to match Nickel's defaults
* Properly remap PageTurn buttons depending on the current rotation.
* Actually enable the Mk.7 screen refresh codepath on *all* Mk.7 devices (I'd messed up the device check...).
* Full accelerometer handling (includes a touch of refactoring regarding orientation handling in general).
* Fix insidiously broken USBMS behavior in Nickel after we exit on FW >4.8.

Fix #4291
Fix #3002
This commit is contained in:
NiLuJe
2018-12-28 04:32:42 +01:00
committed by GitHub
parent 295cc55e03
commit f6743a45db
14 changed files with 232 additions and 83 deletions

View File

@@ -97,7 +97,7 @@ if [ "${FROM_NICKEL}" = "true" ]; then
sync
# stop kobo software because it's running
# NOTE: We don't need to kill KFMon, it's smart enough not to allow running anything else while we're up
killall nickel hindenburg sickel fickel fmon 2>/dev/null
killall -TERM nickel hindenburg sickel fickel fmon 2>/dev/null
fi
# fallback for old fmon, KFMon and advboot users (-> if no args were passed to the script, start the FM)
@@ -135,6 +135,22 @@ if [ ! -n "${INTERFACE}" ]; then
fi
# end of value check of PLATFORM
# If we're on a Forma, make sure we start in an orientation we know how to handle (i.e., Portrait, buttons on the Right)
# Because NTX likes mounting panels in weird native rotations, this is actually FB_ROTATE_CCW (3).
# And because shit gets even weirder, we have to echo 1 to get 3 (possibly because 2 is the native rotation, and 3 ^ 2 = 1).
if [ "${PRODUCT}" = "frost" ]; then
# Only mess with this if we were started from Nickel
if [ "${FROM_NICKEL}" = "true" ]; then
# Don't do anything if we're already in the right orientation.
if [ "$(cat /sys/class/graphics/fb0/rotate)" -ne "3" ]; then
echo 1 >/sys/class/graphics/fb0/rotate
# Sleep a bit, for good measure
usleep 250000
fi
fi
fi
# NOTE: We don't have to restore anything on exit, nickel's startup process will take care of everything (pickel -> nickel).
# Remount the SD card RW if it's inserted and currently RO
if awk '$4~/(^|,)ro($|,)/' /proc/mounts | grep ' /mnt/sd '; then
mount -o remount,rw /mnt/sd

View File

@@ -6,6 +6,11 @@ PATH="/sbin:/bin:/usr/sbin:/usr/bin:/usr/lib:"
# NOTE: LD_LIBRARY_PATH is the only late export from rcS we don't siphon in koreader.sh, for obvious reasons ;).
export LD_LIBRARY_PATH="/usr/local/Kobo"
# Reset PWD, and clear up our own custom stuff from the env while we're there, otherwise, USBMS may become very wonky on newer FW...
# shellcheck disable=SC2164
cd /
unset OLDPWD EXT_FONT_DIR TESSDATA_PREFIX FROM_NICKEL STARDICT_DATA_DIR LC_ALL
# Ensures fmon will restart. Note that we don't have to worry about reaping this, nickel kills on-animator.sh on start.
(
if [ "${PLATFORM}" = "freescale" ] || [ "${PLATFORM}" = "mx50-ntx" ] || [ "${PLATFORM}" = "mx6sl-ntx" ]; then
@@ -35,9 +40,10 @@ sync
# And finally, simply restart nickel.
# We don't care about horribly legacy stuff, because if people switch between nickel and KOReader in the first place, I assume they're using a decently recent enough FW version.
# Last tested on an H2O running FW 4.7.x - 4.8.x
# Last tested on an H2O & a Forma running FW 4.7.x - 4.12.x
/usr/local/Kobo/hindenburg &
LIBC_FATAL_STDERR_=1 /usr/local/Kobo/nickel -platform kobo -skipFontLoad &
udevadm trigger &
# Handle sdcard
if [ -e "/dev/mmcblk1p1" ]; then