mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
Fix Wi-Fi toggle on the Elipsa
It turns out that the kernel needs a little push now that the dedicated wifi power control module is gone ;). Issue was only exposed if you booted KOReader while the Wi-Fi was down.
This commit is contained in:
18
frontend/device/kobo/ntx_io.lua
Normal file
18
frontend/device/kobo/ntx_io.lua
Normal file
@@ -0,0 +1,18 @@
|
||||
-- Stupid wrapper so that we can send simple ntx_io ioctls from shell scripts...
|
||||
|
||||
local ffi = require("ffi")
|
||||
local bor = bit.bor
|
||||
local C = ffi.C
|
||||
|
||||
require("ffi/posix_h")
|
||||
|
||||
assert(#arg == 2, "must pass an ioctl command & an ioctl argument")
|
||||
local ioc_cmd = tonumber(arg[1])
|
||||
local ioc_arg = tonumber(arg[2])
|
||||
|
||||
local fd = C.open("/dev/ntx_io", bor(C.O_RDONLY, C.O_NONBLOCK, C.O_CLOEXEC))
|
||||
assert(fd ~= -1, "cannot open ntx_io character device")
|
||||
|
||||
assert(C.ioctl(fd, ioc_cmd, ffi.cast("int", ioc_arg)) == 0, "ioctl failed")
|
||||
|
||||
C.close(fd)
|
||||
@@ -58,3 +58,9 @@ if grep -q "sdio_wifi_pwr" "/proc/modules"; then
|
||||
usleep 250000
|
||||
rmmod sdio_wifi_pwr
|
||||
fi
|
||||
|
||||
# Poke the kernel via ioctl on platforms without the dedicated power module...
|
||||
if [ ! -e "/drivers/${PLATFORM}/wifi/sdio_wifi_pwr.ko" ]; then
|
||||
usleep 250000
|
||||
./luajit frontend/device/kobo/ntx_io.lua 208 0
|
||||
fi
|
||||
|
||||
@@ -23,6 +23,10 @@ if ! grep -q "sdio_wifi_pwr" "/proc/modules"; then
|
||||
fi
|
||||
|
||||
insmod "/drivers/${PLATFORM}/wifi/sdio_wifi_pwr.ko"
|
||||
else
|
||||
# Poke the kernel via ioctl on platforms without the dedicated power module...
|
||||
# 208 is CM_WIFI_CTRL
|
||||
./luajit frontend/device/kobo/ntx_io.lua 208 1
|
||||
fi
|
||||
fi
|
||||
# Moar sleep!
|
||||
|
||||
@@ -13,7 +13,7 @@ export QT_GSTREAMER_PLAYBIN_AUDIOSINK=alsasink
|
||||
cd /
|
||||
unset OLDPWD
|
||||
unset LC_ALL TESSDATA_PREFIX STARDICT_DATA_DIR EXT_FONT_DIR
|
||||
unset KOREADER_DIR KO_DONT_GRAB_INPUT
|
||||
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.
|
||||
@@ -75,8 +75,15 @@ if grep -q "${WIFI_MODULE}" "/proc/modules"; then
|
||||
usleep 250000
|
||||
rmmod sdio_wifi_pwr
|
||||
fi
|
||||
|
||||
# Poke the kernel via ioctl on platforms without the dedicated power module...
|
||||
if [ ! -e "/drivers/${PLATFORM}/wifi/sdio_wifi_pwr.ko" ]; then
|
||||
usleep 250000
|
||||
"${KOREADER_DIR}"/luajit "${KOREADER_DIR}"/frontend/device/kobo/ntx_io.lua 208 0
|
||||
fi
|
||||
fi
|
||||
|
||||
unset KOREADER_DIR
|
||||
unset CPUFREQ_DVFS CPUFREQ_CONSERVATIVE
|
||||
|
||||
# Recreate Nickel's FIFO ourselves, like rcS does, because udev *will* write to it!
|
||||
|
||||
Reference in New Issue
Block a user