Kobo v5 support (#12401)
This commit is contained in:
1 parent
a1b956d621
commit
dff79e7f7e
5 files changed
+74
-26
No files matched your search
+1
-1
@@ -12,7 +12,7 @@ local function probeDevice()
|
||||
return require("device/kindle/device")
|
||||
end
|
||||
|
||||
local kobo_test_stat = lfs.attributes("/bin/kobo_config.sh")
|
||||
local kobo_test_stat = lfs.attributes("/bin/kobo_config.sh") or lfs.attributes("/usr/bin/hwdetect.sh")
|
||||
if kobo_test_stat then
|
||||
return require("device/kobo/device")
|
||||
end
|
||||
|
||||
@@ -1162,6 +1162,14 @@ local function getCodeName()
|
||||
std_out:close()
|
||||
end
|
||||
end
|
||||
-- If that fails, run another script (since kobo v5 firmware)
|
||||
if not codename then
|
||||
local std_out = io.popen("/usr/bin/hwdetect.sh 2>/dev/null", "re")
|
||||
if std_out then
|
||||
codename = std_out:read("*line")
|
||||
std_out:close()
|
||||
end
|
||||
end
|
||||
return codename
|
||||
end
|
||||
|
||||
|
||||
@@ -211,5 +211,16 @@ esac
|
||||
ifconfig "${INTERFACE}" up
|
||||
[ "${WIFI_MODULE}" = "dhd" ] && wlarm_le -i "${INTERFACE}" up
|
||||
|
||||
# The wifi config moved in FW 5.x
|
||||
if [ -f "/mnt/onboard/.kobo/wpa_supplicant.conf" ]; then
|
||||
# FIXME: This *might* be problematic for USBMS, as we allow Wi-Fi during USBMS (and it happens to be super useful for debugging).
|
||||
# Although wpa_supplicant doesn't appear to keep an fd open to it (good boy!).
|
||||
WPA_SUPP_CONF="/mnt/onboard/.kobo/wpa_supplicant.conf"
|
||||
# -s not supported in FW 5.x
|
||||
WPA_SUPP_EXTRA_PARAMS=""
|
||||
else
|
||||
WPA_SUPP_CONF="/etc/wpa_supplicant/wpa_supplicant.conf"
|
||||
WPA_SUPP_EXTRA_PARAMS="-s"
|
||||
fi
|
||||
pkill -0 wpa_supplicant ||
|
||||
wpa_supplicant -D "${WPA_SUPPLICANT_DRIVER}" -s -i "${INTERFACE}" -c /etc/wpa_supplicant/wpa_supplicant.conf -C /var/run/wpa_supplicant -B
|
||||
wpa_supplicant -D "${WPA_SUPPLICANT_DRIVER}" ${WPA_SUPP_EXTRA_PARAMS} -i "${INTERFACE}" -c "${WPA_SUPP_CONF}" -C /var/run/wpa_supplicant -B
|
||||
@@ -14,7 +14,7 @@ cd "${KOREADER_DIR:-/dev/null}" || exit
|
||||
# To make USBMS behave, relocalize ourselves outside of onboard. Additionally,
|
||||
# this is used by KOReader to detect if the original script has changed after
|
||||
# an update (requiring a complete restart from the parent launcher).
|
||||
if [ "${SCRIPT_DIR}" != "/tmp" ]; then
|
||||
if [ "${SCRIPT_DIR}" != "/tmp" ] && [ "${SCRIPT_DIR}" != "/var/volatile/tmp" ]; then
|
||||
cp -pf "${0}" "/tmp/koreader.sh"
|
||||
chmod 777 "/tmp/koreader.sh"
|
||||
exec "/tmp/koreader.sh" "$@"
|
||||
@@ -217,7 +217,7 @@ if [ "${VIA_NICKEL}" = "true" ]; then
|
||||
# as we want to be able to use our own per-if processes w/ custom args later on.
|
||||
# A SIGTERM does not break anything, it'll just prevent automatic lease renewal until the time
|
||||
# KOReader actually sets the if up itself (i.e., it'll do)...
|
||||
killall -q -TERM nickel hindenburg sickel fickel strickel fontickel adobehost foxitpdf iink dhcpcd-dbus dhcpcd bluealsa bluetoothd fmon nanoclock.lua
|
||||
killall -q -TERM nickel hindenburg sickel fickel strickel fontickel adobehost foxitpdf iink dhcpcd-dbus dhcpcd bluealsa bluetoothd fmon nanoclock.lua memorylogger QtWebEngineProcess
|
||||
|
||||
# Wait for Nickel to die... (oh, procps with killall -w, how I miss you...)
|
||||
kill_timeout=0
|
||||
@@ -249,6 +249,11 @@ if [ -z "${PRODUCT}" ]; then
|
||||
export PRODUCT
|
||||
fi
|
||||
|
||||
if [ -z "${PRODUCT}" ]; then
|
||||
PRODUCT="$(/usr/bin/hwdetect.sh 2>/dev/null)"
|
||||
export PRODUCT
|
||||
fi
|
||||
|
||||
# PLATFORM is used in koreader for the path to the Wi-Fi drivers (as well as when restarting nickel)
|
||||
if [ -z "${PLATFORM}" ]; then
|
||||
# shellcheck disable=SC2046
|
||||
|
||||
+46
-22
@@ -4,6 +4,7 @@ PATH="/sbin:/bin:/usr/sbin:/usr/bin:/usr/lib:"
|
||||
# We don't need to duplicate any of the env setup from rcS, since we will only ever run this to *restart* nickel, and not bootstrap it.
|
||||
# Meaning we've already got most of the necessary env from nickel itself via both our launcher (fmon/KFMon) and our own startup script.
|
||||
# NOTE: LD_LIBRARY_PATH is the only late export from rcS we don't siphon in koreader.sh, for obvious reasons ;).
|
||||
# NOTE: For v5, env will be restored properly before nickel start script.
|
||||
export LD_LIBRARY_PATH="/usr/local/Kobo"
|
||||
# Ditto, 4.28+
|
||||
export QT_GSTREAMER_PLAYBIN_AUDIOSINK=alsasink
|
||||
@@ -17,13 +18,23 @@ unset LC_ALL STARDICT_DATA_DIR EXT_FONT_DIR
|
||||
unset KO_DONT_GRAB_INPUT
|
||||
unset FBINK_FORCE_ROTA
|
||||
|
||||
# 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
|
||||
usleep 400000
|
||||
fi
|
||||
/etc/init.d/on-animator.sh
|
||||
) &
|
||||
# kobo v5 animation is originally done in display-init, we copy the neccessary parts here.
|
||||
if [ -e "/etc/init.d/display-init.sh" ]; then
|
||||
PRODUCT=$(hwdetect.sh)
|
||||
export PRODUCT
|
||||
echo "Starting boot animation..."
|
||||
animator.sh /etc/images/"${PRODUCT}"-on-*.raw.gz &
|
||||
fi
|
||||
|
||||
if [ -e "/etc/init.d/on-animator.sh" ]; then
|
||||
# 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
|
||||
usleep 400000
|
||||
fi
|
||||
/etc/init.d/on-animator.sh
|
||||
) &
|
||||
fi
|
||||
|
||||
# Make sure we kill the Wi-Fi first, because nickel apparently doesn't like it if it's up... (cf. #1520)
|
||||
if grep -q "^${WIFI_MODULE} " "/proc/modules"; then
|
||||
@@ -118,14 +129,6 @@ fi
|
||||
unset KOREADER_DIR
|
||||
unset CPUFREQ_DVFS CPUFREQ_CONSERVATIVE
|
||||
|
||||
# Recreate Nickel's FIFO ourselves, like rcS does, because udev *will* write to it!
|
||||
# Plus, we actually *do* want the stuff udev writes in there to be processed by Nickel, anyway.
|
||||
rm -f "/tmp/nickel-hardware-status"
|
||||
mkfifo "/tmp/nickel-hardware-status"
|
||||
|
||||
# Flush buffers to disk, who knows.
|
||||
sync
|
||||
|
||||
# Handle the sdcard:
|
||||
# We need to unmount it ourselves, or Nickel wigs out and shows an "unrecognized FS" popup until the next fake sd add event.
|
||||
# The following udev trigger should then ensure there's a single sd add event enqueued in the FIFO for it to process,
|
||||
@@ -134,11 +137,32 @@ if [ -e "/dev/mmcblk1p1" ]; then
|
||||
umount /mnt/sd
|
||||
fi
|
||||
|
||||
# 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 & a Forma running FW 4.7.x - 4.25.x
|
||||
/usr/local/Kobo/hindenburg &
|
||||
LIBC_FATAL_STDERR_=1 /usr/local/Kobo/nickel -platform kobo -skipFontLoad &
|
||||
[ "${PLATFORM}" != "freescale" ] && udevadm trigger &
|
||||
if [ -e "/etc/init.d/z-nickel-hardware-status" ]; then
|
||||
# on v5 use the existing startup scripts
|
||||
# Clear LD_LIBRARY_PATH as it gets prepended by start script
|
||||
unset LD_LIBRARY_PATH
|
||||
# since sometime after 5.2, pulseaudio is started in rc.local. Detect and kill:
|
||||
if grep "pulseaudio" "/etc/rc.local"; then
|
||||
killall pulseaudio
|
||||
fi
|
||||
/etc/init.d/z-nickel-hardware-status
|
||||
sync
|
||||
/etc/rc.local
|
||||
else
|
||||
# Recreate Nickel's FIFO ourselves, like rcS does, because udev *will* write to it!
|
||||
# Plus, we actually *do* want the stuff udev writes in there to be processed by Nickel, anyway.
|
||||
rm -f "/tmp/nickel-hardware-status"
|
||||
mkfifo "/tmp/nickel-hardware-status"
|
||||
|
||||
return 0
|
||||
# Flush buffers to disk, who knows.
|
||||
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 & a Forma running FW 4.7.x - 4.25.x
|
||||
/usr/local/Kobo/hindenburg &
|
||||
LIBC_FATAL_STDERR_=1 /usr/local/Kobo/nickel -platform kobo -skipFontLoad &
|
||||
[ "${PLATFORM}" != "freescale" ] && udevadm trigger &
|
||||
fi
|
||||
|
||||
exit 0
|
||||
Reference in new issue
Block a user