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).
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:
- Download the Platform-Tools archive from Google.
- Unpack it into the root of the C:\ disk (e.g., C:\platform-tools).
- 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 versionIf 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:
- Connect your phone to your PC in Charge mode (if other modes are not available).
- Open Device Manager (Win + X β Device Manager).
- Find a device with a yellow exclamation point (usually under Other Devices or Portable Devices).
- 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?
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 devicesIf 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
Perform the following commands in order:
- 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.
- 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
- Enable Developer Mode (if it is turned off): adb shell settings put global development_settings_enabled 1
- Activate debugging on USB: adb shell settings put global adb_enabled 1
After completing the commands, restart the device:
adb rebootIf it's successful, the USB debugging will be on after the restart.
adb shell getprop ro.debuggableExpected 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 unauthorized | The phone has no confirmed debugging access. | Unlock the screen and confirm the connection in the pop-up window. |
| no devices/emulators found | Drivers 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 found | ADB 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):
- Reboot your device to Fastboot: Adb Reboot Bootloader
- Enable debugging through Fastboot: fastboot oem enable-adb
- 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:
- Backup your data via adb backup or Mi Cloud.
- Check firmware compatibility with your model on the XDA or 4PDA forums.
- Make sure the bootloader is unlocked (checked by the fastboot oem device-info command).