mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
Kobo: Initial Elipsa 2E support (#10719)
Untested, but mostly everything should be there ;p. Bumps base for MTK support (https://github.com/koreader/koreader-base/pull/1642)
This commit is contained in:
2
base
2
base
Submodule base updated: ae48a62a0b...e539f080e5
@@ -127,8 +127,10 @@ local Kobo = Generic:extend{
|
||||
isMk7 = no,
|
||||
-- MXCFB_WAIT_FOR_UPDATE_COMPLETE ioctls are generally reliable
|
||||
hasReliableMxcWaitFor = yes,
|
||||
-- Sunxi devices require a completely different fb backend...
|
||||
-- AllWinner SoCs require a completely different fb backend...
|
||||
isSunxi = no,
|
||||
-- The fb backend also needs to know if we're on a MediaTek SoC.
|
||||
isMTK = no,
|
||||
-- On sunxi, "native" panel layout used to compute the G2D rotation handle (e.g., deviceQuirks.nxtBootRota in FBInk).
|
||||
boot_rota = nil,
|
||||
-- Standard sysfs path to the battery directory
|
||||
@@ -498,6 +500,32 @@ local KoboGoldfinch = Kobo:extend{
|
||||
hasReliableMxcWaitFor = no,
|
||||
}
|
||||
|
||||
-- Kobo Elipsa 2E:
|
||||
local KoboCondor = Kobo:extend{
|
||||
model = "Kobo_condor",
|
||||
isMTK = yes,
|
||||
hasEclipseWfm = yes,
|
||||
canToggleChargingLED = yes,
|
||||
hasFrontlight = yes,
|
||||
hasGSensor = yes,
|
||||
display_dpi = 227,
|
||||
pressure_event = C.ABS_MT_PRESSURE,
|
||||
touch_mirrored_x = false,
|
||||
hasNaturalLight = yes,
|
||||
frontlight_settings = {
|
||||
frontlight_white = "/sys/class/backlight/mxc_msp430.0/brightness",
|
||||
frontlight_mixer = "/sys/class/leds/aw99703-bl_FL1/color",
|
||||
nl_min = 0,
|
||||
nl_max = 10,
|
||||
nl_inverted = true,
|
||||
},
|
||||
battery_sysfs = "/sys/class/power_supply/bd71827_bat",
|
||||
touch_dev = "/dev/input/by-path/platform-2-0010-event",
|
||||
ntx_dev = "/dev/input/by-path/platform-ntx_event0-event",
|
||||
power_dev = "/dev/input/by-path/platform-bd71828-pwrkey.6.auto-event",
|
||||
isSMP = yes,
|
||||
}
|
||||
|
||||
function Kobo:setupChargingLED()
|
||||
if G_reader_settings:nilOrTrue("enable_charging_led") then
|
||||
if self:hasAuxBattery() and self.powerd:isAuxBatteryConnected() then
|
||||
@@ -575,6 +603,24 @@ function Kobo:init()
|
||||
end
|
||||
end
|
||||
|
||||
-- So far, MTK kernels do not export a per-request inversion flag
|
||||
if self:isMTK() then
|
||||
-- Instead, there's a global flag that we can *set* (but not *get*) via a procfs knob...
|
||||
-- Overload the HWNightMode stuff to implement that properly, like we do on Kindle
|
||||
function self.screen:setHWNightmode(toggle)
|
||||
-- No getter, so, keep track of our own state
|
||||
self.hw_night_mode = toggle
|
||||
-- Flip the global invert_fb flag
|
||||
util.writeToSysfs(toggle and "night_mode 4" or "night_mode 0", "/proc/hwtcon/cmd")
|
||||
end
|
||||
|
||||
function self.screen:getHWNightmode()
|
||||
-- Return false on nil for reader.lua's sake, mostly.
|
||||
-- (We want to disable this on exit, always, as it will never be used by Nickel, which does SW inversion).
|
||||
return self.hw_night_mode == true
|
||||
end
|
||||
end
|
||||
|
||||
-- Automagic sysfs discovery
|
||||
if self.automagic_sysfs then
|
||||
-- Battery
|
||||
@@ -600,7 +646,10 @@ function Kobo:init()
|
||||
end
|
||||
|
||||
-- Touch panel input
|
||||
if util.fileExists("/dev/input/by-path/platform-1-0010-event") then
|
||||
if util.fileExists("/dev/input/by-path/platform-2-0010-event") then
|
||||
-- Elan (HWConfig TouchCtrl is ekth6) on i2c bus 2
|
||||
self.touch_dev = "/dev/input/by-path/platform-2-0010-event"
|
||||
elseif util.fileExists("/dev/input/by-path/platform-1-0010-event") then
|
||||
-- Elan (HWConfig TouchCtrl is ekth6) on i2c bus 1
|
||||
self.touch_dev = "/dev/input/by-path/platform-1-0010-event"
|
||||
elseif util.fileExists("/dev/input/by-path/platform-0-0010-event") then
|
||||
@@ -615,7 +664,7 @@ function Kobo:init()
|
||||
-- Libra 2 w/ a BD71828 PMIC
|
||||
self.ntx_dev = "/dev/input/by-path/platform-gpio-keys-event"
|
||||
elseif util.fileExists("/dev/input/by-path/platform-ntx_event0-event") then
|
||||
-- sunxi & Mk. 7
|
||||
-- MTK, sunxi & Mk. 7
|
||||
self.ntx_dev = "/dev/input/by-path/platform-ntx_event0-event"
|
||||
elseif util.fileExists("/dev/input/by-path/platform-mxckpd-event") then
|
||||
-- circa Mk. 5 i.MX
|
||||
@@ -753,7 +802,10 @@ function Kobo:init()
|
||||
end
|
||||
|
||||
-- Detect the NTX charging LED sysfs knob
|
||||
if util.pathExists("/sys/devices/platform/ntx_led/lit") then
|
||||
if util.pathExists("/sys/class/leds/bd71828-green-led") then
|
||||
-- Standard Linux LED class, wheee!
|
||||
self.charging_led_sysfs_knob = "/sys/class/leds/bd71828-green-led"
|
||||
elseif util.pathExists("/sys/devices/platform/ntx_led/lit") then
|
||||
self.ntx_lit_sysfs_knob = "/sys/devices/platform/ntx_led/lit"
|
||||
elseif util.pathExists("/sys/devices/platform/pmic_light.1/lit") then
|
||||
self.ntx_lit_sysfs_knob = "/sys/devices/platform/pmic_light.1/lit"
|
||||
@@ -761,6 +813,13 @@ function Kobo:init()
|
||||
self.canToggleChargingLED = no
|
||||
end
|
||||
|
||||
-- Switch to the simple standard implementation if available
|
||||
if self.charging_led_sysfs_knob then
|
||||
self.charging_led_imp = self._LinuxChargingLEDToggle
|
||||
else
|
||||
self.charging_led_imp = self._NTXChargingLEDToggle
|
||||
end
|
||||
|
||||
-- NOP unsupported methods
|
||||
if not self:canToggleChargingLED() then
|
||||
self.toggleChargingLED = NOP
|
||||
@@ -776,7 +835,7 @@ function Kobo:init()
|
||||
self:enableCPUCores(1)
|
||||
|
||||
self.canStandby = checkStandby()
|
||||
if self.canStandby() and (self:isMk7() or self:isSunxi()) then
|
||||
if self.canStandby() and (self:isMk7() or self:isSunxi() or self:isMTK()) then
|
||||
self.canPowerSaveWhileCharging = yes
|
||||
end
|
||||
|
||||
@@ -1264,7 +1323,8 @@ function Kobo:powerOff()
|
||||
-- Much like Nickel itself, disable the RTC alarm before powering down.
|
||||
self.wakeup_mgr:unsetWakeupAlarm()
|
||||
|
||||
if self:isSunxi() then
|
||||
--- @todo: Check on MTK
|
||||
if self:isSunxi() or self:isMTK() then
|
||||
-- On sunxi, apparently, we *do* go through init
|
||||
os.execute("sleep 1 && poweroff &")
|
||||
else
|
||||
@@ -1277,23 +1337,7 @@ function Kobo:reboot()
|
||||
os.execute("sleep 1 && reboot &")
|
||||
end
|
||||
|
||||
function Kobo:toggleChargingLED(toggle)
|
||||
-- We have no way of querying the current state from the HW!
|
||||
if toggle == nil then
|
||||
return
|
||||
end
|
||||
-- Don't do anything if the state is already correct
|
||||
-- NOTE: What happens to the LED when attempting/successfully entering PM is... kind of a mess.
|
||||
-- On a H2O, even *attempting* to enter PM will kill the light (and it'll stay off).
|
||||
-- On a Forma, a failed attempt will *not* affect the light, but a successful one *will* kill it,
|
||||
-- be that standby or suspend, but it'll be restored on wakeup...
|
||||
-- On sunxi, PM appears to have zero effect on the LED.
|
||||
if self.charging_led_state == toggle then
|
||||
return
|
||||
end
|
||||
self.charging_led_state = toggle
|
||||
logger.dbg("Kobo: Turning the charging LED", toggle and "on" or "off")
|
||||
|
||||
function Kobo:_NTXChargingLEDToggle(toggle)
|
||||
-- NOTE: While most/all Kobos actually have a charging LED, and it can usually be fiddled with in a similar fashion,
|
||||
-- we've seen *extremely* weird behavior in the past when playing with it on older devices (c.f., #5479).
|
||||
-- In fact, Nickel itself doesn't provide this feature on said older devices
|
||||
@@ -1328,6 +1372,30 @@ function Kobo:toggleChargingLED(toggle)
|
||||
C.close(fd)
|
||||
end
|
||||
|
||||
function Kobo:_LinuxChargingLEDToggle(toggle)
|
||||
util.writeToSysfs(toggle and "1" or "0", self.charging_led_sysfs_knob)
|
||||
end
|
||||
|
||||
function Kobo:toggleChargingLED(toggle)
|
||||
-- We have no way of querying the current state from the HW!
|
||||
if toggle == nil then
|
||||
return
|
||||
end
|
||||
-- Don't do anything if the state is already correct
|
||||
-- NOTE: What happens to the LED when attempting/successfully entering PM is... kind of a mess.
|
||||
-- On a H2O, even *attempting* to enter PM will kill the light (and it'll stay off).
|
||||
-- On a Forma, a failed attempt will *not* affect the light, but a successful one *will* kill it,
|
||||
-- be that standby or suspend, but it'll be restored on wakeup...
|
||||
-- On sunxi, PM appears to have zero effect on the LED.
|
||||
if self.charging_led_state == toggle then
|
||||
return
|
||||
end
|
||||
self.charging_led_state = toggle
|
||||
logger.dbg("Kobo: Turning the charging LED", toggle and "on" or "off")
|
||||
|
||||
return self:charging_led_imp(toggle)
|
||||
end
|
||||
|
||||
-- Return the highest core number
|
||||
function Kobo:getCPUCount()
|
||||
local fd = io.open("/sys/devices/system/cpu/possible", "re")
|
||||
@@ -1535,6 +1603,8 @@ elseif codename == "io" then
|
||||
return KoboIo
|
||||
elseif codename == "goldfinch" then
|
||||
return KoboGoldfinch
|
||||
elseif codename == "condor" then
|
||||
return KoboCondor
|
||||
else
|
||||
error("unrecognized Kobo model ".. codename .. " with device id " .. product_id)
|
||||
end
|
||||
|
||||
@@ -38,51 +38,71 @@ wpa_cli -i "${INTERFACE}" terminate
|
||||
[ "${WIFI_MODULE}" = "dhd" ] && 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 grep -q "^${WIFI_MODULE}" "/proc/modules"; then
|
||||
usleep 250000
|
||||
rmmod "${WIFI_MODULE}"
|
||||
fi
|
||||
|
||||
# Handle dependencies, if any
|
||||
WIFI_DEP_MOD=""
|
||||
SKIP_SDIO_PWR_MODULE=""
|
||||
# Honor the platform's preferred method to toggle power
|
||||
POWER_TOGGLE="module"
|
||||
# Some platforms never unload the wifi modules
|
||||
SKIP_UNLOAD=""
|
||||
case "${WIFI_MODULE}" in
|
||||
"moal")
|
||||
WIFI_DEP_MOD="mlan"
|
||||
SKIP_SDIO_PWR_MODULE="1"
|
||||
POWER_TOGGLE="ntx_io"
|
||||
;;
|
||||
"wlan_drv_gen4m")
|
||||
POWER_TOGGLE="wmt"
|
||||
SKIP_UNLOAD="true"
|
||||
;;
|
||||
esac
|
||||
if [ -n "${WIFI_DEP_MOD}" ]; then
|
||||
if grep -q "^${WIFI_DEP_MOD}" "/proc/modules"; then
|
||||
|
||||
if [ -z "${SKIP_UNLOAD}" ]; then
|
||||
# Some sleep in between may avoid system getting hung
|
||||
# (we test if a module is actually loaded to avoid unneeded sleeps)
|
||||
if grep -q "^${WIFI_MODULE} " "/proc/modules"; then
|
||||
usleep 250000
|
||||
rmmod "${WIFI_DEP_MOD}"
|
||||
# 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?
|
||||
rmmod "${WIFI_MODULE}"
|
||||
fi
|
||||
|
||||
if [ -n "${WIFI_DEP_MOD}" ]; then
|
||||
if grep -q "^${WIFI_DEP_MOD} " "/proc/modules"; then
|
||||
usleep 250000
|
||||
rmmod "${WIFI_DEP_MOD}"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -n "${SKIP_SDIO_PWR_MODULE}" ]; then
|
||||
usleep 250000
|
||||
./luajit frontend/device/kobo/ntx_io.lua 208 0
|
||||
else
|
||||
if grep -q "^sdio_wifi_pwr" "/proc/modules"; then
|
||||
# Handle the shitty DVFS switcheroo...
|
||||
if [ -n "${CPUFREQ_DVFS}" ]; then
|
||||
echo "0" >"/sys/devices/platform/mxc_dvfs_core.0/enable"
|
||||
if [ -n "${CPUFREQ_CONSERVATIVE}" ]; then
|
||||
echo "conservative" >"/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor"
|
||||
else
|
||||
echo "userspace" >"/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor"
|
||||
cat "/sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq" >"/sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed"
|
||||
fi
|
||||
fi
|
||||
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
|
||||
case "${POWER_TOGGLE}" in
|
||||
"ntx_io")
|
||||
usleep 250000
|
||||
./luajit frontend/device/kobo/ntx_io.lua 208 0
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
"wmt")
|
||||
echo 0 >/dev/wmtWifi
|
||||
;;
|
||||
*)
|
||||
if grep -q "^sdio_wifi_pwr " "/proc/modules"; then
|
||||
# Handle the shitty DVFS switcheroo...
|
||||
if [ -n "${CPUFREQ_DVFS}" ]; then
|
||||
echo "0" >"/sys/devices/platform/mxc_dvfs_core.0/enable"
|
||||
if [ -n "${CPUFREQ_CONSERVATIVE}" ]; then
|
||||
echo "conservative" >"/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor"
|
||||
else
|
||||
echo "userspace" >"/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor"
|
||||
cat "/sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq" >"/sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed"
|
||||
fi
|
||||
fi
|
||||
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
|
||||
;;
|
||||
esac
|
||||
|
||||
@@ -14,43 +14,84 @@ for fd in /proc/"$$"/fd/*; do
|
||||
done
|
||||
|
||||
# Some platforms do *NOT* use sdio_wifi_pwr, even when it is physically there...
|
||||
SKIP_SDIO_PWR_MODULE=""
|
||||
POWER_TOGGLE="module"
|
||||
# We also want to choose the wpa_supplicant driver depending on the module...
|
||||
WPA_SUPPLICANT_DRIVER="wext"
|
||||
# And some platforms also put the modules in some funkier paths...
|
||||
KMOD_PATH="/drivers/${PLATFORM}/wifi"
|
||||
case "${WIFI_MODULE}" in
|
||||
"moal")
|
||||
SKIP_SDIO_PWR_MODULE="1"
|
||||
POWER_TOGGLE="ntx_io"
|
||||
WPA_SUPPLICANT_DRIVER="nl80211"
|
||||
;;
|
||||
"wlan_drv_gen4m")
|
||||
POWER_TOGGLE="wmt"
|
||||
WPA_SUPPLICANT_DRIVER="nl80211"
|
||||
KMOD_PATH="/drivers/${PLATFORM}/mt66xx"
|
||||
;;
|
||||
esac
|
||||
|
||||
# Power up WiFi chip
|
||||
if [ -n "${SKIP_SDIO_PWR_MODULE}" ]; then
|
||||
# 208 is CM_WIFI_CTRL
|
||||
./luajit frontend/device/kobo/ntx_io.lua 208 1
|
||||
else
|
||||
if ! grep -q "^sdio_wifi_pwr" "/proc/modules"; then
|
||||
if [ -e "/drivers/${PLATFORM}/wifi/sdio_wifi_pwr.ko" ]; then
|
||||
# Handle the shitty DVFS switcheroo...
|
||||
if [ -n "${CPUFREQ_DVFS}" ]; then
|
||||
echo "userspace" >"/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor"
|
||||
echo "1" >"/sys/devices/platform/mxc_dvfs_core.0/enable"
|
||||
fi
|
||||
# Load the requested module if it isn't already
|
||||
insmod_asneeded() {
|
||||
kmod="${1}"
|
||||
shift
|
||||
|
||||
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
|
||||
if ! grep -q "^${kmod} " "/proc/modules"; then
|
||||
insmod "${KMOD_PATH}/${kmod}.ko" "${@}"
|
||||
usleep 250000
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Power up WiFi chip
|
||||
case "${POWER_TOGGLE}" in
|
||||
"ntx_io")
|
||||
# 208 is CM_WIFI_CTRL
|
||||
./luajit frontend/device/kobo/ntx_io.lua 208 1
|
||||
;;
|
||||
"wmt")
|
||||
# NOTE: Unlike earlier platforms, it seems the WiFi modules are only loaded once, and never unloaded.
|
||||
# So, just make sure they actually are loaded before we go on...
|
||||
insmod_asneeded "wmt_drv"
|
||||
insmod_asneeded "wmt_chrdev_wifi"
|
||||
insmod_asneeded "wmt_cdev_bt"
|
||||
insmod_asneeded "${WIFI_MODULE}"
|
||||
|
||||
# Black magic courtesy of wmt_dbg_func_ctrl @ (out of tree) modules/connectivity/wmt_mt66xx/common_main/linux/wmt_dbg.c
|
||||
# Enable debug commands
|
||||
echo "0xDB9DB9" >/proc/driver/wmt_dbg
|
||||
# Disable the LPBK test
|
||||
echo "7 9 0" >/proc/driver/wmt_dbg
|
||||
# Nickel appears to sleep for ~1s
|
||||
sleep 1
|
||||
echo "0xDB9DB9" >/proc/driver/wmt_dbg
|
||||
# Enable the LPBK test (this'll block for ~1.3s)
|
||||
echo "7 9 1" >/proc/driver/wmt_dbg
|
||||
# Finally, power on the chip
|
||||
echo 1 >/dev/wmtWifi
|
||||
;;
|
||||
*)
|
||||
if ! grep -q "^sdio_wifi_pwr " "/proc/modules"; then
|
||||
if [ -e "${KMOD_PATH}/sdio_wifi_pwr.ko" ]; then
|
||||
# Handle the shitty DVFS switcheroo...
|
||||
if [ -n "${CPUFREQ_DVFS}" ]; then
|
||||
echo "userspace" >"/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor"
|
||||
echo "1" >"/sys/devices/platform/mxc_dvfs_core.0/enable"
|
||||
fi
|
||||
|
||||
insmod "${KMOD_PATH}/sdio_wifi_pwr.ko"
|
||||
else
|
||||
# Poke the kernel via ioctl on platforms without the dedicated power module...
|
||||
./luajit frontend/device/kobo/ntx_io.lua 208 1
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
# Moar sleep!
|
||||
usleep 250000
|
||||
|
||||
# Load WiFi modules
|
||||
# NOTE: Used to be exported in WIFI_MODULE_PATH before FW 4.23
|
||||
if ! grep -q "^${WIFI_MODULE}" "/proc/modules"; then
|
||||
if ! grep -q "^${WIFI_MODULE} " "/proc/modules"; then
|
||||
# Set the Wi-Fi regulatory domain properly if necessary...
|
||||
WIFI_COUNTRY_CODE_PARM=""
|
||||
if grep -q "^WifiRegulatoryDomain=" "/mnt/onboard/.kobo/Kobo/Kobo eReader.conf"; then
|
||||
@@ -74,15 +115,14 @@ if ! grep -q "^${WIFI_MODULE}" "/proc/modules"; then
|
||||
|
||||
# And, of course, it requires a submodule...
|
||||
WIFI_DEP_MOD="mlan"
|
||||
if [ -e "/drivers/${PLATFORM}/wifi/${WIFI_DEP_MOD}.ko" ]; then
|
||||
insmod "/drivers/${PLATFORM}/wifi/${WIFI_DEP_MOD}.ko"
|
||||
elif [ -e "/drivers/${PLATFORM}/${WIFI_DEP_MOD}.ko" ]; then
|
||||
insmod "/drivers/${PLATFORM}/${WIFI_DEP_MOD}.ko"
|
||||
fi
|
||||
insmod "${KMOD_PATH}/${WIFI_DEP_MOD}.ko"
|
||||
# NOTE: Nickel sleeps for two whole seconds after each module loading.
|
||||
# Let's try our usual timing instead...
|
||||
usleep 250000
|
||||
;;
|
||||
"wlan_drv_gen4m")
|
||||
# Nothing to do here, we only load the modules once, so we should never enter this branch.
|
||||
;;
|
||||
esac
|
||||
|
||||
WIFI_PARM=""
|
||||
@@ -101,12 +141,12 @@ if ! grep -q "^${WIFI_MODULE}" "/proc/modules"; then
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -e "/drivers/${PLATFORM}/wifi/${WIFI_MODULE}.ko" ]; then
|
||||
if [ -e "${KMOD_PATH}/${WIFI_MODULE}.ko" ]; then
|
||||
if [ -n "${WIFI_PARM}" ]; then
|
||||
# shellcheck disable=SC2086
|
||||
insmod "/drivers/${PLATFORM}/wifi/${WIFI_MODULE}.ko" ${WIFI_PARM}
|
||||
insmod "${KMOD_PATH}/${WIFI_MODULE}.ko" ${WIFI_PARM}
|
||||
else
|
||||
insmod "/drivers/${PLATFORM}/wifi/${WIFI_MODULE}.ko"
|
||||
insmod "${KMOD_PATH}/${WIFI_MODULE}.ko"
|
||||
fi
|
||||
elif [ -e "/drivers/${PLATFORM}/${WIFI_MODULE}.ko" ]; then
|
||||
# NOTE: Modules are unsorted on Mk. 8
|
||||
|
||||
@@ -64,7 +64,7 @@ if [ "${current_cpufreq_gov}" != "interactive" ]; then
|
||||
# but the code in the published H2O kernel sources actually does the reverse, and is commented out ;).
|
||||
# It is now entirely handled by Nickel, right *before* loading/unloading that module.
|
||||
# (There's also a bug(?) where that behavior is inverted for the *first* Wi-Fi session after a cold boot...)
|
||||
if grep -q "^sdio_wifi_pwr" "/proc/modules"; then
|
||||
if grep -q "^sdio_wifi_pwr " "/proc/modules"; then
|
||||
# Wi-Fi is enabled, make sure DVFS is on
|
||||
echo "userspace" >"${CPUFREQ_SYSFS_PATH}/scaling_governor"
|
||||
echo "1" >"/sys/devices/platform/mxc_dvfs_core.0/enable"
|
||||
@@ -197,7 +197,7 @@ if [ "${VIA_NICKEL}" = "true" ]; then
|
||||
./luajit frontend/device/kobo/ntx_io.lua 126 0
|
||||
fi
|
||||
fi
|
||||
if grep -q "^sdio_bt_pwr" "/proc/modules"; then
|
||||
if grep -q "^sdio_bt_pwr " "/proc/modules"; then
|
||||
# And that's on NXP SoCs
|
||||
rmmod sdio_bt_pwr
|
||||
fi
|
||||
|
||||
@@ -26,22 +26,21 @@ unset FBINK_FORCE_ROTA
|
||||
) &
|
||||
|
||||
# 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
|
||||
if grep -q "^${WIFI_MODULE} " "/proc/modules"; then
|
||||
killall -q -TERM restore-wifi-async.sh enable-wifi.sh obtain-ip.sh
|
||||
|
||||
cp -a "/etc/resolv.conf" "/tmp/resolv.ko"
|
||||
old_hash="$(md5sum "/etc/resolv.conf" | cut -f1 -d' ')"
|
||||
|
||||
if [ -x "/sbin/dhcpcd" ]; then
|
||||
dhcpcd -d -k "${INTERFACE}"
|
||||
killall -q -TERM udhcpc default.script
|
||||
else
|
||||
killall -q -TERM udhcpc default.script dhcpcd
|
||||
fi
|
||||
# NOTE: dhcpcd -k waits for the signalled process to die, but busybox's killall doesn't have a -w, --wait flag,
|
||||
# so we have to wait for udhcpc to die ourselves...
|
||||
# NOTE: But if all is well, there *isn't* any udhcpc process or script left to begin with...
|
||||
|
||||
kill_timeout=0
|
||||
while pkill -0 udhcpc; do
|
||||
# Stop waiting after 5s
|
||||
if [ ${kill_timeout} -ge 20 ]; then
|
||||
break
|
||||
fi
|
||||
@@ -56,52 +55,64 @@ if grep -q "^${WIFI_MODULE}" "/proc/modules"; then
|
||||
else
|
||||
rm -f "/tmp/resolv.ko"
|
||||
fi
|
||||
wpa_cli terminate
|
||||
|
||||
wpa_cli -i "${INTERFACE}" terminate
|
||||
|
||||
[ "${WIFI_MODULE}" = "dhd" ] && 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...
|
||||
# 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
|
||||
rmmod "${WIFI_MODULE}"
|
||||
|
||||
WIFI_DEP_MOD=""
|
||||
SKIP_SDIO_PWR_MODULE=""
|
||||
POWER_TOGGLE="module"
|
||||
SKIP_UNLOAD=""
|
||||
case "${WIFI_MODULE}" in
|
||||
"moal")
|
||||
WIFI_DEP_MOD="mlan"
|
||||
SKIP_SDIO_PWR_MODULE="1"
|
||||
POWER_TOGGLE="ntx_io"
|
||||
;;
|
||||
"wlan_drv_gen4m")
|
||||
POWER_TOGGLE="wmt"
|
||||
SKIP_UNLOAD="true"
|
||||
;;
|
||||
esac
|
||||
if [ -n "${WIFI_DEP_MOD}" ]; then
|
||||
if grep -q "^${WIFI_DEP_MOD}" "/proc/modules"; then
|
||||
usleep 250000
|
||||
rmmod "${WIFI_DEP_MOD}"
|
||||
|
||||
if [ -z "${SKIP_UNLOAD}" ]; then
|
||||
usleep 250000
|
||||
rmmod "${WIFI_MODULE}"
|
||||
|
||||
if [ -n "${WIFI_DEP_MOD}" ]; then
|
||||
if grep -q "^${WIFI_DEP_MOD} " "/proc/modules"; then
|
||||
usleep 250000
|
||||
rmmod "${WIFI_DEP_MOD}"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -n "${SKIP_SDIO_PWR_MODULE}" ]; then
|
||||
usleep 250000
|
||||
"${KOREADER_DIR}"/luajit "${KOREADER_DIR}"/frontend/device/kobo/ntx_io.lua 208 0
|
||||
else
|
||||
if grep -q "^sdio_wifi_pwr" "/proc/modules"; then
|
||||
if [ -n "${CPUFREQ_DVFS}" ]; then
|
||||
echo "0" >"/sys/devices/platform/mxc_dvfs_core.0/enable"
|
||||
# Leave Nickel in its usual state, don't try to use conservative
|
||||
echo "userspace" >"/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor"
|
||||
cat "/sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq" >"/sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed"
|
||||
fi
|
||||
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
|
||||
case "${POWER_TOGGLE}" in
|
||||
"ntx_io")
|
||||
usleep 250000
|
||||
"${KOREADER_DIR}"/luajit "${KOREADER_DIR}"/frontend/device/kobo/ntx_io.lua 208 0
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
"wmt")
|
||||
echo 0 >/dev/wmtWifi
|
||||
;;
|
||||
*)
|
||||
if grep -q "^sdio_wifi_pwr " "/proc/modules"; then
|
||||
if [ -n "${CPUFREQ_DVFS}" ]; then
|
||||
echo "0" >"/sys/devices/platform/mxc_dvfs_core.0/enable"
|
||||
# Leave Nickel in its usual state, don't try to use conservative
|
||||
echo "userspace" >"/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor"
|
||||
cat "/sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq" >"/sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed"
|
||||
fi
|
||||
usleep 250000
|
||||
rmmod sdio_wifi_pwr
|
||||
fi
|
||||
|
||||
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
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
unset KOREADER_DIR
|
||||
|
||||
Reference in New Issue
Block a user