Enabling USB debugging on Xiaomi via ADB: A complete guide with commands and tips

Why do you need USB debugging and when you need ADB?

USB debugging is a hidden feature of Android that opens up system tools for developers, testers and advanced users. On Xiaomi smartphones (including Redmi, POCO and Black Shark models), this mode allows you to install custom firmware, recover data after crashes, test apps in Android Studio and even bypass some of the limitations of MIUI. However, sometimes the standard enabler path through Settings β†’ About Phone β†’ The MIUI version becomes unavailable – for example, due to a locked screen, a damaged display or system errors.

This is where ADB (Android Debug Bridge) comes to the rescue, a command-line tool that allows you to control your device through a computer, and it can activate debugging over USB even without direct access to the settings menu, a technique that is especially relevant for Xiaomi owners with a locked bootloader or after unsuccessful updates, when the phone stops responding to touch, but is still determined by the computer.

It is important to understand that working with ADB requires caution: the wrong commands can lead to resetting or even β€œbricking” the device.

  • πŸ”Œ Availability of original USB-cables (cheap analogues often do not support data transfer).
  • πŸ’» Computer with Windows operating system 10/11, macOS or Linux (instructions are universal, but the paths to drivers are different).
  • πŸ“± The battery level of the smartphone is not lower than 50% (to avoid sudden shutdown during the process).
πŸ“Š What kind of smartphone you Xiaomi?
Redmi Note 11/12
POCO X3/X4
Mi 11/12
Black Shark
Other

Preparing the computer: installing ADB and drivers

Before you connect a smartphone, you need to configure the desktop environment on your PC, starting with installing Android SDK Platform-Tools, the official package from Google, which includes adb.exe and other utilities.

For Windows:

  1. Download the Platform-Tools archive from Google.
  2. Unpack it into the root of the C:\ disk (e.g., C:\platform-tools).
  3. Open Command Prompt on behalf of the administrator and type: setx /M PATH "%PATH%;C:\platform-tools" This will add the path to ADB to system variables.

For macOS/Linux:

  • Install the package with Homebrew (macOS): brew install android-platform-tools
  • Or via APT (Ubuntu/Debian): sudo apt update && sudo apt install adb fastboot

After installation, check the performance of the ADB team:

adb version

If the terminal outputs a version (e.g. 1.0.41), then everything is set up correctly.

πŸ’‘

If the adb command is not recognized, restart your computer or check the path in the PATH variable.

Installation of drivers for Xiaomi

Without the right drivers, your computer won’t be able to β€œsee” your Xiaomi in ADB mode. Official drivers from Xiaomi are often installed automatically through Windows Update, but in some cases manual installation is required.

Download drivers from one of the verified sources:

  • πŸ”— Official Xiaomi website (section "Drivers").
  • πŸ”— XDA Developers (search by model of your device).

For manual installation:

  1. Connect your phone to your PC in Charge mode (if other modes are not available).
  2. Open Device Manager (Win + X β†’ Device Manager).
  3. Find a device with a yellow exclamation point (usually under Other Devices or Portable Devices).
  4. Right-click β†’ Update the driver β†’ Search for drivers on this computer and specify the path to the downloaded file.
What to do if the driver is not installed?
Try disabling the driver digital signature check in Windows. To do this: 1. Reboot your Shift PC with the Shift key pressed (select "Reboot Safe Mode"). 2. From the recovery menu, select Diagnostic β†’ Additional settings β†’ Boot options β†’ Reboot. 3. After rebooting, press F7 (disable signature check). 4. Re-install the driver.

Xiaomi Connection to PC and Connection Check

Now connect your smartphone to your computer. If the screen is working, unlock the device and select file transfer mode (MTP or File Protocol). If the screen is not responding, just plug in the cable - ADB can also work in charging mode.

Open the command line and enter:

adb devices

If the connection is established, you will see the serial number of the device (for example, 1234abcd device). If it displays unauthorized instead, then the phone does not confirm debugging access (you need to unlock the screen and allow the connection in the pop-up window).

⚠️ Warning: If the adb device command returns an empty list, check: Cable (try another, original). USB (better USB 2.0 on the back of the PC. Developer settings (if the screen is working, make sure the debugging is not manually disabled).

Activation of debugging via USB via ADB: step-by-step instructions

If your Xiaomi isn’t defined as a debugging device, but your computer can see it, you can try enabling developer mode and debugging through ADB commands. This method works on most devices with MIUI 12/13/14, but may require adaptation for older versions.

β˜‘οΈ Preparation for activation of debugging

Done: 0 / 4

Perform the following commands in order:

  1. Check if the settings service is available: adb shell pm list packages | grep settings If the answer has a line com.android.settings, proceed to the next step.
  2. Start the developer settings activity: adb shell am start -n com.android.settings/.DevelopmentSettings Some Xiaomi models (e.g. POCO F3) may require an alternative command: adb shell am start -n com.android.settings/.SubSettings
  3. Enable Developer Mode (if it is turned off): adb shell settings put global development_settings_enabled 1
  4. Activate debugging on USB: adb shell settings put global adb_enabled 1

After completing the commands, restart the device:

adb reboot

If it's successful, the USB debugging will be on after the restart.

adb shell getprop ro.debuggable

Expected response: 1 (on) or 0 (off).

πŸ’‘

On devices with a locked bootloader, ADB commands may not work, in which case you will need to unlock through the Mi Unlock Tool (the official utility of Xiaomi).

Addressing common mistakes

Even with the correct following of the instructions, errors can occur, and let's look at the most common ones and how to fix them.

Mistake.Reason.Decision
device unauthorizedThe phone has no confirmed debugging access.Unlock the screen and confirm the connection in the pop-up window.
no devices/emulators foundDrivers are not installed or the cable is faulty.Check the connection, try another cable/port.
cannot open '.../settings.db'There is no right to change the system settings.Try the command with superuser rights: adb shell su 0 settings.
command not foundADB is not added to PATH.Enter the full path to adb.exe (e.g., C:\platform-tools\adb devices).

If debugging never turned on after completing the commands, try an alternative method via Fastboot (works only on the unlocked bootloader):

  1. Reboot your device to Fastboot: Adb Reboot Bootloader
  2. Enable debugging through Fastboot: fastboot oem enable-adb
  3. Reboot the phone: fastboot reboot

⚠️ Note: Fastboot commands can reset or damage data if the bootloader is locked. Use this method only if you are confident in your actions!

Security and limitations

Enabling USB debugging opens up potential vulnerabilities for your device, allowing attackers to access personal data, install malware, or even remotely control your smartphone via ADB.

  • πŸ”’ Disable debugging after completion of work.
  • 🚫 Do not connect your phone to a public one. USB-Ports (for example, airports or cafes).
  • πŸ›‘οΈ Use reliable antivirus software like Bitdefender or Kaspersky to scan your connected devices.

Also remember the limitations of Xiaomi:

  • New devices (released after 2022) may require a Mi Account to be linked to unlock the bootloader.
  • Some models (such as the Xiaomi 13T or Redmi Note 12 Pro+) block ADB commands to change system settings without prior authorization.

If you plan to use debugging to install custom firmware (like LineageOS or Pixel Experience), be sure to:

  1. Backup your data via adb backup or Mi Cloud.
  2. Check firmware compatibility with your model on the XDA or 4PDA forums.
  3. Make sure the bootloader is unlocked (checked by the fastboot oem device-info command).

FAQ: Frequent questions about debugging USB on Xiaomi

My Xiaomi is not defined in adb devices. What do I do?
Try the following steps: Reinstall drivers manually through Device Manager. use another USB-cable (preferably original) Enable File Transfer mode (MTP) Check to see if the antivirus or firewall is blocking access. If nothing works, the device can be in Qualcomm 9008 (emergency mode), in which case you will need specialized software like QFil or Mi Flash Tool.
Can I enable debugging on Xiaomi with a broken screen?
Yes, but with caveats: If the screen responds to touch, plug the mouse through OTG-If the screen is completely dead, but the phone is on, use commands. ADB, If the device is not detected even in fastboot, you will need to repair the screen or use it. EDL-The mode (only for experienced users).
How to disable debugging by USB after completion of work?
You can disable it in two ways: via the settings menu: Go to Settings β†’ The phone. β†’ Version. MIUI (press 7 once to turn on developer mode. Return to Settings β†’ Additionally. β†’ For developers, turn off the debugging switch. USB. Through ADB: adb shell settings put global adb_enabled 0
Does this work on all Xiaomi models?
Method by using ADB It is universal for most devices on MIUI, But there are exceptions: πŸ“± Supported by: Redmi Note 10/11/12, POCO X3/X4/X5, Mi 11/12/13, Black Shark 4/5. ⚠️ Restrictions: On Xiaomi 13 Ultra and Redmi K60 Pro may require additional authorization through your Mi Account. ❌ Not working: On devices with damaged firmware or blocked EDL (For accurate information, check compatibility in the forums dedicated to your model.
Can I turn on debugging without a computer?
No, you need a computer to activate USB debugging via ADB. However, if you have access to the settings menu, you can turn it on manually: Go to Settings β†’ About Phone β†’ MIUI Version. Click on MIUI Version 7 times until you notice You are a developer!. Go back to Settings β†’ Additional β†’ Developer. Turn on USB Debugging. If the screen doesn't work, there are no PC-free alternatives.