Expand description
WiFi management for Kobo devices.
This module provides native WiFi lifecycle management, replacing the previous
shell script-based implementation at scripts/wifi-enable.sh and
scripts/wifi-disable.sh.
§Architecture
The implementation follows the same patterns as KOReader, with some key differences documented below.
§Power Toggle Strategies
Different Kobo devices use different mechanisms to power the WiFi chip:
Module: Insmodsdio_wifi_pwr.ko- most older devicesNtxIo: ioctl on/dev/ntx_iowith command 208 - devices withmoalmoduleWmt: WMT character device - devices withwlan_drv_gen4mmodule
§Module Path Resolution
The module path depends on the WiFi module type:
- Default:
/drivers/{PLATFORM}/wifi/ wlan_drv_gen4m:/drivers/{PLATFORM}/mt66xx/
§Why No DHCP Client?
This implementation does NOT run a DHCP client.
The rationale is:
- Nickel’s
dhcpcdpersists: When Cadmus starts, it does NOT kill Nickel’sdhcpcd -d -z wlan0daemon. This daemon continuously manages the DHCP lease and writes lease files to/var/db/on eMMC, which persists across reboots. - Lease stability: When reconnecting,
dhcpcdreads the matching lease file and requests the same IP (DHCP Option 50), avoiding the DHCP server handing out a different address. - Avoid
udhcpcpitfalls: The original shell script usedudhcpc -qwhich exits after obtaining a lease with no persistence mechanism, causing a new IP on every toggle. - wpa_supplicant handles 802.11 connectivity: Network configuration is
managed by the platform’s
dhcpcd.
§Features Copied from KOReader
The following improvements were adopted from KOReader’s implementation:
- No DHCP client: KOReader omits udhcpc when possible.
- Module loading: Uses
insmod_asneeded()helper that checks/proc/modulesbefore loading to avoid duplicate module loads - 250ms delay after insmod: Matches KOReader’s timing for module stabilization
- File descriptor cleanup: Not implemented (KOReader closes non-standard fds before WiFi operations to avoid issues with USBMS)
§Country Code Handling
Regulatory domain is read from /mnt/onboard/.kobo/Kobo/Kobo eReader.conf
under the WifiRegulatoryDomain key. The code parameter is passed to the
kernel module as:
8821cs:rtw_country_code=XXmoal:reg_alpha2=XX
§Moal-Specific Module Parameters
The moal module (NXP/Marvell 88W8987) additionally requires:
mod_para=nxp/wifi_mod_para_sd8987.conf- Loading
mlan.kodependency before the main module
Modules§
- types 🔒
- WiFi types for Kobo devices.
Structs§
Constants§
- CONFIG_
PATH 🔒 - DRIVERS_
DIR 🔒 - NTX_
IO_ 🔒PATH - NTX_
IO_ 🔒WIFI_ CTRL - WIFI_
POST_ 🔒DOWN_ SCRIPT - WIFI_
POST_ 🔒UP_ SCRIPT - WIFI_
PRE_ 🔒DOWN_ SCRIPT - WIFI_
PRE_ 🔒UP_ SCRIPT - WMT_
WIFI_ 🔒PATH - WPA_
SUPPLICANT_ 🔒CONF - WPA_
SUPPLICANT_ 🔒SOCKET
Functions§
- create_
wifi_ manager - Creates a WiFi manager for the current platform.
- is_
interface_ 🔒up - is_
module_ 🔒loaded - set_
ntx_ ⚠io_ wifi_ ctrl