Restore IMEI of Xiaomi MI4C Without Another Phone


Question

In short: I have a Xiaomi Mi4c that shows has an "unknown" IMEI when checked via the settings in the stable and developer versions of MIUI and Cyanogenmod 13.1. However, when viewed through EFS professional or NV RF Manager, the IMEI is read correctly. Not having a "valid" (or any?) IMEI means I have a 5" wifi tablet, rather than a phone, which is something I've been trying to fix.



The long version:



The problems started right after I flashed CM 13.1, and I couldn't detect my sim card. Thinking it was my ROM, I reflashed my stock ROM and when that didn't solve the problem, I quickly deduced that the missing/unknown IMEI was the problem.



I finally got NV RF Manager working, and read all of the NV values from my phone. After finding the IMEI related value, I followed the odd schema for rearranging my IMEI and filled the boxes out and clicked "Write NV." However, I only received an error that read "Parameter is write-protected and thus read only." The same results were achieved with EFS professional. (Again, this was on CM) Now, I reflashed the stock ROM, and tried again. After rebooting the phone, I was able to read the correct IMEI values from the phone using both EFS professinoal and NV RF Manager, but the phone still showed baseband and IMEI as "unknown." Dialing *#06# causes the numbers to disappear, but nothing else happens.



So far, this is what I've tried:




  • NV RF Manager

  • EFS Professional

  • MTK Droid Tools

  • SP Flash Tools (Did not work at all, only for MTK chipsets?)

  • Apps like XPOSED IMEI Changer (Results in nothing changing)



There are a few related questions, but none of them work for me.



How to restore IMEI and get back network functionality?



Might work, but I have been unable to find the "modem" or nvram files on my phone. I also don't have an "efs" folder on my phone (that I can find.)



Mi4i full partition corrupted. Unable to restore EFS partition



Isn't jiving with me. The thought of uploading mi4i (rather than mi4c) specific files after removing my only remanents of my efs files seems like a bad idea to me.



How to restore the IMEI number on the Samsung Galaxy S4 I9505?



Is ROM specific, and since it doesn't work on multiple ROMs, I've ruled it out as related.



Again I have a Xiaomi Mi4C, the 32GB/3GB version with the Qualcomm MSM8992 Snapdragon 808 chipset.



Any help at all would be greatly appreciated, I've hit a wall fixing this problem.


Answer

This is what worked for me. I've documented everything in a GitHub repository, and have included some of the information here. However, I will not be updating this information, and I cannot upload the supporting files, making the GitHub repository the go to resource for many reasons. With that said, here is the excerpt:


Download files


I've attached a few files:



  1. mi4c.qcn: an IMEI backup from another phone

  2. QPST: the program for uploading the IMEI backup

  3. IMEI converter converts IMEI to hex


The IMEI converter is optional, but useful.


Root phone and enable USB debugging


Other people have already written this part up, and in the spirit of refactoring, I will link to them rather than repeating what they say.



  • Unlocking the Mi4c Bootloader without verification by Xiaomi

  • Root and install twrp recovery on Xiaomi mi4c

  • SuperSu install

  • Enable USB debugging


Setup other software



  • Here's a guide for how to install ADB and Fastboot.

  • You'll need a hex editor. Here's one, but there are many to choose from.


Enable diagnostics mode


Open up your command prompt and run


adb shell
su
setprop sys.usb.config diag

This enables the diagnostics mode on your phone, priming it for QPST


Check drivers


Go to "Device Manager" and check if your drivers are installed correctly. If they are not, try enabling unsigned drivers and reinstalling/updating the drivers for the phone.


Edit mi4c.qcn


Open up your hex editor and search for "08 5A 44 13 66 06 75 76 36"
Change this to your IMEI that you converted into hex with the IMEI converter attached.


Erase existing IMEI files


adb shell
su

dd if=/dev/block/mmcblk0p28 of=/sdcard/modemst1
dd if=/dev/block/mmcblk0p29 of=/sdcard/modemst2
dd if=/dev/block/mmcblk0p33 of=/sdcard/fsg

dd if=/dev/zero of=/dev/block/mmcblk0p28
dd if=/dev/zero of=/dev/block/mmcblk0p29
dd if=/dev/zero of=/dev/block/mmcblk0p33

reboot

This clears the way for the new files.


Repeat Enable diagnostics mode


Use QPST to update EFS


Install and run QPST. It should automatically detect your phone.



Click the "Start Clients" tab, then select Software Download



Select your modified qcn file and click start. It may reach 100% quickly, but it will still be working until the exit button is not greyed out.



Reboot phone


Celebrate! (Or retry if not successful, sometimes it takes a few tries to get it right)


Credit to http://www.miuitutorial.com/2016/10/imei-xiaomi-mi4c-kamu-hilang-jangan.html and Defforest@enMiuiForum


Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes