Last updated: November 8, 2026. A broken modem partition can leave your Xiaomi phone with no IMEI, no signal and “Invalid IMEI” after a bad flash, especially if you skipped a backup before installing a custom ROM. On Snapdragon-based Xiaomi, Redmi and POCO phones, you can avoid that with Qualcomm’s QPST tools: boot the phone in Diag mode and save a QCN backup, which contains your IMEI and radio calibration.
Need firmware for your phone? Find official HyperOS Recovery and Fastboot ROMs for Xiaomi, Redmi and POCO devices, for every region: Xiaomi firmware download.
This guide shows how to enter Diag mode on older MIUI and newer HyperOS phones, how to back up and restore the QCN file with QPST, and what doesn’t work anymore.
Legal note: only restore the original IMEI of your own phone. Changing an IMEI to a different number is illegal in many countries.
Downloads
| File | What it is | Download |
|---|---|---|
| QPST 2.7 (build 425) installer, unofficial copy (Qualcomm doesn’t offer a public download) | Qualcomm Product Support Tools: QPST Configuration and Software Download (QCN backup/restore) | Download QPST |
| qualcomm_diag_driver.rar | Diagnostics port driver for Windows | Download Diag driver |
| Qualcomm HS-USB driver | Full Qualcomm USB driver package (also includes Diag and 9008) | Qualcomm driver page |
QPST runs on Windows 10 and 11 (64-bit). Install it as administrator.
Which Phones Does This Work On?
- Qualcomm Snapdragon Xiaomi, Redmi and POCO phones only. MediaTek models (many Redmi and POCO C/M series) use different tools: for their IMEI use Maui META.
- Older phones (MIUI 9–12): Diag mode can usually be enabled with a dialer code or ADB.
- Newer phones (MIUI 13–14, HyperOS): the dialer code usually no longer works. 4PDA’s Xiaomi FAQ switches on the Diag port from a normal ADB shell without root (see Method B). On some newer firmware the command is refused, and then it only works with root.
- A QCN backup contains your phone’s IMEI and belongs to that one phone. Restore it only to the same phone, and don’t share the file.
Step 1: Install QPST and the Drivers
- Extract the QPST archive and run the installer as administrator. Keep the default options.
- Install the Qualcomm driver package (or extract the Diag driver for manual installation).
- Restart Windows. On Windows 11, if the driver is rejected, disable driver signature enforcement once, as described on our QDLoader 9008 driver page.
Step 2: Enable Diag Mode on the Phone
Method A: Dialer code (older MIUI phones)
Open the Phone app and type *#*#717717#*#*. On supported models, a message confirms that the Diag USB port is enabled. Connect the phone to the PC. Type the same code again later to turn it off.
Method B: ADB command (newer phones)
- Enable USB debugging and connect the phone (see our ADB guide).
- Open a command prompt in the platform-tools folder and run:
adb shell
setprop sys.usb.config diag,adb
If the shell answers with a permission error, your firmware needs root: run su first.
If nothing changes, try setprop sys.usb.config rndis,diag,adb. Reboot the phone when you’re done to leave Diag mode.
Check that it worked
Open Device Manager. Under Ports (COM & LPT) you should see Qualcomm HS-USB Diagnostics 901D (the number after “Diagnostics” varies by model) with a COM number. If it shows as an unknown device, install the Diag driver manually through Update driver → Have Disk.
Step 3: Back Up the QCN File (IMEI Backup)
- Open QPST Configuration. Under Ports, your phone should appear with its COM port. If not, click Add New Port, untick Show Serial and USB/QC Diagnostic ports only, type your COM port number in both fields and click OK.
- Open Start Clients → Software Download.
- Go to the Backup tab, select the phone’s port and click Browse, choose a folder and the file type (
.xqcnor.qcn). - Click Start and wait for Memory Backup Completed. If you are asked for an SPC code, the default is
000000. - Copy the QCN file to cloud storage or a USB stick. It is your only way back if the modem partition gets damaged.
Also back up the persist, modemst1, modemst2 and fsg partitions if you have root or TWRP. On many newer phones, these partitions matter more than the QCN file.
Step 4: Restore the QCN File
- Enable Diag mode again (Step 2) and open QPST Software Download.
- Go to the Restore tab, select the port and your
.qcnbackup. - Click Start. After it finishes, reboot the phone and dial
*#06#to check the IMEI.
Common Problems
QPST shows “No phone” or the port stays grey
The phone is not in Diag mode, or Windows is using the wrong driver. Re-check Device Manager for the Diagnostics 901D port, reinstall the Qualcomm driver and try another USB port.
The dialer code does nothing
Your model or firmware doesn’t support it. Use Method B (root) instead.
Backup fails or the QCN file is tiny (a few KB)
Don’t rely on that file. Back up the modemst1, modemst2, fsg and persist partitions with root or TWRP instead.
IMEI is “null” after restoring
The QCN came from a different firmware version or a different phone. Restore the stock Fastboot ROM with Mi Flash, then restore your own backup again. If you have no backup of your own, only an authorized Xiaomi service center can repair the IMEI legally.
FAQ
Does a factory reset or a ROM flash delete my IMEI?
Normally no. The IMEI lives in protected partitions that stock ROMs don’t touch. The risk comes from custom ROMs, “Clean all” flashes with wrong files, and formatting persist or modem partitions by mistake.
Can I use QPST on a locked bootloader?
On older phones with the dialer code, yes. On newer phones often yes too: 4PDA’s method uses only ADB. Some newer firmware refuses the command without root.
Is QFIL the same as QPST?
QFIL is installed together with QPST, but it is a flashing tool for EDL mode (9008). QPST Software Download is the part you use for QCN backup and restore.
Sources: 4PDA Xiaomi FAQ, QPST IMEI (QCN) backup and restore by Dima_Apatity; Redmi Note 7 thread, EFS/persist backup by ZerG_MOS.
Xiaomi firmware & news on Telegram
New firmware, HyperOS 4 rollout updates, guides and Xiaomi news, all in one channel.

