yashsingh1/xdaforums huggingface dataset:
[Galaxy S 4 General] Ahmed Alshaali:
i did format sys so my sensor back to not work well so i did try from start with

# echo 0 > /sys/devices/virtual/sensors/proximity_sensor/prox_cal

# echo 1 > /sys/devices/virtual/sensors/proximity_sensor/prox_cal

i did try 2-3 time i got nice value so i test it its work no need to manual only if u didnt get it work but give try its more faster do it 1-3
[Galaxy S 4 General] sud_ran:
Settings change after flashing new rom

Hi,

Do these settings stick forever, should we modify this every time we flash a new ROM/kernel?

Thanks,

Sud
[Galaxy S 4 General] Laurentiu27:
The method that worked for me

echo 0 > /sys/class/sensors/proximity_sensor/prox_cal

echo 1 > /sys/class/sensors/proximity_sensor/prox_cal

From this page

http://www.androidlegend.com/how-to-perform-proximity-sensor-calibration-on-any-samsung-phone/
[Galaxy S 4 General] azi43far:
Manual Method worked for me.

Thanks for resolving this long pending issue.
[Galaxy S 4 General] juancarlos2708:
Eegio, Could you tell me which Rom do you have?

Thx
[Galaxy S 4 General] azi43far:
The problem came back again. The manual method worked and the issue was no more for few days and again it is back.

Useless Samsung S4,i hate it after paying so much. I have been to service center twice to replace the sensor and still the problem keeps on repeating......
[Galaxy S 4 General] rpboronat:
I have put the solution blowing first the earphone and I have put a white adhesive in the earphone of my white S4 and all works perfect since 1 week ago. Dust introduces in the earphone again if you don't protect the earphone.

I have a friend that get out his broken screen and he said to me that in our S4, the earphone is not protected inside and that causes the problem with our sensor phones.

I expect to help all.

Enviado desde mi GT-I9505 mediante Tapatalk
[Galaxy S 4 General] rludlam1:
Proximity sensor Thank You

I tried all the posts and mcelicalderon's is the one that worked on my SGH-M919 t-mobile s4. Thanks to everybody who lead me in the right direction.

---------- Post added at 11:20 AM ---------- Previous post was at 11:12 AM ----------

This worked perfectly for me. I've been lurking in these forums for a while and this was so easy. Many,many THANKS.
[Galaxy S 4 General] Kriomag:
dirt is getting into the sensor and then sensor detects this dirt on the inside of glas covering it, when you disassemble sensor you can even see dirt particles on the inside, when you clean it it will work for few weeks maybe, then it gets dirty again! i know what i say, i had cleaned it several times until i made silicon (gpu thermopads) "frame" - i dont know how to put it into words :P so sensor is now covered around with soft silicon casing so no dirt can get inside. i have readings 11-12 in service menu now and it is not increasing like before :)

sensor is fine, it is not faulty, only the way they mounted it, withaou shielding from dust... S3 did not have this issue.
[Galaxy S 4 General] Skipjacks:
I cleaned mine about 2 months ago now and the dirt hasn't come back for me. I have assumed from the beginning that I'm just getting lucky about that. I also looked at creating a little gasket to put in there but the darned thing is just so small. Looked like a nightmare.

There is a gasket that comes on the phone from the factory, but it's crappy.

For anyone else having this issue, here's a cleaning guide to show you how to clean that sensor.

http://xdaforums.com/showthread.php?t=2684507
[Galaxy S 4 General] TIM13:
Many thanks for your kind help.

But some of us do not have time to follow and type all that scripts and try to re-arrange findings. Do you have a zip data like we can flash from recovery to correct all that problems or we have to just type all that scripts one by one from our phone.
[Galaxy S 4 General] moonlight of:
Manually method work for me too
[Galaxy S 4 General] rpboronat:
I have cleaned the sensor dismounting the the phone, and assured the sensor with soft silicon and since three days I have no problems. I know it is soon, but it works. It's too easy to dismount the phone. I didn't do it never and I recommend to do it.

Enviado desde mi GT-I9505 mediante Tapatalk
[Galaxy S 4 General] pranit04:
for i9500

my offset values are 0,60,45

& normal state is 255

i got hex value FF

but it didnt work for me

please help:rolleyes::rolleyes::rolleyes:
[Galaxy S 4 General] Skipjacks:
You need to clean the sensor. See my post 3 posts up. Has a link to a full guide on how to do it.

Sent from your phone. You should be more careful where you leave that thing.
[Galaxy S 4 General] lukas77:
Automatic method worked. Thank you

| Tapatalk | Samsung Galaxy S4 | GT-i9505 |
[Galaxy S 4 General] OmegaBlaze:
I have a note 3.

My offset and normal value is both 0.

Which means my hexidecimal would be 0.

Will the manual method still work for me? :crying:
[Galaxy S 4 General] BBAHunter:
I think that is wrong, think about what is being said here: The sensor calibration is a permanent fix.

The real issue is sensor cal data is wiped out when the phone is updated. Think about it: everything is working fine, then a firmware update is done and boom you have a sensor calibration problem.

I am not saying that dust is not present, but by your logic, magically, after an update, dirt suddenly and instantly covers the sensor to the point it detects face proximity. I'm not buying that. I think a better solution is to preserve cal data before flashing or make a routine to calibrate after the flash.
[Galaxy S 4 General] Skipjacks:
Its a coincidence. If you flash a lot of updates it greatly increases the chances that you will notice a problem after an update.

This is a well known and well documented design flaw. Its a dust issue.

Sent from your phone. You should be more careful where you leave that thing.
[Galaxy S 4 General] maxov777:
I am using the CM based rom and i have the issue with the proximity sensor .. i think that this thing is only in these CM roms ?

[ROM] KVT49L [AOSP] 【4.4.2】Dan&Ktoonsez 【CM Edition】 - Stables only! - May 31, 2014

btw great rom but ..

I would really like to follow up your manual and to calibrate my sensor .. but when i run any calibration apk , it gets stuck at the first reading of the sensor .. so i assume that the issue is not in the malfunction of the sensor , or dirt , but in the software ..
[Galaxy S 4 General] Kriomag:
lol

you guys that still think its a software problem... happy painful experience with every rom reinstall calibration...

i cleaned it once, shielded it with silicone, and now i dont have this problem and it wont come back.

i have readings in test menu ADC 11-12 and it is not going up on its own.
[Galaxy S 4 General] nick.real78:
manual method

Manual method worked perfectly!

thanks a lot.... :):)

was worried as i couldnt send my phone in for warranty cause tripped knox (0x1).....
[Galaxy S 4 General] louayd:
Hey thanks, I was wondering how can I cancel the sensor altogether because my screen is cracked and I don't believe this will fix it. Thanks
[Galaxy S 4 General] vwlshrtg:
+1 for clearing out the dust. Seemed too ridiculous to be true but I'll be darned if it didn't clear the issue up immediately on my S4 GPE.

Thanks.
[Galaxy S 4 General] Makecba:
Manual method worked like a charm, my sensor worked properly but when it activated it remained stuck. Now, it only activates when there is something next to it.

I can't begin to thank you enough :good:
[Galaxy S 4 General] KingP1n:
Thanks fixed mine as well using manual method on DN3 v5
[Galaxy S 4 General] BBAHunter:
I just noticed, I think some have had fixes pushed (at least for M919 from MetroPCS). Now there is no reason to manually set calibration (thankfully). I was so tempted to root this thing to set the sensitivity I almost rooted it except for one reason: I sometimes have to use it for BYOD connection and where I work, we use knox detection.
[Galaxy S 4 General] breaker12:
Manual method worked perfectly fine. You SAVED my LIFE! Tons of thanks from the Philippines! :)
[Galaxy S 4 General] glynnpel:
Thanks to OP ,works like a charm manual calib.
[Galaxy S 4 General] pesaroso:
I've been looking for a thread like this for a long time, but something weird is happening to me.

My problem stays unchanged; When I put my phone to my ear during a call, the screen turns off. However, when I move the phone away from my ear, it's still turned off, it won't turn on again.

Since my phone started vibrating continuously when I clicked the "sensor" button in the Samsung menu, I did the manual thing. My values were 0, 60, 45 on the first, and 64 on the second. I added 0 and 64, and in hex it was 40, correct?

Now when I enter the "sensor" category, it's not vibrating, but as soon as I hover my finger over the sensor, it will vibrate continuously, even after I move my finger.

I've noticed something, though; If I swipe my finger across the "frame" above the Samsung logo where you put your ear, it will turn the screen on again, and the sensor responds normally.. Maybe a dust problem? Weird that this method half fixed it, though.

Thanks a lot!

EDIT: Lol, I just blew really hard on the earpiece, and it's working perfectly! I guess it's a good mix of calibration and good old fashion pocket lint :)
[Galaxy S 4 General] Solace50:
what apk is responsible for the tests. i enabled factory mode to allow ussd codes but it fails to launch anything, i would assume this is due to me removing some apk files from goldeneyes rom of which i recall removed some test apks related to this. its rare but sometimes the proximity sensor fails to activate in a reasonable time frame, not sure if its due to the battery % and the profiles i have set up or if its just due to not being calibrated properly.
[Galaxy S 4 General] gunnermike:
I am on Verizon. I have hidden menus enabled and some codes work but *#0*# doesnt get me anythig. Any ideas?
[Galaxy S 4 General] jlechner:
This worked for me, thanks, but it only lasted a little while.

For those with continuous problems, I finally just followed a YouTube video to disassemble the phone. Don't have to do all of it, just the back plate and the main board. After that there is a clip holding the prox and ir board. Pull that out, blow air in the hole and on the prox sensor. All good now. It's very easy. Took about 15 mins.
[Galaxy S 4 General] jjlwork:
Not always a hardware issue

I noticed a lot of posts that say this is not a fix and that it only because their sensor is dirty. This is not always the case.

In my circumstances I bought a zerolemon - zeroshock case. It is similar to an otterbox defender in that it has the plastic screen protector built in. This threw off my proximity sensor even though there is a cutout for it. I confirmed this by removing the case and the sensor works properly.

I followed the directions in the OP to re-calibrate the sensor and it worked great. Thanks to those who figured this out, I really didn't want to have to return the case as I really like it. They should do better research into materials that meet the OEM specs though as this would suck for the folks who buy this case and don't have root or the technical aptitude to apply this fix.
[Galaxy S 4 General] f10a:
Did the manual method in the OP but it did not fix my prox sensor from being/continuously vibrating when in the test mode. Phone is only a few months old and was working.

Any other solutions?
[Galaxy S 4 General] Skipjacks:
Take it apart and clean the sensor. It has dust in it.

It is not a hard thing to do. Just be careful.
[Galaxy S 4 General] hawkerpaul:
Just a note.

When you want to find the "normal" state by issuing the following command, :

cat /sys/devices/virtual/sensors/proximity_sensor/state

make sure you do not have anything near the proximity sensor at the top of the device

One question about the following command:

echo -en $ '\x45' > /efs/prox_cal

I'm not sure whether or not there should be a space between the $ and the '

Can someone please confirm

Thanks
[Galaxy S 4 General] ThePurpleK:
I did it according to OP, which was with a space. It worked!

I'm running CyanogenMod M8 (jflte) on a Samsung Galaxy S4 i9505.
[Galaxy S 4 General] THankYOuGUys:
Thank you

Thanks OP and others! My gf's S4 prox sensor would not turn off once activated.

Neither of these recalibration fixes worked but the info was helpful. (phone is not rooted bc last time I came here looking to root, at&t had just updated and a work around wasn't figured out yet)

DIsassembled the phone and blew out the prox senor and cleaned area with a q-tip.

Phone works great now.
[Galaxy S 4 General] vageek:
Worked like a champ! Many thanks! I tried another method months ago that looked very similar to this, but after a dozen tries and iterations I gave up. Finally working well! :good:
[Galaxy S 4 General] brandogg:
Huge thanks for this topic. Oddly enough the second manual method did not work, but the first manual method (with the two echo commands) did.
[Galaxy S 4 General] Achal1012:
Awesome post man ! This totally works ... Thumbs up (y)

PS: i used the second method ! :))
[Galaxy S 4 General] burimi007:
when i press *#0*# nothing happens,i have a problem when i end my calls screen wont wake unless i press power button?
[Galaxy S 4 General] omewillem:
offset = 0

Ooops i posted in wrong topic also but this is the right one:

hi all,

, i'm trying to fix my note 3 and proximity problem.

during test all is green and vibrating constantly.

default nr is approx:120.

it responses to 1000+ when i come near,

i looked up cat /sys/devices/virtual/sensors/proximity_sensor/prox_cal

and my values are

0 / 120 / 80

normal state 129

should i add 0 + 129 = 129 HEX = 81 as new value

or is there another problem with the 0 as offset nr.?

regards, wilem
[Galaxy S 4 General] keky89:
I tried vacuming my spearker it didnt help at all. Then tried this recalibration thing and now it works perfectly fine!!!

thanks for this, saved my life :victory::victory::victory::victory::victory::victory:
[Galaxy S 4 General] mattgb:
Cleaning sensor worked for me!

Thanks so much for the *#0*# command :D. I discovered by chance that shining a bright bench lamp into the sensor did actually shut off the proximity sensor (*#0*# > Sensors, screen goes from green and vibrating to white and no vibrate).

I then opened the phone and lifted proximity sensor (youtube video: JteGDhl-oXQ) and found dust on the back of the screen in front of the sensor. Cleaned it with a cotton tip and hey presto - screen only blank when there's a dark shadow over the sensor.

Fyi, the similar shaped sensor on the left of the ear piece is measuring lux and when casting a shadow equally over both sensors (lux and prox) the proximity sensor activates at about 20 lux and below.
[Galaxy S 4 General] khudko83:
i9100 proximity sensor doesn't work

Hi to all! I have the issue with proximity sensor and didn't manage to find a solution in other similar threads!

The matter is that it is always stay as Released.

In the same time in test screen (*#0*#) there are changing reading for PROXIMITY parameter from 2 up to 240 with no ADC parameter at all. Please look for screenshots. PROXIMITY parameter changes its value when I move my finger in front of the sensor, but as I can understand Android doesn't recognize it because of ADC absence.

Moreover I tried to change proximity sensor for working one (from another phone), but it shows the same as mine (with no ADC readings).

After all I think it is software problem, but I don't know how to solve it. I flashed different firmwares (now it is XWMSE NeatROM v.6.4), but nothing helped.

Please assist! Thanks!
[Galaxy S 4 General] Skipjacks:
Please only post your questions in 1 thread. Not 3. Thank you.
[Galaxy S 4 General] khudko83:
Sorry for that.
[Galaxy S 4 General] brandon7gr:
I had problem with my Note 2 regarding the proximity sensor...I followed all the instructions and now everything is working just great!!

Thanks so much for this useful thread :)
[Galaxy S 4 General] haryp2309:
I need help

My first offset value is 0, and my normal value is also 0

So should I enter "# echo -en'\x45' > /efs/prox_cal"?
[Galaxy S 4 General] BEERviper:
I wanted to post and say THANK YOU! This worked like a charm and appears much easier than the manual method that most everyone had used due to what seems like the exact issue you pointed out here that the echo 0 & 1 into prox_cal is lost after reboot unless you change the permissions!

I am sooooooooo happy to have my screen turn back when I pull away from my ear while on a call!!!
[Galaxy S 4 General] lamero1:
Try this app. It makes the work for you
[Galaxy S 4 General] joe.sebin:
u made my day....
[Galaxy S 4 General] red.Wood:
I freaking lova XDA. Thank you so much for this, manual method worked for me, I used what the OP used 45, as my values were 0 and 65 (duh). Even the samsung repair center said they needed to change the screen and it wasn't covered.
[Galaxy S 4 General] CN@:
I have such problem in lollipop. Any idea???
[Galaxy S 4 General] Greencrow:
It's normal for lollipop version when we call screen turns off. :)
[Galaxy S 4 General] d_c_foster:
Thanks for the info. Worked great on my S4!
[Galaxy S 4 General] chashmaa:
In mymy s4 gt i9505 have no any response while *#0*#.so can't check touchdowns.
[Galaxy S 4 General] knuckles1978:
Dialer codes only work on stock ROMs AFAIK.
[Galaxy S 4 General] nkolsen:
Method 1 worked like a charm. Thanks for very useful tips.
[Galaxy S 4 General] jlechner:
Hey guys, this app works for me.

https://play.google.com/store/apps/details?id=com.vrognaas.proximityfix
[Galaxy S 4 General] Pratz852:
Edit:Wrong forum:
[Galaxy S 4 General] h4haideralii:
Thanks very much .. Method 2 solved my problem :D thanks again :good:
[Galaxy S 4 General] Samsungmobile:
This still happens to my phone it drives me crazy.. the screen will bank out before putting the phone anyplace near your face.

I tried the auto cal and it did not work so I'm confused on where you find the hex info at?
[Galaxy S 4 General] Samsungmobile:
This worked for me too! Thanks!
[Galaxy S 4 General] fuser1337:
Manual Method worked for me. Thank you very much :)
[Galaxy S 4 General] G@laxy:
Manual method worked for me too...Thanks you very much...Galaxy S4 GT-I9505 with Imperium LL Rom v9.0 installed!
[Galaxy S 4 General] irvinehooi:
Great. This thread has solved my long time proximity issue. I just put the below lines to my device init.d folder and everything works like charm.

echo 0 > /sys/devices/virtual/sensors/proximity_sensor/prox_cal

echo 1 > /sys/devices/virtual/sensors/proximity_sensor/prox_cal

Thanks.
[Galaxy S 4 General] Pulseuser:
Check out "Proximity Fix"

https://play.google.com/store/apps/details?id=com.vrognaas.proximityfix

This seemed to work for me.
[Galaxy S 4 General] alhaseeri:
can someone please help me

I'm trying to re-calibrate my sensor by manual method

but don't know how to convert the values in Hexadecimal.

mine offset value is :

76,196,156

& the normal value is :

0

so how to add offset value + normal value ???!!!

because the normal value is : 0
[Galaxy S 4 General] alhaseeri:
plz someone reply on my issue.
[Galaxy S 4 General] rimirao:
When I first installed CM this method solved my problem but then I get back to my stock ROM then again to CM...but this time this method ain't working for me.plz help

My values are

0,65,45

And normal is 83
[Galaxy S 4 General] n00b4uM:
Great!

Thank you very much for this! Manual method worked for me!

I've tried a lot of cyanogenmod 12.1 ROMs, always getting this annoying trouble.

Just for reference, my galaxy note 2 (N7100) got offset value "0" and normal state value "15".

0 + 15 = 15 decimal = F hexadecimal

P.S.: when I've used uppercase "F" the command didn't worked, got to use it in lowercase.

Thanks again bro! :D
[Galaxy S 4 General] Ammar Saood:
You can use windows calculator to convert decimal into Hex.

Just do the following, Already replied to your private message. Already converted your offset into hex for you. just type as it is.

su

# echo -en $ '\x4c' > /efs/prox_cal

# chown system:system /efs/prox_cal

# chmod 644 /efs/prox_cal

# sync

# Reboot
[Galaxy S 4 General] flroots:
My S4 experienced the problem of screen going blank during a call and never returning. It was definitely caused by faulty proximity sensor. The manual method of OP fixed half of the problem. Now screen stays on when making a call until proximity sensor triggered. The problem is that when proximity sensor cleared, the screen never returns. A double push on power button does return the screen. Has anyone experienced this particular problem? BTW, we have a 2nd S4 (M919) and it works fine meaning that screen comes and goes as proximity sensor triggered and cleared.

Update: this app completely solved the problem. Now proximity sensor is reversible meaning that screen goes blank and returns when proximity sensor triggered and cleared:

https://play.google.com/store/apps/details?id=com.vrognaas.proximityfix​
[Galaxy S 4 General] jinesh83:
The manual method worked for me! Thanks!
[Galaxy S 4 General] Marcottt:
manual method is the only real solution

Inviato dal mio GT-I9505 utilizzando Tapatalk
[Galaxy S 4 General] freakingprime:
If your offset > 20, your sensor is heavily covered with dust. It'll keep getting it because the phone is not perfectly sealed. The problem will soon be returned.

My method is open up the phone and clear the front speaker area from inside. Offset become low now.
[Galaxy S 4 General] I9105P:
Hello guys,

I tried to follow these instructions for my Samsung Galaxy S 2 Plus (I9105P) with Cyanogenmod 12.1.

BUT: when I tipe to the terminal the "cat .../prox_cal" it only returns TWO values which are "0,0"

And the command "cat .../state" doesn't give me any return AT ALL...

When I press enter it only jumps to the next line to give a new command..

Could it be that the proximity sensor is broken in that way that I don't get three values?

My screen in front of the sensor is broken so when I call I cannot hang up because my screen won't turn on, as the sensor thinks theres something close.
[Galaxy S 4 General] Claus1963:
works perfect. Thank you so much. Claus from Germany
[Galaxy S 4 General] valiboy87:
FIX

Hello, the solution it's very easy, just instal Proximity sensor reset from App Store, works great after restart ! ;)
[Galaxy S 4 General] aphioner:
Thanks

I've seen many tutorial that are wortless. Dude, yours is totally not not one of 'em and it really really works.

Thanks for this fix.
[Galaxy S 4 General] syrian_condor:
thank you that's worked for me...galaxy mega 6.3
[Galaxy S 4 General] irvinehooi:
Hi mate, just want to check with you. Do you need to re-run the app every time you restart your device ?

Thanks in advance.
[Galaxy S 4 General] irvinehooi:
I tested the app to my device. It is permanent fixed. No need to re-run the after restart. ? ?

Thanks.
[Galaxy S 4 General] dee143:
cant callibrate

my offset value and state values are both 0 & 0. and thses commands are not working in my galaxy A8 phone. so plzzz help me what to do now.
[Galaxy S 4 General] irvinehooi:
Hi mate, are you having the proximity sensor issue with your Galaxy A8 ? If your A8 is still under warranty then it is advisable that you claim your warranty at your nearest Samsung service center.
[Galaxy S 4 General] dee143:
I don't have warranty. My phone is rooted.so please give me some idea how to fix it.it's very annoying during call operation. Thanks..
[Galaxy S 4 General] Der-Knuffi:
Did you try "proximity sensor fix" from play store?

Gesendet von meinem SM-T530 mit Tapatalk
[Galaxy S 4 General] dee143:
Yes I tried that apps but still it is not calibrated.

Whether it is a hardware issue or soft bug. earlier I had fixed this bug by just running the script but not working this time. And what does it mean 0 offset and 0 state value.
[Galaxy S 4 General] goldybewon:
~~~Delete~~~
[Galaxy S 4 General] taoufiqlak:
Hello, did not work with my S5, I did it first time and the sensor working fine until I put my hand near to it it turns off ( normal ) but when I take my hande away the screen is stuck in black. I did the whole things again but this time it does not work at all.