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.
2014-07-03 11:40:53 +00:00
( usleep 400000; /etc/init.d/on-animator.sh ) &
2015-04-26 18:46:30 +00:00
# environment needed by nickel, from /etc/init.d/rcS:
2015-04-26 23:21:54 +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.
if lsmod | grep -q sdio_wifi_pwr ; then
2015-09-04 21:14:17 +00:00
killall udhcpc default.script wpa_supplicant 2>/dev/null
2015-05-06 14:53:17 +00:00
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
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
(
/usr/local/Kobo/pickel disable.rtc.alarm
2015-04-26 22:01:44 +00:00
2015-04-26 18:46:30 +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
# FWIW, that appears to be gone from recent rcS scripts. AFAICT, still harmless, though.
2015-04-26 18:46:30 +00:00
echo 1 > "/sys/devices/platform/mxc_dvfs_core.0/enable"
2015-04-26 22:01:44 +00:00
2015-04-26 18:46:30 +00:00
/sbin/hwclock -s -u
) &
2014-07-03 11:40:53 +00:00
2015-05-06 14:53:17 +00:00
# Hey there, nickel!
2015-04-26 18:46:30 +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"
2015-04-26 20:09:14 +00:00
if [ -e "/usr/local/Kobo/plugins/gfxdrivers/libimxepd.so" ] ; then
2015-04-26 18:46:30 +00:00
export QWS_DISPLAY = "imxepd"
else
export QWS_DISPLAY = "Transformed:imx508:Rot90"
export QWS_MOUSE_PROTO = "tslib_nocal:/dev/input/event1"
fi
2015-04-27 00:38:45 +00:00
# NOTE: Send the output to the void, to avoid spamming the shell with the output of the string of killall commands they periodically send
2015-04-26 23:59:50 +00:00
/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
2015-04-26 23:59:50 +00:00
/usr/local/Kobo/hindenburg > /dev/null 2>& 1 &
2015-04-26 20:09:14 +00:00
lsmod | grep -q lowmem || insmod " /drivers/ ${ PLATFORM } /misc/lowmem.ko " &
2015-04-26 18:46:30 +00:00
if grep -q "dhcpcd=true" "/mnt/onboard/.kobo/Kobo/Kobo eReader.conf" ; then
dhcpcd -d -t 10 &
fi
2015-04-26 23:59:50 +00:00
/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!
if [ -x /usr/local/Kobo/sickel ] ; then
/usr/local/Kobo/sickel -platform kobo:noscreen > /dev/null 2>& 1 &
fi
2015-04-26 20:09:14 +00:00
# Rotation weirdness, part II
echo " ${ cur_rotate } " > "/sys/class/graphics/fb0/rotate"
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
if [ -e "/dev/mmcblk1p1" ] ; then
echo sd add /dev/mmcblk1p1 >> /tmp/nickel-hardware-status &
fi
2015-04-26 23:59:50 +00:00
return 0