how can i reliably turn on hotspot on miui 14 with...
Created on: February 20, 2026
Answered using GPT-5.2 Thinking by Chat01
Created on: February 20, 2026
Answered using GPT-5.2 Thinking by Chat01
how can i reliably turn on hotspot on miui 14 with shell command and root?
On MIUI 14 (typically Android 13), the most repeatable way from shell is to use Android’s built-in Wi-Fi shell service:
cmd wifish# Start hotspot (WPA2) adb shell su -c 'cmd wifi start-softap "MyHotspot" wpa2 "MyPassw0rd" -b any' # Stop hotspot adb shell su -c 'cmd wifi stop-softap'
-b can be 2, 5, 6, any, or bridged depending on device support. (Android Git Repositories)
For an open hotspot:
shadb shell su -c 'cmd wifi start-softap "MyOpenHotspot" open "" -b any'
(“open/owe…” means “no passphrase”, but the argument position still exists.) (Android Git Repositories)
A practical “do-the-right-things-first” sequence:
shadb shell su -c ' svc data enable cmd wifi set-wifi-enabled disabled cmd wifi start-softap "MyHotspot" wpa2 "MyPassw0rd" -b any '
shadb shell su -c 'cmd wifi status' # or adb shell su -c 'dumpsys wifi | grep -i -E "SoftAp|Tether"'
AOSP’s own help text for cmd wifi start-softap explicitly warns it doesn’t activate internet tethering by itself (it can bring up the AP, but not necessarily the full “share cellular data” pipeline). (Android Git Repositories)
So if clients can connect but don’t get internet, you’re hitting that limitation.
There isn’t a stable, universal “one shell command” for starting the tethering module across OEM ROMs; the old service call ... approaches are version/ROM-fragile and can even crash/reboot on newer Android builds. (Android Enthusiasts Stack Exchange)
If you tell me your MIUI 14 Android version (12 vs 13), and whether cmd wifi start-softap gives internet for you or not, I can suggest the least-fragile next step for your build (e.g., a ROM-specific binder call, or a tiny root helper using the official TetheringManager path).
what does -b any do?
-b is the band selection option for cmd wifi start-softap.
-b any means “use any supported band” — i.e., don’t force 2.4 GHz vs 5 GHz vs 6 GHz. The Wi-Fi framework will pick what it thinks is best/allowed on that device at that moment.What “best/allowed” typically depends on things like:
So with -b any, you might see it start on 5 GHz on one run and 2.4 GHz on another, depending on conditions.
If you want deterministic behavior, you can force it:
-b 2 → 2.4 GHz-b 5 → 5 GHz-b 6 → 6 GHz (only if supported)Example:
shcmd wifi start-softap "MyHotspot" wpa2 "MyPassw0rd" -b 5
how to disable miui's auto turn off hotspot when no device is connected by shell command?
MIUI’s “turn off hotspot automatically when no devices are connected” is the SoftAP auto-shutdown feature in Android: when auto-shutdown is enabled, the AP shuts down after an idle timeout. In AOSP this behavior is explicitly part of SoftApConfiguration (auto-shutdown + timeout). (Android Git Repositories)
cmd wifi start-softap can’t control thisOn Android 13’s Wi-Fi shell command, start-softap only builds a config with SSID / security / band (no auto-shutdown toggle, no timeout arg). (Android Git Repositories)
So there is no single official cmd wifi ... flag you can pass to “disable auto turn off”.
That leaves two practical root+shell approaches:
settings put ...Some OEMs wire that toggle into a SettingsProvider key. The reliable way is to discover which key changes when you flip the toggle in UI once.
shadb shell su -c ' mkdir -p /data/local/tmp/hotspot settings list global > /data/local/tmp/hotspot/before.global settings list secure > /data/local/tmp/hotspot/before.secure settings list system > /data/local/tmp/hotspot/before.system echo "NOW: toggle the MIUI switch (Turn off hotspot automatically) once, then run the AFTER command." '
After toggling the switch in MIUI Settings:
shadb shell su -c ' settings list global > /data/local/tmp/hotspot/after.global settings list secure > /data/local/tmp/hotspot/after.secure settings list system > /data/local/tmp/hotspot/after.system toybox diff -u /data/local/tmp/hotspot/before.global /data/local/tmp/hotspot/after.global | toybox grep -i -E "hotspot|tether|softap|ap|timeout" || true toybox diff -u /data/local/tmp/hotspot/before.secure /data/local/tmp/hotspot/after.secure | toybox grep -i -E "hotspot|tether|softap|ap|timeout" || true toybox diff -u /data/local/tmp/hotspot/before.system /data/local/tmp/hotspot/after.system | toybox grep -i -E "hotspot|tether|softap|ap|timeout" || true '
Whatever key/value flips there is your target; then you can force the “don’t turn off” state with:
shadb shell su -c 'settings put <global|secure|system> <the_key> <the_value_you_want>'
Validate with:
shadb shell su -c 'dumpsys wifi | toybox grep -i -E "softap|shutdown|timeout"'
On modern Android, SoftAP config is persisted by the Wi-Fi module; the config store often lives under /data/misc/apexdata/com.android.wifi/ (and is known to contain sensitive Wi-Fi data). (XDA Forums)
shadb shell su -c ' for d in /data/misc/apexdata/com.android.wifi /data/misc/wifi; do [ -d "$d" ] || continue echo "=== searching in $d ===" toybox grep -Rni -E "AutoShutdown|ShutdownTimeout|softap|SoftAp" "$d" 2>/dev/null | toybox head -n 50 done '
You’re looking for something that clearly encodes:
AutoShutdownEnabled (or similar), and possiblyOnce you identify the exact file (say it’s WifiConfigStore.xml or another XML), do:
shadb shell su -c ' cmd wifi stop-softap 2>/dev/null || true CFG="/data/misc/apexdata/com.android.wifi/WifiConfigStore.xml" # <-- change to your real file cp -a "$CFG" "$CFG.bak.$(date +%s)" # Example patch for a common XML form: toybox sed -i \ -e "s#<AutoShutdownEnabled>true</AutoShutdownEnabled>#<AutoShutdownEnabled>false</AutoShutdownEnabled>#g" \ -e "s#<autoShutdownEnabled>true</autoShutdownEnabled>#<autoShutdownEnabled>false</autoShutdownEnabled>#g" \ "$CFG" # Restore SELinux context if available (often needed on MIUI) restorecon "$CFG" 2>/dev/null || true '
If your file uses 1/0 instead of true/false, adjust the sed accordingly.
A reboot is the cleanest way to ensure the Wi-Fi module reloads the persisted SoftAP config:
shadb shell su -c 'reboot'
Then verify:
shadb shell su -c 'dumpsys wifi | toybox grep -i -E "softap|shutdown|timeout"'
Auto-shutdown is a first-class SoftAP setting (setAutoShutdownEnabled, setShutdownTimeoutMillis), and the default timeout comes from Wi-Fi resources/overlays unless overridden. (Android Git Repositories)
But cmd wifi start-softap doesn’t expose those knobs, so you have to change whatever MIUI persists (Settings key or Wi-Fi config store). (Android Git Repositories)
If you paste the output of:
shadb shell su -c 'dumpsys wifi | toybox grep -i -E "SoftAp|auto.*shutdown|timeout"'
and (from Option B) the first few matching grep -Rni AutoShutdown... lines, I can tell you exactly which file/key to change and what to set it to on your specific MIUI 14 build.