From b14cabb6de1a00f2837aa591666177d4c5cd93b3 Mon Sep 17 00:00:00 2001 From: NiLuJe Date: Wed, 19 Aug 2020 00:45:24 +0200 Subject: [PATCH] [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. --- platform/kobo/enable-wifi.sh | 4 ++-- platform/kobo/koreader.sh | 5 ++--- platform/kobo/nickel.sh | 15 ++++++++------- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/platform/kobo/enable-wifi.sh b/platform/kobo/enable-wifi.sh index 98dd0ae9b..733d97267 100755 --- a/platform/kobo/enable-wifi.sh +++ b/platform/kobo/enable-wifi.sh @@ -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 diff --git a/platform/kobo/koreader.sh b/platform/kobo/koreader.sh index 56fcb6824..fe86403bf 100755 --- a/platform/kobo/koreader.sh +++ b/platform/kobo/koreader.sh @@ -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. diff --git a/platform/kobo/nickel.sh b/platform/kobo/nickel.sh index dc6fd0afd..8e7f67331 100755 --- a/platform/kobo/nickel.sh +++ b/platform/kobo/nickel.sh @@ -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