2014-07-03 11:40:53 +00:00
#!/bin/sh
2015-04-26 23:21:54 +00:00
PATH = "/sbin:/bin:/usr/sbin:/usr/bin:/usr/lib"
2015-04-26 20:09:14 +00:00
# Handle the rotation weirdness on some devices
cur_rotate = " $( cat "/sys/class/graphics/fb0/rotate" ) "
2014-07-03 11:40:53 +00:00
2015-04-27 11:04:52 +00:00
# start fmon again. Note that we don't have to worry about reaping this, nickel kills on-animator.sh on start.
2017-04-11 09:28:01 +00:00
(
usleep 400000
/etc/init.d/on-animator.sh
) &
2014-07-03 11:40:53 +00:00
2015-04-26 18:46:30 +00:00
# environment needed by nickel, from /etc/init.d/rcS:
2017-04-11 09:28:01 +00:00
if [ ! -n " ${ WIFI_MODULE_PATH } " ] ; then
INTERFACE = "wlan0"
WIFI_MODULE = "ar6000"
if [ " ${ PLATFORM } " != "freescale" ] ; then
INTERFACE = "eth0"
WIFI_MODULE = "dhd"
fi
export INTERFACE
export WIFI_MODULE
export WIFI_MODULE_PATH = " /drivers/ ${ PLATFORM } /wifi/ ${ WIFI_MODULE } .ko "
2015-04-26 20:09:14 +00:00
fi
2015-04-26 18:46:30 +00:00
export NICKEL_HOME = "/mnt/onboard/.kobo"
export LD_LIBRARY_PATH = "/usr/local/Kobo"
2014-07-03 11:40:53 +00:00
2015-04-26 20:09:14 +00:00
export LANG = "en_US.UTF-8"
2015-05-06 14:53:17 +00:00
# Make sure we kill the WiFi first, because nickel apparently doesn't like it if it's up... (cf. #1520)
# NOTE: That check is possibly wrong on PLATFORM == freescale (because I don't know if the sdio_wifi_pwr module exists there), but we don't terribly care about that.
2017-04-11 09:28:01 +00:00
if lsmod | grep -q sdio_wifi_pwr; then
killall udhcpc default.script wpa_supplicant 2>/dev/null
wlarm_le -i ${ INTERFACE } down
ifconfig ${ INTERFACE } down
# NOTE: Kobo's busybox build is weird. rmmod appears to be modprobe in disguise, defaulting to the -r flag. If re-specifying -r starts to fail one day, switch to rmmod without args, or modprobe -r.
rmmod -r ${ WIFI_MODULE }
rmmod -r sdio_wifi_pwr
2015-05-06 14:53:17 +00:00
fi
# Flush buffers to disk, who knows.
sync
2015-04-26 20:09:14 +00:00
2015-04-27 11:04:52 +00:00
# start nickel again (inspired from KSM, vlasovsoft & the base rcS), this should
# cover at least firmware versions from 2.6.1 to 3.12.1 (tested on a kobo
# mini with 3.4.1 firmware & a H2O on 3.12.1)
2014-07-03 11:40:53 +00:00
2015-05-06 14:53:17 +00:00
# NOTE: Since we're not cold booting, this is technically redundant... On the other hand, it doesn't really hurt either ;).
2015-04-26 20:46:16 +00:00
(
2017-04-11 09:28:01 +00:00
/usr/local/Kobo/pickel disable.rtc.alarm
2015-04-26 22:01:44 +00:00
2017-04-11 09:28:01 +00:00
if [ ! -e "/etc/wpa_supplicant/wpa_supplicant.conf" ] ; then
cp "/etc/wpa_supplicant/wpa_supplicant.conf.template" "/etc/wpa_supplicant/wpa_supplicant.conf"
fi
2015-04-26 22:01:44 +00:00
2017-04-11 09:28:01 +00:00
# FWIW, that appears to be gone from recent rcS scripts. AFAICT, still harmless, though.
echo 1 >"/sys/devices/platform/mxc_dvfs_core.0/enable"
2015-04-26 22:01:44 +00:00
2017-04-11 09:28:01 +00:00
/sbin/hwclock -s -u
2015-04-26 18:46:30 +00:00
) &
2014-07-03 11:40:53 +00:00
2015-05-06 14:53:17 +00:00
# Hey there, nickel!
2017-04-11 09:28:01 +00:00
if [ ! -e "/usr/local/Kobo/platforms/libkobo.so" ] ; then
export QWS_KEYBOARD = "imx508kbd:/dev/input/event0"
export QT_PLUGIN_PATH = "/usr/local/Kobo/plugins"
if [ -e "/usr/local/Kobo/plugins/gfxdrivers/libimxepd.so" ] ; then
export QWS_DISPLAY = "imxepd"
else
export QWS_DISPLAY = "Transformed:imx508:Rot90"
export QWS_MOUSE_PROTO = "tslib_nocal:/dev/input/event1"
fi
# NOTE: Send the output to the void, to avoid spamming the shell with the output of the string of killall commands they periodically send
/usr/local/Kobo/hindenburg >/dev/null 2>& 1 &
/usr/local/Kobo/nickel -qws -skipFontLoad >/dev/null 2>& 1 &
2014-07-03 11:40:53 +00:00
else
2017-04-11 09:28:01 +00:00
/usr/local/Kobo/hindenburg >/dev/null 2>& 1 &
lsmod | grep -q lowmem || insmod " /drivers/ ${ PLATFORM } /misc/lowmem.ko " &
if grep -q "dhcpcd=true" "/mnt/onboard/.kobo/Kobo/Kobo eReader.conf" ; then
dhcpcd -d -t 10 &
fi
/usr/local/Kobo/nickel -platform kobo -skipFontLoad >/dev/null 2>& 1 &
2014-07-03 11:40:53 +00:00
fi
2015-04-26 20:09:14 +00:00
2016-07-31 16:13:16 +00:00
# Ahoy, annoying sickel!
2017-04-11 09:28:01 +00:00
if [ -x /usr/local/Kobo/sickel ] ; then
/usr/local/Kobo/sickel -platform kobo:noscreen >/dev/null 2>& 1 &
2016-07-31 16:13:16 +00:00
fi
2015-04-26 20:09:14 +00:00
# Rotation weirdness, part II
2017-04-11 09:28:01 +00:00
echo " ${ cur_rotate } " >"/sys/class/graphics/fb0/rotate"
2017-04-09 08:42:16 +00:00
# shellcheck disable=SC2094
2017-04-11 09:28:01 +00:00
cat "/sys/class/graphics/fb0/rotate" >"/sys/class/graphics/fb0/rotate"
2015-04-26 23:59:50 +00:00
2015-08-23 11:33:34 +00:00
# Handle sdcard
2017-04-11 09:28:01 +00:00
if [ -e "/dev/mmcblk1p1" ] ; then
echo sd add /dev/mmcblk1p1 >>/tmp/nickel-hardware-status &
2015-08-23 11:33:34 +00:00
fi
2015-04-26 23:59:50 +00:00
return 0