How to turn off USB-flash drive on Xiaomi phone

Owners of Xiaomi, Redmi and POCO smartphones often face a situation where when you connect a device to a computer or charger, the system automatically goes into storage mode.This behavior by default ensures fast file transfer, but in certain scenarios becomes a critical vulnerability. Data security comes to the fore when you connect the gadget to public charging stations or someone else's PC.

Disengagement mode USB-storage device MTP) It allows you to use the port solely for power or debugging, blocking unauthorized access to internal memory. MIUI The new HyperOS has flexible mechanisms for managing external connections, but they are often hidden in deep menus or activated only through special commands.

In this article, we will discuss in detail all available ways to restrict access to the file system through the USB-You'll learn how to switch connection protocols, use the engineering menu for deep customization, and use third-party tools to automate the process.

Why restrict access to USB-port

The main reason users want to turn off USB data is to protect personal information: When a phone connects to an unknown computer in MTP (Media Transfer Protocol) mode, the device becomes visible to the PC operating system, which means that anyone with physical access to a computer can theoretically copy your photos, documents or contacts.

⚠️ Warning: Connecting your smartphone to public charging stations at airports or cafes in data mode creates a risk of "juice jacking" - data theft through the charging port!

In addition to security, there are technical aspects: some drivers on older computers can work incorrectly with modern Xiaomi smartphones, causing system freezes or excessive battery discharge. Switching to Charge Only mode solves the compatibility problem and allows you to use the port as a regular power source without undue load on the processor.

Also worth noting is the impact on battery life: With an active data protocol, background synchronization processes can consume more power than a simple charger connection. If your goal is to quickly recharge the battery, locking the drive mode is a logical step to optimize power consumption.

πŸ“Š How do you use it most often? USB-connection?
Just for charging.
For the transmission of photos and videos
To debug applications
Rarely and accidentally.

Standard Connection Settings in MIUI and HyperOS

The easiest and safest way to manage a type USB-Connections are built-in tools for the Android operating system, and in Xiaomi shells, this functionality is available immediately after the cable is connected. The default system offers several behaviors when connecting to an external device, and the user only needs to choose the appropriate one.

Once you connect the phone to your computer, pull the notification curtain down, and you'll see a system notification with a text like "Charge through." USB" or "Click for other actions." Clicking on this notification opens the mode selection menu. USB-Here, it is important to choose an option that does not involve transferring files.

  • πŸ”Œ Charging only – the device ignores data requests, operating solely as an energy consumer.
  • πŸ“ File transfer (MTP) β€” Standard mode for accessing phone memory from a computer.
  • πŸ“· PTP (Picture Transfer Protocol – a mode emulating a digital camera useful for older PCs.
  • 🎧 MIDI β€” Used to connect musical instruments, file transfer is excluded.

Charging Only will instantly block access to the file system, and the computer will identify the connected device as a power source or unknown device, but will not gain access to folders and documents, ideal for use in public places.

β˜‘οΈ Checking connection settings

Done: 0 / 5

Using a Developer Menu to Manage USB

For more advanced users who need constant port control, there is a section called "Developers" in this hidden menu that contains settings to change behavior. USB-This is especially true if the standard notification does not appear or you want to lock in the "Only Charge" mode forever.

To activate this section, go to Settings β†’ About Phone and quickly click on MIUI or HyperOS seven times. Once you have a message, "You're a developer," you can go to the settings. Find "Default USB Configuration" and select "Charge."

⚠️ Attention: Changing the settings in the developer menu can affect the work of debugging on the website USB And you can connect peripherals, and be careful when you change the settings if you're not sure what they're supposed to do.

In the same section, it is useful to pay attention to the option "Debugging by USB." If it is enabled, the computer receives extended permissions to access the system through the ADB protocol. For maximum security when connecting to someone else's PC, it is better to turn off this feature, leaving only the charging mode active.

Setup parameterRecommended valueSafety impact
USB configurationCharging.High (blocks access to files)
USB debuggingOff.Critical (protects against) ADB-attack)
USB-debugging (Safety)Off.Average (requests confirmation)
Regime. USB-audioAuto/OffLow (affects sound)
What is ADB and why should you be afraid of it?
ADB (Android Debug Bridge) is an interface that allows a computer to control a phone at a deep system level, and if an attacker gains access to ADB on an unlocked phone, they can install malware, copy all data, or even gain root rights, so turning off debugging in public is a mandatory security measure.

Shutdown USB-The storage device through the engineering menu

The Engineering Mode provides access to low-level Xiaomi hardware settings, which allows you to manage driver-level port modes through the interface, a method that is considered more radical and requires caution, as improper changes can lead to unstable device operation.

To enter the engineering menu, you need to enter a special code in the Phone application. The most common code for devices based on MediaTek processors is ##3646633##. For Qualcomm processors, the codes may differ or require the installation of a special QC Engineer application. In the menu you should find the section associated with USB or Connectivity.

Inside the menu, look for the tab that handles the USB configuration, and you can force the controller to run. However, it's worth remembering that modern versions of Android restrict access to these features without root rights. If the fields are blocked, this method may not be suitable for your version of the software.

πŸ’‘

Before making changes to the engineering menu, take a screenshot of the original settings, which will allow you to quickly return everything as it was, if after experiments the phone starts to work incorrectly.

If you can find the right setting, change the USB Mode to "Charging Only" or similar. Once rebooted, the device will ignore any connection requests as a drive until you manually return the settings back, creating a hard barrier to any attempts to access data through the port.

Automation through ADB-team

For users who prefer a technical approach, there is a possibility of management. USB-modes through the command line using the utility ADB. This method allows scripting to switch modes, which is convenient for creating automatic protection scripts. You need a computer with drivers and platform tools installed.

First, you need to plug in your phone, allow debugging, and open the command line on your PC. To check the connection, type in the adb device command. If the device is displayed, you can go to setup. USB-The configuration is as follows:

adb shell svc usb setFunctions charging

This command forcibly puts the port into charging mode. To return the file transfer capability, the adb shell svc usb setFunctions mtp command is used. The advantage of this method is that commands can be executed remotely or run through script-tags on the phone itself (if you have the shell rights).

  • πŸ›‘οΈ svc usb setFunctions charging – blocks data transmission, leaving only current.
  • πŸ“‚ svc usb setFunctions mtp – includes a media device mode for files.
  • πŸ” svc usb getFunctions – shows the current active port mode.

It is important to understand that after a phone reboot, the settings made through ADB can reset to the default system values, so it is better to use this method as a temporary measure of protection or part of a more complex automation scenario.

Problems and solutions when disabling the drive

Users sometimes face situations where the phone doesn't switch to the right mode or the computer stops seeing the device even for charging. Often the problem lies in the cable itself. Cheap "charging only" cables have no physical data lines, so the question of turning off the drive is not relevant for them - it is already "disabled" structurally.

If the cable is good but the mode is not changing, it may be a third-party application intervention or a system failure. Try clearing the Settings app cache or resetting the network settings. In rare cases, it helps to flash the device or upgrade to the current version of MIUI.

⚠️ Note: If you have been manipulated by USB-The phone stopped charging from computers, but it's powered by network adapters, check if Charging Only is forced. It's not a fault, it's a correct operation of the configured limitation. It's also worth considering the compatibility of operating systems. Older versions of Windows (XP, 7) may incorrectly handle modern Xiaomi protocols, requiring manual mode selection MTP In such cases, using third-party Wi-Fi file managers can be a convenient alternative to cable connection. πŸ’‘The most reliable way to protect data is to physically control the cable and use Charge Only mode in case of any doubts about the security of the connected device (FAQ) Can I completely ban the charging through USB, leaving only the data transfer? Technical standards USB You can't completely shut down the current by software, because that's the basic function of the protocol, but you can limit the current through special applications if you have root rights, but that's risky for system stability. Why can't the computer see the phone after you've selected Charge Only? This is the expected behavior. In this mode, the phone hides its file partitions from the computer's operating system, acting solely as a power input device. MTP In the notification curtain, does the blackout affect the USB-In most cases, the charging speed even increases slightly, since the phone's processor does not waste resources on processing file requests and maintaining a connection with the host. Quick Charge or Power Delivery fast charging protocols continue to work normally. Is it safe to use the engineering menu to set up USB? It is safe to use the engineering menu if you only change the parameters you know, such as USB configuration. Changing unknown radio frequency settings or (voltage) can lead to unstable modem operation or damage to hardware.