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 !.
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 androidbrick.com. All rights reserved.