• Introducing XDA Computing: Discussion zones for Hardware, Software, and more!    Check it out!

Question [PROBLEM] Proximity sensor (vayu)

Search This thread

Guzior2137

Member
Oct 26, 2021
8
0
Xiaomi Poco X3 Pro
Hi there.
After flashing some custom roms (lineage and Arrow, both for like 5 minutes xD) (from zip files via Orange Fox), I wanted to go back to MIUI (don't ask xD).
After flashing a stock rom via miflash, I started getting errors about device storage being corrupted, the device being unsafe and my sensors stopped working (like all of them, proximity, light, gyroscope, etc.)
THIS I FIGURED OUT:
I figured that my persist partition is broken and I restored it from persistbak. (dd if=/dev/block/mmcblk0p%% of=/dev/block/mmcblk0p$$)
But even after doing so, my proximity sensor does not work.
Moreover, it does not work in the most annoying way: In CIT it shows as permanent 0.0 no matter if sth is close to it or not. So whenever I light up the screen I get the message about not covering the earphone area(the one you can override by pressing vol +) and my screen is PERMANENT OFF during calls which does not let me use speakerphone, mute microphone, etc. Does anyone have any idea on how to fix it? Yes, I've seen the post with the tasker solution that disables the sensor in "screen permanent on" mode. It does not satisfy me (I'd much rather have a fully functional phone), will try that if nothing else works. Also, the phone is under warranty, I pray to God for if I maybe flash back stock, lock the bootloader and say to them "my proximity sensor does not work" they'd fix it under warranty. Or maybe someone knows which part of software is responsible for the proximity sensor and is able to provide a dump for me?
 
Last edited:

gringo80

Senior Member
Jun 8, 2018
671
625
You f....up your "persist" partition !

If you haven't already did a backup with TWRP, then there is only one solution !

This is how to restore it :

- download the latest .tar and .zip firmware (the same version+++) from here ... according to "your phone region" [mandatory]
- don't choose an old version : always the latest one, don't mix the numbers
- don't use xiaomi.eu in any case
- extract persist.img from .tar
- you need to flash it with TWRP/OF (use my twrp.zip)... yes this will reset the whole "persist" partition.
- flash now the whole MIUI firmware .zip in TWRP/OF
- flashing .tar in MiFlash Tool is bugged and a high risky business
- format /data (type yes)
- reboot to fastboot from TWRP/OF
- extract stock recovery.img from .tar +++
- flash it :

fastboot flash recovery recovery.img

- you need now to lock the bootloader to restore the original state of your phone, and this is the only way to rewrite again "persist" partition from scratch by the bootloader !

type :

fastboot oem lock
fastboot reboot


- Later you can still restore your DRM Keys again in MIUI ... don't worry about them !

See you
 

Attachments

  • persist-twrp-reset.zip
    173.7 KB · Views: 17
Last edited:

Lu5ck

Senior Member
Dec 18, 2013
257
69
Restore stock using fastboot files through miflash. The fastboot files should contain everything and therefore restore everything.

 

gringo80

Senior Member
Jun 8, 2018
671
625
Restore stock using fastboot files through miflash. The fastboot files should contain everything and therefore restore everything.

You are misleading this guy ....
Restoring persist partition doesn't work like that.
It is always ignored by default in the bat/sh scripts... and can't be flashed through fastboot !!!

Furthermore, as i said, MiFlash Tool is bugged and he can hard brick his device +++

Don't say things that you don't understand. very well !!!
 
  • Like
Reactions: i_sagnik

Guzior2137

Member
Oct 26, 2021
8
0
Xiaomi Poco X3 Pro
You f....up your "persist" partition !

If you haven't already did a backup with TWRP, then there is only one solution !

This is how to restore it :

- download the latest .tar and .zip firmware (the same version+++) from here ... according to "your phone region" [mandatory]
- don't choose an old version : always the latest one, don't mix the numbers
- don't use xiaomi.eu in any case
- extract persist.img from .tar
- you need to flash it with TWRP/OF ... yes this will reset the whole "persist" partition.
- flash now the .zip firmware in TWRP/OF
- flashing .tar in MiFlash Tool is bugged and a high risky business
- format /data (type yes)
- reboot to fastboot from TWRP/OF
- extract recovery.img from .tar
- flash it :
fastboot flash recovery recovery.img

- you need now to lock the bootloader to restore the original state of your phone, and this is the only way to rewrite again "persist" partition from scratch by the bootloader !

type :
fastboot oem lock
fastboot reboot

- Later you can still restore you DRM Keys again in MIUI ... don't worry about them !

I will post later the zip to flash persist.img with TWRP/OF ... as i'm now in the bed.

Don't take any action now by yourself ... just wait for tomorrow !

See you
Dunno who you are or where you live but if your solution works, I owe you a beer. You're my savior! XD I'm at work now, will try your solutions in the evening/on the weekend
 
Last edited:

Lu5ck

Senior Member
Dec 18, 2013
257
69
You are misleading this guy ....
Restoring persist partition doesn't work like that.
It is always ignored by default in the bat/sh scripts... and can't be flashed through fastboot !!!

Furthermore, as i said, MiFlash Tool is bugged and he can hard brick his device +++

Don't say things that you don't understand. very well !!!

My bad.
You are right that the .bat file does not contain commandline to flash persist despite the img being in the file.
I just downloaded to check.

On the other hand, miflash is just a one click fastboot UI to flash base on commands indicated in the .bat files so I don't know why your instructions imply it can flash things like recovery can.

@Guzior2137
With that said, OP would need to flash the persist.img to persist partition. Given that despite the .img is in the fastboot zip but not in the .bat command can only suggest that the fastboot does not accept "fastboot flash persist persist.img" which means you will need a recovery that can do that. I would recommend using orangefox to do that as orangefox is tailored for xiaomi devices and on a bonus side, it doesn't get replaced during official MIUI ota like others do.
 

gringo80

Senior Member
Jun 8, 2018
671
625
Dunno who you are or where you live but if your solution works, I owe you a beer. You're my savior! XD I'm at work now, will try your solutions in the evening/on the weekend
(.zip) added : extract and put persist.img in firmware-update forlder and re-zip again.

- read carefully the guide up
- don't skip any step / add extra-step
- don't use MiFlash Tool
- don't flash xiaomi.eu
 
  • Like
Reactions: i_sagnik

Guzior2137

Member
Oct 26, 2021
8
0
Xiaomi Poco X3 Pro
You f....up your "persist" partition !

If you haven't already did a backup with TWRP, then there is only one solution !

This is how to restore it :

- download the latest .tar and .zip firmware (the same version+++) from here ... according to "your phone region" [mandatory]
- don't choose an old version : always the latest one, don't mix the numbers
- don't use xiaomi.eu in any case
- extract persist.img from .tar
- you need to flash it with TWRP/OF (use my twrp.zip)... yes this will reset the whole "persist" partition.
- flash now the whole MIUI firmware .zip in TWRP/OF
- flashing .tar in MiFlash Tool is bugged and a high risky business
- format /data (type yes)
- reboot to fastboot from TWRP/OF
- extract stock recovery.img from .tar +++
- flash it :

fastboot flash recovery recovery.img

- you need now to lock the bootloader to restore the original state of your phone, and this is the only way to rewrite again "persist" partition from scratch by the bootloader !

type :

fastboot oem lock
fastboot reboot


- Later you can still restore your DRM Keys again in MIUI ... don't worry about them !

See you
Wait. Could you please explain to me: what is the file you attached used for? Is it TWRP? if I then have already OF installed, no need to use it?
 

gringo80

Senior Member
Jun 8, 2018
671
625
Wait. Could you please explain to me: what is the file you attached used for? Is it TWRP? if I then have already OF installed, no need to use it?
it's a flashable zip :
. open it
. put persist.img in fimware-update folder
. rezip and flash
. then flash your miui firmware in twrp
. format /data
...
 

Guzior2137

Member
Oct 26, 2021
8
0
Xiaomi Poco X3 Pro
Crap. Once again, just to confirm: I should:
-put the persist.img in the empty folder firmware-update of your persist-twrp-reset.zip
-flash your zip that I just modified using OF
-flash the zip I downloaded from xiaomifirmwareupdater.com using OF
-format /data in OF (type yes)
-extract stock recovery.img from .tar +++
- flash it : fastboot flash recovery recovery.img
-lock bootloader: fastboot oem lock fastboot reboot
Right? (sorry, better to confirm a dozen times and not screw anything up I think xD)
 

gringo80

Senior Member
Jun 8, 2018
671
625
- use fastboot to flash the recovery.img and not TWRP/OF
- fastboot oem lock
- fastboot reboot
 

gringo80

Senior Member
Jun 8, 2018
671
625

Attachments

  • Mi-Poco-X3-Screen-Protector-9H-Full-Glue-Black-iM-2.jpg
    Mi-Poco-X3-Screen-Protector-9H-Full-Glue-Black-iM-2.jpg
    84.3 KB · Views: 18

Guzior2137

Member
Oct 26, 2021
8
0
Xiaomi Poco X3 Pro
Nope. Stock plastic screen protector that was applied from the factory when I got the phone in September. Worked just fine until now. Also, if I point another phone's camera at the earpiece, I can see the blinking infrared LED while I run the proximity sensor test in CIT, which leads me to think that hardware is ok...
 

gringo80

Senior Member
Jun 8, 2018
671
625
If the sensor is red and blinking ... that means it works +++

Now, run a proximity test in Device Info HW
 

Attachments

  • Screenshot_20211127-134357_Device_Info_HW.png
    Screenshot_20211127-134357_Device_Info_HW.png
    97.5 KB · Views: 32
Last edited:

gringo80

Senior Member
Jun 8, 2018
671
625
You should know that the proximity sensor works only when the earpiece is used in phone call ... when you switch to the speaker, the sensor goes off.

That's normal !
 

Guzior2137

Member
Oct 26, 2021
8
0
Xiaomi Poco X3 Pro
I think I'll turn the phone up for a warranty fix. But then, so that they don't know like RIGHT AWAY that the phone's been tampered with, do you know a way for it to pass safetynet test? It currently errors out at CTS profile. I've heard that installing this from link: https://github.com/kdrag0n/safetynet-fix/releases/tag/v1.0.2 via magisk and turning magisk hide on will fix the problem. But then the phone will be rooted which also obviously means it's been played with. Gringo80, any suggestions?
 

ServOKio

Member
Jul 27, 2021
10
0
You will laugh, but at first all the sensors stopped working for me too. I flashed persist and they worked, but the proximity sensor always showed zero, and now it always shows the maximum.



I can't figure out what's going on. Yes, the sensor works, where in 1 case out of 100 it shows 0 instead of 5, but even through the service menu I can't calibrate it, it just always shows 5
...to pass safetynet test? It currently errors out at CTS profile. I've heard that installi...
I have the same problem. I've tried installing different firmware, modules, instructions, but I get this.
Screenshot_20211223-051110_Magisk.png
 
Last edited:

Top Liked Posts

  • There are no posts matching your filters.
  • 1
    Restore stock using fastboot files through miflash. The fastboot files should contain everything and therefore restore everything.

    You are misleading this guy ....
    Restoring persist partition doesn't work like that.
    It is always ignored by default in the bat/sh scripts... and can't be flashed through fastboot !!!

    Furthermore, as i said, MiFlash Tool is bugged and he can hard brick his device +++

    Don't say things that you don't understand. very well !!!
    1
    Dunno who you are or where you live but if your solution works, I owe you a beer. You're my savior! XD I'm at work now, will try your solutions in the evening/on the weekend
    (.zip) added : extract and put persist.img in firmware-update forlder and re-zip again.

    - read carefully the guide up
    - don't skip any step / add extra-step
    - don't use MiFlash Tool
    - don't flash xiaomi.eu