mirror of
https://github.com/koreader/koreader.git
synced 2025-12-13 20:36:53 +01:00
Assorted bag of fixes (#4014)
* Link to the WiKi, it's a bit more explainy ;). * More WiFi trickery for some HW revs * Fix Rev2 detection under KSM That's to future-proof it, the other end of this hasn't made it into current KSM build yet. * Resync nickel.sh w/ current rcS We don't have CPU, but we have PLATFORM, which is based on CPU, so, that'll do :). * Go back to using rmmod instead of modprobe -r Functionally identical on current FW, will potentially avoid getting outsmarted by modprobe if Kobo ever deigns shipping an actually usable Linux system one day... * Don't crash if screensavers directory doesn't exist c.f., https://www.mobileread.com/forums/showpost.php?p=3706979&postcount=2919
This commit is contained in:
@@ -403,7 +403,7 @@ end
|
||||
|
||||
local function getProductId()
|
||||
-- Try to get it from the env first (KSM only)
|
||||
local product_id = os.getenv("PRODUCT_ID")
|
||||
local product_id = os.getenv("MODEL_NUMBER")
|
||||
-- If that fails, devise it ourselves
|
||||
if not product_id then
|
||||
local version_file = io.open("/mnt/onboard/.kobo/version", "r")
|
||||
|
||||
@@ -24,19 +24,24 @@ local function getRandomImage(dir)
|
||||
local pics = {}
|
||||
local i = 0
|
||||
math.randomseed(os.time())
|
||||
for entry in lfs.dir(dir) do
|
||||
if lfs.attributes(dir .. entry, "mode") == "file" then
|
||||
local extension =
|
||||
string.lower(string.match(entry, ".+%.([^.]+)") or "")
|
||||
if extension == "jpg"
|
||||
or extension == "jpeg"
|
||||
or extension == "png" then
|
||||
i = i + 1
|
||||
pics[i] = entry
|
||||
local ok, iter, dir_obj = pcall(lfs.dir, dir)
|
||||
if ok then
|
||||
for entry in iter, dir_obj do
|
||||
if lfs.attributes(dir .. entry, "mode") == "file" then
|
||||
local extension =
|
||||
string.lower(string.match(entry, ".+%.([^.]+)") or "")
|
||||
if extension == "jpg"
|
||||
or extension == "jpeg"
|
||||
or extension == "png" then
|
||||
i = i + 1
|
||||
pics[i] = entry
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if i == 0 then
|
||||
if i == 0 then
|
||||
return nil
|
||||
end
|
||||
else
|
||||
return nil
|
||||
end
|
||||
return dir .. pics[math.random(i)]
|
||||
|
||||
@@ -4,16 +4,16 @@
|
||||
|
||||
killall udhcpc default.script wpa_supplicant 2>/dev/null
|
||||
|
||||
[ "${WIFI_MODULE}" != "8189fs" ] && wlarm_le -i "${INTERFACE}" down
|
||||
[ "${WIFI_MODULE}" != "8189fs" ] && [ "${WIFI_MODULE}" != "8189es" ] && wlarm_le -i "${INTERFACE}" down
|
||||
ifconfig "${INTERFACE}" down
|
||||
|
||||
# Some sleep in between may avoid system getting hung
|
||||
# (we test if a module is actually loaded to avoid unneeded sleeps)
|
||||
if lsmod | grep -q "${WIFI_MODULE}"; then
|
||||
usleep 250000
|
||||
modprobe -r "${WIFI_MODULE}"
|
||||
rmmod "${WIFI_MODULE}"
|
||||
fi
|
||||
if lsmod | grep -q sdio_wifi_pwr; then
|
||||
usleep 250000
|
||||
modprobe -r sdio_wifi_pwr
|
||||
rmmod sdio_wifi_pwr
|
||||
fi
|
||||
|
||||
@@ -11,7 +11,7 @@ lsmod | grep -q "${WIFI_MODULE}" || insmod "${WIFI_MODULE_PATH}"
|
||||
sleep 1
|
||||
|
||||
ifconfig "${INTERFACE}" up
|
||||
[ "$WIFI_MODULE" != "8189fs" ] && wlarm_le -i "${INTERFACE}" up
|
||||
[ "$WIFI_MODULE" != "8189fs" ] && [ "${WIFI_MODULE}" != "8189es" ] && wlarm_le -i "${INTERFACE}" up
|
||||
|
||||
pidof wpa_supplicant >/dev/null \
|
||||
|| env -u LD_LIBRARY_PATH \
|
||||
|
||||
@@ -20,4 +20,4 @@ When you update KOReader manually, it should be sufficient to simply extract the
|
||||
|
||||
NOTE: Using the legacy version of fmon (http://www.mobileread.com/forums/showthread.php?t=218283) is *STRONGLY* discouraged.
|
||||
NOTE²: If you like the concept, and want to check out something a bit more flexible/complex, check out KFMon (https://github.com/NiLuJe/kfmon).
|
||||
|
||||
In which case, look at the relevant WiKi page (https://github.com/koreader/koreader/wiki/Installation-on-Kobo-devices) for more details ;).
|
||||
|
||||
@@ -71,7 +71,7 @@ if [ ! -n "${PRODUCT}" ]; then
|
||||
export PRODUCT
|
||||
fi
|
||||
|
||||
# PLATFORM is used in koreader for the path to the WiFi drivers
|
||||
# PLATFORM is used in koreader for the path to the WiFi drivers (as well as when restarting nickel)
|
||||
if [ ! -n "${PLATFORM}" ]; then
|
||||
PLATFORM="freescale"
|
||||
if dd if="/dev/mmcblk0" bs=512 skip=1024 count=1 | grep -q "HW CONFIG"; then
|
||||
@@ -79,13 +79,7 @@ if [ ! -n "${PLATFORM}" ]; then
|
||||
PLATFORM="${CPU}-ntx"
|
||||
fi
|
||||
|
||||
if [ "${PLATFORM}" = "freescale" ]; then
|
||||
if [ ! -s "/lib/firmware/imx/epdc_E60_V220.fw" ]; then
|
||||
mkdir -p "/lib/firmware/imx"
|
||||
dd if="/dev/mmcblk0" bs=512K skip=10 count=1 | zcat >"/lib/firmware/imx/epdc_E60_V220.fw"
|
||||
sync
|
||||
fi
|
||||
elif [ ! -e "/etc/u-boot/${PLATFORM}/u-boot.mmc" ]; then
|
||||
if [ "${PLATFORM}" != "freescale" ] && [ ! -e "/etc/u-boot/${PLATFORM}/u-boot.mmc" ]; then
|
||||
PLATFORM="ntx508"
|
||||
fi
|
||||
export PLATFORM
|
||||
|
||||
@@ -3,8 +3,9 @@ PATH="/sbin:/bin:/usr/sbin:/usr/bin:/usr/lib:"
|
||||
|
||||
# Ensures fmon will restart. Note that we don't have to worry about reaping this, nickel kills on-animator.sh on start.
|
||||
(
|
||||
# NOTE: Recent FW versions appear to do away with the sleep on some platforms (I'm assuming the newer, faster, better ones!)
|
||||
usleep 400000
|
||||
if [ "${PLATFORM}" = "freescale" ] || [ "${PLATFORM}" = "mx50-ntx" ] || [ "${PLATFORM}" = "mx6sl-ntx" ]; then
|
||||
usleep 400000
|
||||
fi
|
||||
/etc/init.d/on-animator.sh
|
||||
) &
|
||||
|
||||
@@ -17,14 +18,16 @@ export LD_LIBRARY_PATH="/usr/local/Kobo"
|
||||
# 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
|
||||
killall udhcpc default.script wpa_supplicant 2>/dev/null
|
||||
[ "${WIFI_MODULE}" != "8189fs" ] && wlarm_le -i "${INTERFACE}" down
|
||||
[ "${WIFI_MODULE}" != "8189fs" ] && [ "${WIFI_MODULE}" != "8189es" ] && 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. Use modprobe -r just to be safe...
|
||||
# NOTE: Kobo's busybox build is weird. rmmod appears to be modprobe in disguise, defaulting to the -r flag...
|
||||
# But since there's currently no modules.dep file being shipped, nor do they include the depmod applet,
|
||||
# go with what the FW is doing, which is rmmod.
|
||||
# c.f., #2394?
|
||||
usleep 250000
|
||||
modprobe -r "${WIFI_MODULE}"
|
||||
rmmod "${WIFI_MODULE}"
|
||||
usleep 250000
|
||||
modprobe -r sdio_wifi_pwr
|
||||
rmmod sdio_wifi_pwr
|
||||
fi
|
||||
|
||||
# Flush buffers to disk, who knows.
|
||||
@@ -32,7 +35,7 @@ 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 running FW 4.7.x
|
||||
# Last tested on an H2O running FW 4.7.x - 4.8.x
|
||||
/usr/local/Kobo/hindenburg &
|
||||
LIBC_FATAL_STDERR_=1 /usr/local/Kobo/nickel -platform kobo -skipFontLoad &
|
||||
|
||||
|
||||
Reference in New Issue
Block a user