If you face this problem, follow the tutorial below to solve it.
Even though the process work flawlessly,
I’m not responsible for whatever happens to your device after using this process.
Do this at your own risk!!
Download and install adb-fastboot setup from here (install this package system wide).
Download and install Qualcomm drivers from here.
Download and install Notepad++ from here
Download the latest version of firmware for the xiaomi device you want to fix.
Extract the firmware .tar file with the help of 7zip or winrar.
Open the folder images found inside the extracted content.
Locate rawprogram0.xml and open with notepad++.
Find the line with persist.img.
Delete all other lines leaving only the lines with persist.img and <data> </data> tags.
save and exit.
Now open flashall.bat file using notepad++.
Before the line fastboot reboot, add
fastboot %* flash persist %~dp0images\persist.img || @echo “Flash persist error” && exit /B 1
Now delete all other lines except the first 3 lines and fastboot %* reboot.
save and exit.
The video above shows how to edit both files easily.
Boot device into fastboot mode by holding volume down + power key.
Open command prompt and then type in fastboot oem edl.
Phone will turn off and boot into edl mode.
You can also force boot phone into edl mode using test points.
Launch Xiaomi flashtool
Click on select button
Navigate and select folder of extracted firmware.
Click refresh and device will be detected.
Now click flash and wait for for process to complete. (takes about 10 secs)
Hold power button for at least 12 seconds for phone to boot.
All sensors (fingerprint, gyro, infra red, etc) with WiFi and Blutooth will be working perfectly.
If you like to share your sensor fix file to help others, just package the following files in the edited firmware folder.