adb shell


setprop sys.usb.config diag,adb

You must be rooted to give these commands as you may guess. What’s it for ? Latest command will open your phone’s Qualcomm Diag Port to work with. There may be some exceptions of course in which it won’t work, let me know if this happens in comments.

Remember our example phone in Part 1 was Xiaomi Mi5, you can either use this command, or depending on which rom you are you can use dial pad combination too, *#*#7177171#*#*. This info is valid for all Xiaomi Qualcomm’s not just Mi5. In Part 2 i will use a Mi5 S  to work with,  all Snapdragon 820 and 821 chipsets are the same when it’s about partition table,  video will be ready on my Youtube Channel soon . I will give info about older chipsets too. By the way i’m sorry that this guide took some time to be finished, but better than none right ? Plus you will get world’s largest QCN archive soon.

So we all know what’s a Qcn backup now. It’s a backup of modem related partitions in Qualcomm structure. Which also includes modem baseband info + imei info. Having this backup, we can edit “imei” line (or lines; some phone models have 1 line, dual sim models have 2 lines obviously and all LG 1 sim models have 3 lines of imei info).  But before that we will see how we can restore/upload the modified Qcn backup to the phone. If your imei became “0” somehow, you can edit an other Qcn taken from same model and restore your imei (+baseband) uploading that Qcn to your phone, no need for any other steps. BUT if you messed up your baseband (=invalid imei), you need to get rid of the write protection before. For this we are going to “empty/zero” necessary modem partitions = to delete the old/wrong values. After that we will be able to upload any Qcn  we want, without any problems and errors. That is the answer why some readers having difficulties to restore Qcn’s to their phones. To do that, our phones must be rooted, because these are deep stuff now and we need to be very careful in every step. Saying it again, VERY CAREFULLY ! If you delete a wrong partition without checking it twice, you may end up with hard bricked phone in your hands. For many Chinese brands that won’t be a problem because they have their rescue roms, you can read those unbrick guides in my “UNBRICK” section, but for LG, HTC and some other known makers, you won’t have any PC based method to fix them, so VERY CAREFULLY !.

adb shell


ls -al /dev/block/platform/soc/624000.ufshc/by-name (this is for new Snapdragon 820 series, it’s just ls/list command with right parameters. If this command won’t list your partition table by name just go back till /platform and see what your partition tables continues with)


This is the inside of your Snapdragon 820/821 based Xiaomi. Only 3 part form here matters for us, modemst1, modemst2 and fsg, those the partititions hosting your baseband and imei info (not all Snapdragons, but most Chinese made Qualcomms). Please keep in mind, this is very important, numbers are variable depending on the phone model, so names are important for us, not numbers, don’t try these numbers on a phone other then Mi 5 series, just list your parititon table and look for modemst1, modemst2 and fsg. Let’s zero/emty these 3 partitions :

dd if=/dev/zero of=/dev/block/sdf3

dd if=/dev/zero of=/dev/block/sdf5

dd if=/dev/zero of=/dev/block/sde28


Your phone will boot with an “invalid” imei, this means all the info is deleted. No need to worry as long as you have your QCN backup somewhere safe. Speaking of, its time to edit our QCN backup, let’s say our friend’s QCN backup with our imei number so we can fix our baseband including the right imei number.


Search for the line starting with “088a“, IF your imei is starting with number “8”. The number before “A” is always your first imei number and thats what matters for us. If your imei number is starting with “3” for example, CTRL + F and find the line starting with “083a” (hex values only, untick “find text” if you are using same hex editor).


Prepare “imei converter” program that you have download before and put your desired imei number in it, click “convert imei” and you will get the right format that you need to put in your hex editor. Rest is easy just carefully change the line right after “08xA” including your first number with “x”.


Do the same for your second imei number hitting “F3” and finding the right line starting with “08xA“.


After you finished editing “SAVE AS” your QCN ! Don’t save it on the original backup, if you have done something wrong editing your original QCN file then you may corrupt it and there is no way to return and edit it again. So this is very important “save as” your new QCN with any name ending with “.qcn“.


You may guess the rest, remember we backed up our QCN in our Part 1 ? Now we will just do the same choosing “Restore” from “Software Download” opiton in QPST, with our new edited QCN file of course.


After you see “Memory Restore Completed” just reboot your manualy or with the “adb reboot” command from cmd.

You can use this method for almost every Chinese Qualcomm ( OnePlus owners sorry you can’t edit imei number, it’s encrypted ) + LG phones.

Your baseband including your imei number in it is fixed now, you are wellcome 🙂 See you in the next guide.

PS : Changing the imei number of your phone is ILLEGAL, do this steps to fix your lost original imei number or/and to fix your baseband ONLY !.

Ultimate Guide : Qualcomm Snapdragon imei and Baseband Repair / Fix – Part 1

Copyright © 2016 by All rights reserved.

Leave a Reply

Please Login to comment
56 Comment threads
151 Thread replies
Most reacted comment
Hottest comment thread
54 Comment authors
Recent comment authors
En Yeniler Eskiler Beğenilenler

oneplus 6t için yöntem var mı? cihazı rootladım, qcn yedeği tamam.fakat partionları sileceğim göremiyorum.


Unfortunately, in my MI 6 nothing has changed. After: dd if = / dev / zero of = / dev / block / sdf (x) dd if = / dev / zero of = / dev / block / sdf (x) dd if = / dev / zero of = / dev / block / sde (xx) and reboot IMEIs are still unchanged and the next steps do not change anything. Before this phone was repaired in the service. Service changed something on the board and I have uploaded the original drive. I wanted to upload TWRP and ROM Xiaomi… Read more »


Pocopohone için de bu uygulama ise yararmi


[spoiler]adb>adb shell tissot_sprout:/ $ su tissot_sprout:/ # ls -al /dev/block/platform/soc/7824900.sdhci/by-name total 0 drwxr-xr-x 2 root root 1020 1970-01-06 04:37 . drwxr-xr-x 4 root root 1100 1970-01-06 04:37 .. lrwxrwxrwx 1 root root 21 1970-01-06 04:37 DDR -> /dev/block/mmcblk0p16 lrwxrwxrwx 1 root root 21 1970-01-06 04:37 aboot -> /dev/block/mmcblk0p20 lrwxrwxrwx 1 root root 21 1970-01-06 04:37 abootbak -> /dev/block/mmcblk0p21 lrwxrwxrwx 1 root root 21 1970-01-06 04:37 apdp -> /dev/block/mmcblk0p45 lrwxrwxrwx 1 root root 21 1970-01-06 04:37 boot_a -> /dev/block/mmcblk0p22 lrwxrwxrwx 1 root root 21 1970-01-06 04:37 boot_b -> /dev/block/mmcblk0p23 lrwxrwxrwx 1 root root 21 1970-01-06 04:37 cmnlib -> /dev/block/mmcblk0p39 lrwxrwxrwx 1… Read more »


привет!!!!!!! помоги пожалуйста я не понимаю что не так! [spoiler title=”C:\Tools>adb shell adb server is out of date. killing… * daemon started successfully * tissot_sprout:/ $ su su tissot_sprout:/ # ls -al/dev/block/platform/soc/7824900.cdhci/by-name ls -al/dev/block/platform/soc/7824900.cdhci/by-name usage: ls –color[=auto] [-ACFHLRSZacdfhiklmnpqrstux1] [directory…] list files what to show: -a all files including .hidden -c use ctime for timestamps -d directory, not contents -i inode number -k block sizes in kilobytes -p put a ‘/’ after dir names -q unprintable chars as ‘?’ -s size (in blocks) -u use access time for timestamps -A list all files but . and .. -H follow command line… Read more »


Hello. Who can throw me a your QCN backup please. Phone MEIZU M6 note 3\32. I really need it.

Cihan Isik

Merhaba, tutorial icin cok sagol.

Redmi Note 5 Pro’da nedense IMEI bir türlü degismiyor. 3 bölmeyi sifirladiktan sonra reboot ediyorum, IMEI hala ayni orada duruyor, yani kendiliginden silmeden önceki forma dönüyor. Acaba Xiaomi de artik bir türlü koruma mi koydu? Bootloader acik bu arada.


Hi there,
Thanks for the tutorial. I’ve HTC Sensation (rooted, s-off, bootloader unlocked, stock kernel).
Unortunately I’m stuck at not being able to enable diag mode / open qualcomm ports on my phone.
I’ve tried with the adb shell command but after hitting enter nothing happens (the device it’s listed if I enter adb devices).
Could you please help me out?

Thanks a lot


plz add this imei..Redmi 5 plus

Electro FAN

Hi, can you help me please? I have Samsung sm-j510fn, MSM8916, TWRP 3.1.1, root, stock OS. Trying to change imei’s on it. First problem: I can’t wipe current imei’s. dd says “no space left on device” Here are my commands: [email protected]:/ # dd if=/dev/zero of=/dev/block/mmcblk0p14 dd: /dev/block/mmcblk0p14: No space left on device 6145+0 records in 6144+0 records out 3145728 bytes transferred in 0.548 secs (5740379 bytes/sec) 1|[email protected]:/ # dd if=/dev/zero of=/dev/block/mmcblk0p15 dd: /dev/block/mmcblk0p15: No space left on device 6145+0 records in 6144+0 records out 3145728 bytes transferred in 0.553 secs (5688477 bytes/sec) 1|[email protected]:/ # dd if=/dev/zero of=/dev/block/mmcblk0p9 dd: /dev/block/mmcblk0p9: No… Read more »


I have used twrp to reflash rom and could restore QCN. However, after finished, when I checked the phone using *#06#, the second MEID appeared (MEID1 and MEID2). MEID 2 is my original ID, MEID1 I guessed it belonged to the QCN file I downloaded. Also, the IMEI 1 is show 0, instead of what I modified. IMEI2 is ok.

Can I remove the wrong MEID and restore IMEI 1?

My phone is MI5s Capricorn.

Thank you


I finished all the steps before restore qcn file. However, when I was restoring, I received Error:

“Memory Restore Failed!”
“Received an invalid command from the phone”

Please help.

Percibal Camelot

Hello my name is Felipe, your guide seems very useful unfortunately I tried to used for my XIAOMI MI6 and I think a ruined, I followed all the instructions to recover my IMAI making sure the correct partitions of modemst1, modemst2 and fsg. to erase from /dev/block but when I rebooted the phone I dont have WIFI, IMAI or a way to recognize SIM CARDS, is there any way to recover partitions as I dont have backup for that I only have backup for the QCN file as your the article said.

I hope it can be fixed.


hey bro! i followed your guide very well but seems like my IMEI won’t stick? I did it like 5x already my IMEI still the same? my phone is a asus zenfone 3 deluxe edition its a snapdragon 820. so yeah it won’t stick if i restore it? is it possible if you send me your qcn of the phone you used here? thanks in advance.


I’m Guillermo, I’ve been reading your post about how to recover the IMEI.
I didn’t make a backup and I don’t have the qcn file. I was wondering if you could send it to me.
It is a coolpad cool 1 (C103).

When I look for the 08xA line, should I change the x for the first number of mi IMEI, or should I change for the number of the IMEI that was made the backup?

Thank you

Fi La

Does this way works for LG V20 (model Sprint LS977 or US996) ? Thanks


Is there revised version for 2017. Please thank you


Does it work on MIUI 9?


I cant find the line starting with 08xA in the QCN file, what can i do or which one should i choose?


What could be the command list for partition table of Redmi note 4x?
can you help me with that?