From a91ba05e349a1f6fe9ae8e77bace6d86dcbf13b6 Mon Sep 17 00:00:00 2001 From: NiLuJe Date: Mon, 9 Aug 2021 20:56:00 +0200 Subject: [PATCH] Set the WiFi regulatory domain properly on the Elipsa No idea how restrictive the defaults are, but stuff is weird in the 5G band, so, do it right. --- platform/kobo/enable-wifi.sh | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/platform/kobo/enable-wifi.sh b/platform/kobo/enable-wifi.sh index 3dc807693..fb2391605 100755 --- a/platform/kobo/enable-wifi.sh +++ b/platform/kobo/enable-wifi.sh @@ -33,11 +33,23 @@ fi usleep 250000 # NOTE: Used to be exported in WIFI_MODULE_PATH before FW 4.23 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 + WIFI_COUNTRY_CODE="$(grep "^WifiRegulatoryDomain=" "/mnt/onboard/.kobo/Kobo/Kobo eReader.conf" | cut -d '=' -f2)" + + case "${WIFI_MODULE}" in + "8821cs") + WIFI_COUNTRY_CODE_PARM="rtw_country_code=${WIFI_COUNTRY_CODE}" + ;; + esac + fi + if [ -e "/drivers/${PLATFORM}/wifi/${WIFI_MODULE}.ko" ]; then - insmod "/drivers/${PLATFORM}/wifi/${WIFI_MODULE}.ko" + insmod "/drivers/${PLATFORM}/wifi/${WIFI_MODULE}.ko" "${WIFI_COUNTRY_CODE_PARM}" elif [ -e "/drivers/${PLATFORM}/${WIFI_MODULE}.ko" ]; then # NOTE: Modules are unsorted on Mk. 8 - insmod "/drivers/${PLATFORM}/${WIFI_MODULE}.ko" + insmod "/drivers/${PLATFORM}/${WIFI_MODULE}.ko" "${WIFI_COUNTRY_CODE_PARM}" fi fi # Race-y as hell, don't try to optimize this!