A locked Xiaomi can feel like a small fortress with a very familiar owner standing outside. The short‚ honest answer is that you generally cannot enable USB debugging from the lock screen. Android deliberately keeps that gate on the inside: changing developer settings normally requires unlocking the phone‚ and a new computer must also be approved on the device.
This is not a Xiaomi quirk or a secret setting waiting to be found. It is a security boundary designed to stop someone who has physical possession of a phone from using a cable to reach private data. The good news is that there are safe routes back in—depending on what “locked” means‚ what you still remember‚ and whether you need the phone itself or only your files.
First‚ identify the kind of lock
- Screen lock: The phone asks for a PIN‚ password‚ pattern‚ or biometric authentication. USB debugging cannot normally be switched on until you unlock the screen.
- Mi Account or Google account protection: The phone is asking for the account previously linked to it‚ often after a reset. This is an anti-theft check‚ not a prompt that ADB can remove.
- A damaged display or touch screen: You may know the passcode but be unable to enter it. That is different from not knowing the passcode; an accessibility or repair option may help you use your own credentials.
- A forgotten passcode: There is no legitimate ADB command that turns debugging on through the lock screen. Recovery may mean restoring access through official account support or resetting the device‚ which can erase local data.
Why a USB cable is not enough
USB debugging is a developer feature‚ not a universal back door. On a Xiaomi running MIUI or HyperOS‚ the usual path is to unlock the phone‚ enable Developer options‚ switch on USB debugging‚ then connect to a computer. Android will normally show an authorization dialog asking whether to trust that computer; The owner must approve it on the phone.
That last step matters. Even if debugging was enabled earlier‚ a computer that has not already been authorized may still be unable to use ADB. If debugging was off‚ or the phone displays an authorization request that you cannot approve‚ plugging in a laptop does not make the setting appear. Commands found online that promise to change a locked phone’s settings should be treated with suspicion; many assume prior access‚ require a modified device‚ or risk data loss.
If you know the passcode but the screen is hard to use
- Try a simple restart and a clean cable. This will not unlock the phone‚ but it can rule out a frozen display or unreliable connection. Avoid repeatedly guessing a passcode.
- If touch is broken‚ consider an OTG mouse. On many models‚ a compatible USB-C OTG adapter lets you connect a mouse and enter your own PIN or password on screen. Support depends on the device and the fault. A mouse cannot reveal a forgotten passcode or bypass the lock.
- If the display is unusable‚ seek a repair that preserves the board and storage. Tell the technician you need access to your data and ask them to check the display or touch assembly before proposing a reset. Do not hand over your passcode unless you trust the provider and understand why it is needed.
- Once you have unlocked the phone‚ enable debugging normally. On many Xiaomi versions‚ open Settings > About phone and tap the OS version or MIUI version entry repeatedly until Developer options are enabled. Then look under Settings > Additional settings > Developer options for USB debugging. Menu names vary by model and software release.
- Connect to your own computer and approve its key. Keep the phone unlocked‚ read the authorization prompt‚ and approve only a computer you recognize. You can revoke USB debugging authorizations later in Developer options.
If the passcode is forgotten
Start with the least destructive options. Check whether photos‚ contacts‚ and documents are already synced to your Google account‚ Xiaomi Cloud‚ or another backup service; Sign in to the relevant account from a trusted device or browser and review what is available. A cloud backup may be the real rescue rope; USB debugging is not required to retrieve data that was synced beforehand.
If you cannot unlock the phone‚ contact Xiaomi support or an authorized service provider and ask what recovery options apply to your exact model and region. Be prepared to show proof of ownership. If the device is requesting the previously linked Google or Mi Account after a reset‚ use that account’s official recovery process. Account recovery can take time‚ but it is safer than paying a stranger who claims to remove the protection instantly.
A factory reset may restore use of the phone‚ but it generally erases data stored locally and may still require the account previously linked to the device during setup. Do not reset until you have checked your backups and understand the consequences. Never share one-time codes or account passwords with an alleged “unlocking” service.
What about Recovery‚ Fastboot‚ or “ADB unlock” tricks?
Recovery and Fastboot are maintenance modes‚ not alternate switches for USB debugging. Their availability does not mean the phone’s private files are open‚ and many operations can wipe data or alter the system. Unlocking a bootloader is not a reliable data-recovery method; on many Android devices it triggers a factory reset. Avoid instructions that ask you to flash files‚ install unknown software‚ or disable security protections when your goal is to preserve personal information.
The practical answer
If USB debugging was never enabled and the Xiaomi is genuinely locked‚ you cannot safely turn it on from the outside. If you know the screen credential‚ regain normal interaction first‚ then enable debugging and approve your own computer. If you do not know the credential‚ focus on backups‚ official account recovery‚ or authorized support—not on bypass tools.
The lock screen is doing its job‚ even when it is inconvenient. Think of USB debugging as a workshop door: it can be useful once the owner opens it‚ but the cable is not the key.

