Repository navigation
Rename to WiFi Config Tuner (v7.0.0) + maintenance audit
v7.0.0 — Rename & Maintenance Audit
Renamed
- Project renamed: WiFi Config Switcher → WiFi Config Tuner. Module
idchanged fromwifi_config_switchertowifi_config_tuner(module.prop), which also updates the on-disk install path (/data/adb/modules/<id>/) and the WebUI's hardcodedactionScriptpath in lockstep — both were updated together since a mismatch here silently breaks every WebUI action. Display name, install banner, About page, and GitHub source links updated to match. The new name also resolves a naming inconsistency that predated this release: the WebUI<title>already said "Wi-Fi Config Tuner" whilemodule.propsaid "WiFi Config Switcher" — everything now agrees. - Breaking for existing installs: because the module id changed, flashing this version installs alongside any existing "WiFi Config Switcher" install rather than replacing it in place. See the README's "Upgrading" section — the old module must be removed manually via KernelSU Manager. Saved profile state in
/data/adb/wcs/is unaffected and carries over automatically. update.jsonandmodule.prop'supdateJsonnow point at the renamedWiFi-Config-Tunerrepository.
Reliability & Portability
- Removed non-POSIX
localkeyword (17 uses acrossdetect_driver_type,get_driver_name,find_wifi_config,find_patch_dir,apply_patch).localis a bash/toybox/mksh extension, not POSIXsh— on ROMs whose/system/bin/shdoesn't support it, these variables would silently become global instead of raising an error, a dangerous failure mode. Replaced with per-function variable-name prefixes so correctness no longer depends on shell-specific behaviour. - Fix:
apply_patchused a fixed/tmp/wcs_patch_countpath for passing the applied-key count out of anawksubprocess — a race risk ifapply_modewere ever triggered twice concurrently (e.g. a double-tap on the WebUI profile button before it disables itself). Now usesmktempunder the module's own state directory, with the temp file cleaned up immediately after use. - Removed dead code: the non-JSON
get_debug_infoaction (~90 lines). The WebUI has only ever calledget_debug_info_json; the plain-text twin was unreferenced and had already drifted slightly out of sync with it. - Removed dead code: legacy pre-v5.0.4 config-overlay path fallback in
find_wifi_config().MODDIRis wiped on every flash (seeservice.sh), so a module update always re-runscustomize.shfresh — there was no upgrade path left that could still hit this branch.
Internal Cleanup
- Externalized the SoC-ID → Wi-Fi-chip-name table (~90 lines of hardcoded
casestatements) into a newchip_map.tsvdata file, looked up viaawk. Contributing a new SoC ID is now a one-line data edit instead of a shell patch. The SDM665/SD732G (SoC 394) disambiguation and the WCSS-address fallback stay inbackend.shsince they need logic beyond a flat lookup. - Deduplicated the device-alias map (
sunny→mojito,sweet_k/sweetin→sweet,willow→ginkgo) out ofcustomize.shandbackend.shinto a single shareddevice_aliases.txt, read by bothcustomize.sh(install time) and a newresolve_device_alias()helper inbackend.sh(runtime sideload fallback). Previously the same map had to be updated by hand in two places. - Promoted the inline
_esc()JSON-escaping helper out ofget_driver_infointo the top-level Helpers section, next tolog_json(). detect_driver_type()is now a thin memoizing wrapper around the original detection logic (renamed_detect_driver_type_impl), guarding against any future code path calling it twice within the same action (it re-runs azcat /proc/config.gzdecompression each time). Does not cache across separate WebUI actions — each is its own fresh process.
WebUI Fixes
- Fix:
parseJson()used naiveindexOf('{')/lastIndexOf('}')brace matching, which would silently grab the wrong substring if any JSON string value ever legitimately contained a literal{or}(e.g. an unescaped device-tree compatible string). Replaced with a proper depth-tracking scanner that respects quoted strings and escape sequences, so it finds the actual end of the intended object. - Google Fonts stylesheet now loads asynchronously (
media="print"swapped toallon load, with a<noscript>fallback) instead of render-blocking. This is a Wi-Fi tuning tool — plausibly opened while the device's own connectivity is down or misconfigured — so first paint no longer waits on a network request that may never succeed. The existingmonospace/sans-seriffallbacks in--mono/--headmean the UI stays fully legible either way.
Bug Fixes
-
Fix (critical):
apply_patchcorrupts values containing&or|— the old implementation usedsed -i "s|...|${key}=${value}|"directly. Any value containing&expanded to the matched text in sed's replacement, silently writing wrong data. A|in the value broke thes|...|delimiter entirely. Current patch files only use integers so this was latent, but would have triggered the moment a patch added a string-typed value. Rewritten withawk— keys and values are passed as awk variables, never interpolated into a regex or replacement pattern. -
Fix (critical):
apply_patchinserts literal\non Android (toyboxsedbug) — when a key was new and the config contained anENDmarker, the old code usedsed -i "s|^END|${key}=${value}\nEND|". Android's toyboxseddoes not support\nin replacements; it writes the two characters\nliterally instead of a newline, producing a malformed config line. Theawkrewrite handles END insertion with correct newline semantics on all POSIX shells. -
Fix:
apply_patchrewrites the whole file on every key — the old implementation ran onesed -iper key, rewriting the entire config file N times (23 times for sm6125). Theawkrewrite makes a single pass over the file regardless of patch size. -
Fix:
apply_patchwrite is now atomic — the old implementation wrote directly to the config file. A kill mid-write (OOM killer, force-stop) left a truncated config the driver could not parse. The new implementation writes to a.wcs_tmpsibling andmvs it into place —mvon the same filesystem is atomic. -
Fix:
write_config(config editor save) is now atomic — same issue as above. The base64 decode now targets a.wcs_tmpfile;mvreplaces the live config only after a successful decode. -
Fix:
get_modesanitizes mode file —cat mode_status.txtwas written raw into a JSON string. A corrupt or manually edited file could produce invalid JSON, breaking the dashboard on next open. The value is now validated against the three known modes (perf,balanced,stock) and defaults tostockfor anything else. -
Fix:
apply_moderandetect_driver_typetwice — once in the stock-restore branch and once after applying a patch, each triggering a full sysfs scan. Now runs once at the top of the action, result shared by both paths. -
Fix: duplicate
willowalias incustomize.sh— two identicalwillow) ALIAS="ginkgo"entries in the device aliascaseblock. Second entry was dead code but a maintenance hazard. Removed.
New Features
- Boot-time profile re-application (
service.sh) — after a module update or reflash,customize.shcopies a fresh unpatched config from/vendorinto the overlay, silently reverting the tuning even though the saved mode still saysperforbalanced.service.shnow reads the saved mode on every boot and re-applies it automatically. Output is logged to/data/adb/wcs/boot_restore.logfor verification. Stock mode takes no action.
WebUI Fixes
-
Fix: theme flash (FOUC) on open — the saved theme was applied by JS after the page rendered, causing a brief Sci-Fi flash before switching to Light or Dark. A blocking inline
<script>in<head>now readslocalStorageand setsdata-themebefore the first paint. Avisibility: hiddenguard covers the remaining gap while the JS module loads. No visible flash at any network/CPU speed. -
Fix:
data-themeused empty string for Sci-Fi —setTheme('scifi')setdata-theme=""(empty string). While functional, it means[data-theme]attribute selectors would match the empty value unexpectedly. All theme paths now use explicit string values ("scifi","normal","normal-dark").:rootand[data-theme="scifi"]are co-selectors for the Sci-Fi variables. -
Fix: settings checkmarks hardcoded in HTML —
check-scifiandcheck-interval-5had✔baked into the HTML. If the user had changed those settings, reopening Settings briefly showed the wrong checkmark before JS corrected it. All checkmarks are now blank in HTML; JS always writes them via_syncThemeChecks/_syncIntervalChecks. -
Fix: theme checkmarks not updated on Settings visit —
navigate('settings')only called_syncIntervalChecks. If the theme was changed in the same session the checkmarks on the Settings page were stale until the page was re-visited. Now calls both sync functions on every visit. -
Fix: deprecated
escape()/unescape()removed — threedecodeURIComponent(escape(atob(...)))calls and onebtoa(unescape(encodeURIComponent(...)))replaced withTextDecoder/TextEncoder. The old functions are removed from the Web standard and log deprecation warnings in modern WebViews. -
Fix: stats interval timer not cleaned up —
setIntervalfor stats polling had noclearIntervalon page unload. Added apagehidelistener to clean it up when the WebView is destroyed. -
Removed dead
.theme-toggleCSS — three rule blocks for.theme-toggle(a button replaced by the Settings page in an earlier version) were still in the stylesheet. Removed.