[Kobo] Unbreak Wi-Fi on FW >= 4.23 (#6522)

* Unbreak Wi-Fi on Kobo w/ FX >= 4.23+

Stop relying on WIFI_MODULE_PATH, it's no longer exported by the init
script.

Fix #6500

* Resync the nickel restart script w/ upstream

Let udev handle the SD card, and actually allow nickel to see those events by re-creating the FIFO ourselves, to avoid races.
reviewable/pr6525/r1
NiLuJe 4 years ago committed by GitHub
parent c8b8ee3ba9
commit b14cabb6de
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -4,8 +4,8 @@
lsmod | grep -q sdio_wifi_pwr || insmod "/drivers/${PLATFORM}/wifi/sdio_wifi_pwr.ko"
# Moar sleep!
usleep 250000
# WIFI_MODULE_PATH = /drivers/$PLATFORM/wifi/$WIFI_MODULE.ko
lsmod | grep -q "${WIFI_MODULE}" || insmod "${WIFI_MODULE_PATH}"
# NOTE: Used to be exported in WIFI_MODULE_PATH before FW 4.23
lsmod | grep -q "${WIFI_MODULE}" || insmod "/drivers/${PLATFORM}/wifi/${WIFI_MODULE}.ko"
# Race-y as hell, don't try to optimize this!
sleep 1

@ -101,9 +101,9 @@ if [ "${VIA_NICKEL}" = "true" ]; then
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)...
# shellcheck disable=SC2046
export $(grep -s -E -e '^(DBUS_SESSION_BUS_ADDRESS|NICKEL_HOME|WIFI_MODULE|LANG|WIFI_MODULE_PATH|INTERFACE)=' "/proc/$(pidof -s nickel)/environ")
export $(grep -s -E -e '^(DBUS_SESSION_BUS_ADDRESS|NICKEL_HOME|WIFI_MODULE|LANG|INTERFACE)=' "/proc/$(pidof -s nickel)/environ")
# NOTE: Quoted variant, w/ the busybox RS quirk (c.f., https://unix.stackexchange.com/a/125146):
#eval "$(awk -v 'RS="\0"' '/^(DBUS_SESSION_BUS_ADDRESS|NICKEL_HOME|WIFI_MODULE|LANG|WIFI_MODULE_PATH|INTERFACE)=/{gsub("\047", "\047\\\047\047"); print "export \047" $0 "\047"}' "/proc/$(pidof -s nickel)/environ")"
#eval "$(awk -v 'RS="\0"' '/^(DBUS_SESSION_BUS_ADDRESS|NICKEL_HOME|WIFI_MODULE|LANG|INTERFACE)=/{gsub("\047", "\047\\\047\047"); print "export \047" $0 "\047"}' "/proc/$(pidof -s nickel)/environ")"
fi
# Flush disks, might help avoid trashing nickel's DB...
@ -173,7 +173,6 @@ if [ -z "${INTERFACE}" ]; then
INTERFACE="eth0"
export INTERFACE
fi
# end of value check of PLATFORM
# 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.

@ -66,19 +66,20 @@ if lsmod | grep -q sdio_wifi_pwr; then
rmmod sdio_wifi_pwr
fi
# Recreate Nickel's FIFO ourselves, otherwise, udev may attempt to write to it before Nickel creates it,
# and Nickel doesn't handle that well (i.e., it doesn't unlink first, the FIFO isn't created, it's now a regular file, hilarity ensues).
# 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
# 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.12.x
# Last tested on an H2O & a Forma running FW 4.7.x - 4.23.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
echo sd add /dev/mmcblk1p1 >>/tmp/nickel-hardware-status &
fi
[ "${PLATFORM}" != "freescale" ] && udevadm trigger &
return 0

Loading…
Cancel
Save