how can i reliably turn on hotspot on miui 14 with...

Created on: February 20, 2026

Answered using GPT-5.2 Thinking by Chat01

Question

how can i reliably turn on hotspot on miui 14 with shell command and root?

Thought

Crafting solution for MIUI 14 hotspot

For MIUI 14 (Android 13/14), the most stable option to enable a Soft AP is cmd wifi start-softap or stop-softap. This will bring up the AP, but you’ll need to enable tethering separately for internet sharing. There are two options: A) Use for LAN/repeater with start-softap, B) For cellular data sharing, use the binder call for tethering, though it's inconsistent across versions and devices.

Solution for enabling hotspot on MIUI 14 with root

With root, you can use a shell command to enable the Wi-Fi hotspot interface. One option is:

su -c 'cmd wifi start-softap "SSID" wpa2 "PASS" -b any'

To also enable tethering functionality, you could try:

su -c 'settings put global tether_dun_required 0'

This may not fully enable tethering but might help with some carriers. The main step is bringing up the AP interface.

Proposal for stable hotspot control

To toggle the system hotspot reliably, one option is using the command cmd wifi start-softap with your configured Wi-Fi settings. This method is stable across versions. For a more complex solution, invoking a binder call to WiFi service's startTetheredHotspot is possible but potentially less reliable due to varying transaction codes. The straightforward cmd wifi command should be the better choice given its consistency.

Response outline for enabling/disabling device hotspot

To enable or disable the hotspot, here's a straightforward script:

  • Ensure root access.
  • Check if airplane mode is off using settings global airplane_mode_on 0.
  • Enable cellular data (svc data enable).
  • Disable Wi-Fi (cmd wifi set-wifi-enabled disabled).
  • Start soft AP with parameters (SSID, wpa2/wpa3, band).
  • Check hotspot status (cmd wifi status or dumpsys wifi | grep -i "SoftAp").

For debugging, check for error messages like "Lohs failed" or permissions issues. Note: cmd wifi start-softap doesn't activate internet tethering by default, so for full cellular sharing, MIUI's hotspot toggle is still needed.

Addressing MIUI 14 hotspot setup

For MIUI 14 (based on Android 13), cmd wifi should work. The start-softap command works but won't activate internet tethering; MIUI's standard hotspot toggle is still needed for sharing cellular data. A safer alternative is to use cmd wifi, as transaction codes with service call wifi may vary. Pay attention to SSID security – start-softap requires either WPA2/WPA3 or "open" with an empty passphrase. Root access ensures functionality, but be mindful of MIUI's restrictions.

Providing the most reliable MIUI hotspot solution

The most reliable way to set up Wi-Fi hotspot with MIUI 14 is via cmd wifi start-softap. However, for cellular data sharing, you may need to enable tethering manually, as just enabling the AP often isn't enough. We suggest using a fallback approach like triggering the MIUI UI toggle or using a minimal Magisk module, though for true reliability, a privileged app is more stable.

Providing MIUI 14 tethering solution with root access

To bring up the hotspot on MIUI 14, first use cmd wifi start-softap. Ensure cellular data is enabled (svc data enable) and Wi-Fi is off. For tethering, note that cmd wifi start-softap won't enable full internet sharing without additional steps. In this case, use a helper app or reverse-engineer the binder call for a stable setup. If you want to go further, you can find binder transaction codes, but that’s complex.

Thought for 8m 7s

Answer

On MIUI 14 (typically Android 13), the most repeatable way from shell is to use Android’s built-in Wi-Fi shell service:

1) Start / stop the hotspot (SoftAP) via cmd wifi

sh
# 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:

sh
adb 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)

2) Make it behave like “phone hotspot” (share cellular) as much as possible

A practical “do-the-right-things-first” sequence:

sh
adb shell su -c ' svc data enable cmd wifi set-wifi-enabled disabled cmd wifi start-softap "MyHotspot" wpa2 "MyPassw0rd" -b any '

3) Verify state

sh
adb shell su -c 'cmd wifi status' # or adb shell su -c 'dumpsys wifi | grep -i -E "SoftAp|Tether"'

Important caveat (why people say hotspot is “hard” via shell)

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.

What to do if you need guaranteed cellular sharing

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).

Question

what does -b any do?

Thought

Thought for 9s

Answer

-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:

  • what bands your chipset + regulatory domain allow (country/region rules)
  • whether 5/6 GHz hotspot is supported/enabled in the ROM
  • channel availability (DFS restrictions can push it back to 2.4)
  • concurrency constraints (e.g., if Wi-Fi client mode is active, some devices can only softap on certain bands)

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:

sh
cmd wifi start-softap "MyHotspot" wpa2 "MyPassw0rd" -b 5

Question

how to disable miui's auto turn off hotspot when no device is connected by shell command?

Thought

Crafting response with minimal citations

So, this old document doesn’t have the info I need. Since we've used up a lot of web calls, I'll focus on using AOSP sources for the response. I’ll highlight key points:

  • SoftApConfiguration handles auto shutdown.
  • cmd wifi start-softap doesn’t manage auto shutdown.
  • AOSP docs mention the default shutdown timeout.

I’ll also mention MIUI’s settings toggle option, though it’s unnecessary here since the user specifically wanted a shell solution, and I'll remind them that system modifications might break after updates.

Outlining methods with citations

There are two methods to address the issue:

  1. Check for MIUI setting key: Use the settings diff trick to check for an existing key and set it to 0 if found.
  2. Patch WifiConfigStore.xml: Locate the file at /data/misc/apexdata/com.android.wifi/WifiConfigStore.xml (mentioned in XDA), ensure root access, use grep -R to find relevant tags, modify, then reboot or restart the Wi-Fi service with the cmd command.

Clarifying method for disabling auto-shutdown

The MIUI setting "Turn off hotspot automatically" exists in the Portable Hotspot settings but requires manual action. I could suggest using a command to open the settings page or automate the UI using input commands, though that's a bit hacky. Instead, I'll focus on SoftApConfiguration, which controls auto-shutdown: if enabled, the AP shuts down when no clients are connected for a set timeout, which is defined in AOSP docs.

Providing solutions for turning off hotspot auto-shutdown

For MIUI, there’s no direct command to alter the auto-shutdown. You can either modify the SoftApConfiguration in the Wi-Fi config store or toggle settings via MIUI’s database. A step-by-step guide should include backup instructions, warnings about potential Wi-Fi issues, and device encryption. Also, disable battery saver or security apps that may affect auto-off. Another method is to keep a dummy client connected to prevent shutdown, but that’s more of a workaround.

Thought for 4m 55s

Answer

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)

The catch: cmd wifi start-softap can’t control this

On 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:


Option A (best if MIUI stores it as a Settings key): diff settings → 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.

sh
adb 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:

sh
adb 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:

sh
adb shell su -c 'settings put <global|secure|system> <the_key> <the_value_you_want>'

Validate with:

sh
adb shell su -c 'dumpsys wifi | toybox grep -i -E "softap|shutdown|timeout"'

Option B (most common on Android 12/13+): patch the persisted SoftAP config in Wi-Fi config store

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)

1) Locate where “AutoShutdown” is stored

sh
adb 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 possibly
  • an idle timeout value.

2) Stop hotspot, back up the file, patch it

Once you identify the exact file (say it’s WifiConfigStore.xml or another XML), do:

sh
adb 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.

3) Reboot (most reliable) or restart Wi-Fi

A reboot is the cleanest way to ensure the Wi-Fi module reloads the persisted SoftAP config:

sh
adb shell su -c 'reboot'

Then verify:

sh
adb shell su -c 'dumpsys wifi | toybox grep -i -E "softap|shutdown|timeout"'

Why this works conceptually

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:

sh
adb 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.

Share this Q&A