FORUMS
Remove All Ads from XDA

Proximity sensor fix on CM based ROM

189 posts
Thanks Meter: 76
 
By likesatan, Senior Member on 9th January 2015, 09:00 AM
Post Reply Email Thread
Proximity sensor fix for CM based ROM



/* Info */

This thread is made to avoid speaking about this subject under devs threads. To save their time.

In this thread your going to find a step by steps way to fix Proximity sensor on our devices.
I'm working over a flashable .zip to automate process.

/* Disclaimer */

I am not responsible for bricked devices, dead SD cards,
thermonuclear war, or you getting fired because the alarm app failed.
YOU are choosing to make these modifications, and if
you point the finger at me for messing up your device, I will laugh at you. Hard. A lot.

/* Supported device */

Galaxy S4 LTE + International (GT-I9506, ks01lte) : working.
HLTE : working.
Basically I think all the ROMs based over Cyanogenmod for Samsungs devices.


/* What you need to know */

This is only tested on
- KS01LTE on CM12 from Arter97 and CM11 of Solk2.
- HLTE based on CM12 version of temasek.
Other variants, other OS may not be fully compatible

/* Thanks to */

All devs who are working for our device. @arter97 @solk2 @temasek @DeHAWK @jonte28 @budda1996 @Genie's
The Cyanogenmod team.

@hilefin who gave me the way to fix proximity sensor and helped me in first step.


/* Downloads */

Coming in the close future.


Created 2015-01-09
Last Updated 2015-01-09


XDA:DevDB Information
Proximity sensor fix for CM based ROM, Tool/Utility for the Samsung Galaxy S 4

Contributors
likesatan

Version Information
Status: Testing

Created 2015-01-13
Last Updated 2015-01-14
The Following 5 Users Say Thank You to likesatan For This Useful Post: [ View ] Gift likesatan Ad-Free
 
 
9th January 2015, 09:00 AM |#2  
OP Senior Member
Flag Paris
Thanks Meter: 76
 
More
Step by steps method
/*Requirement*/

TWRP or CWM recovery.
Terminal app (Go google play) with super user rights.

/*Backup*/

Reboot into recovery mod and save your EFS partition and nothing else.
It will save you time in case of troubles.

/*Step by steps way*/

1.
Go to "Google Play" download "Terminal".
Grant super user rights to Terminal app.
Open new terminal session.

2.
Type "/system/xbin/su -l"

3.
Type cd /sys/devices/virtual/sensors/proximity_sensor/

4.
With the proximity sensor uncovered.
Type "cat state" and write down the value (74 in my case).

5.
Type "cat prox_cal"
Write down the first value between parenthesis (this is the offset).
Eg. (0,31,75) take 0.

6.
Sum both values.
In my case it was (74+0) = 74.

7.
Convert the value to hex. Link.
In my case, 74(dec)=4A(hex).

8.
Instead of 4A, put your value.
Type "echo -en $'\x4A' > /efs/prox_cal"

9.
Type "chown system:system /efs/prox_cal"

10.
Type "chmod 644 /efs/prox_cal"

11.
Type "sync"

12.
Type "reboot"

13.
Done.


Last Updated 2015-01-09
The Following 8 Users Say Thank You to likesatan For This Useful Post: [ View ] Gift likesatan Ad-Free
9th January 2015, 09:00 AM |#3  
OP Senior Member
Flag Paris
Thanks Meter: 76
 
More
Flashable ZIP
/*Under development*/

I'm porting this step by step process to a flashable ZIP.
Coming in the future.

/*Requirement*/

TWRP or CWM recovery.

/*Backup*/

Reboot into recovery mod and save your EFS partition and nothing else.
It will save you time in case of troubles.

/*BATCH CODE*/

If you want to help here is the batch code.
I think it's working. Have to test it.

Code:
#! /bin/bash

/system/xbin/su -l
SOMEVAR='n'
SOMEVAR='HEX'
n=0
HEX=0
cd /sys/devices/virtual/sensors/proximity_sensor/
Cat state
Cat prox_cal
Echo -n "Please type the sum of the first number and the second the first in parentesis. Eg first number 45. Second (23,00,17). Sum is 68."
Read n
HEX=`echo "obase=16;ibase=10; $n" | bc`
echo -en $'\$HEX' > /efs/prox_cal
chown system:system /efs/prox_cal
chmod 644 /efs/prox_cal
sync
echo "Done ! Touch the screen to reboot"
timeout /t -1
reboot

Then I'm going to use this tool to convert it.

Last update 2015-01-09
The Following 2 Users Say Thank You to likesatan For This Useful Post: [ View ] Gift likesatan Ad-Free
9th January 2015, 09:43 AM |#4  
OP Senior Member
Flag Paris
Thanks Meter: 76
 
More
/*Known issues*/

Cat state is giving you 255 value.
255 is highest value. Meaning your sensor is thinking is covered with blanket.
Their is dust on sensor.
[Fix]
Clean with "canned air" duster.
Thanks to @ode_


/*Problems*/
In case of trouble you can flash your EFS backup you first made in TWRP/CWM recovery.


Other issue ?
This thread is made for that.

Any questions ?
Juste ask.


Last Updated 2015-01-09
The Following User Says Thank You to likesatan For This Useful Post: [ View ] Gift likesatan Ad-Free
9th January 2015, 10:36 AM |#5  
OP Senior Member
Flag Paris
Thanks Meter: 76
 
More
FAQ
FAQ under construction.
15th January 2015, 02:52 AM |#6  
Senior Member
Tulsa
Thanks Meter: 48
 
More
Thank you for compiling this information. Can you clarify the statement, "Type "/system/xbin/su -l"". Is that last character a lower case letter L, or is it the vertical line character |?

---------- Post added at 08:50 PM ---------- Previous post was at 08:34 PM ----------

I got it. It took several attempts, so the recommendation to backup the efs partition was well received. Thanks! It works great!

---------- Post added at 08:52 PM ---------- Previous post was at 08:50 PM ----------

I cleaned my Note 3 thoroughly with a dry rag, and still my values were 214 and 76. Seems very high.
15th January 2015, 06:15 AM |#7  
OP Senior Member
Flag Paris
Thanks Meter: 76
 
More
Quote:
Originally Posted by TU Homer

Thank you for compiling this information. Can you clarify the statement, "Type "/system/xbin/su -l"". Is that last character a lower case letter L, or is it the vertical line character |?

It's a lower case letter L !

Quote:

I got it. It took several attempts, so the recommendation to backup the efs partition was well received. Thanks! It works great!

You're welcome so your proximity sensor is fixed now !

Quote:

I cleaned my Note 3 thoroughly with a dry rag, and still my values were 214 and 76. Seems very high.

No it's going to work fine ! Had a huge value and It worked.

Regards,
Likesatan
26th January 2015, 08:58 AM |#8  
Member
Thanks Meter: 5
 
More
"This is only tested on
- KS01LTE on CM12 from Arter97"

Why this ?

I dont have any proximity problems, if ppl mean that display should dim while holding phone near ear etc.
26th January 2015, 09:15 AM |#9  
OP Senior Member
Flag Paris
Thanks Meter: 76
 
More
Quote:
Originally Posted by iBuu

"This is only tested on
- KS01LTE on CM12 from Arter97"

Why this ?

I dont have any proximity problems, if ppl mean that display should dim while holding phone near ear etc.

Because I only test this on my phone and ROM : i9506 - CM12.

Some people have tried it on HLTE it's working too !

As I haven't a lot people testing it on multiples device I dont know if it's working on all devices.

It should work on all CM based roms for samsungs devices.

Regards,
Likesatan
29th January 2015, 07:44 PM |#10  
ode_'s Avatar
Senior Member
Thanks Meter: 65
 
More
Reminder from personal experience; after battery was out and rebooted phone with grease on front glass over proximity sensor and my phone did recalibration, and my proximity sensor start act weird, kinda broken way.
All what I did after that was battery out(20sec)/in again, cleaning front glass and rebooted and proximity sensor started to work normally.
4th February 2015, 03:31 PM |#11  
Senior Member
Flag bangalore
Thanks Meter: 294
 
More
is it apply to CM 12 latest nightlies ?
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes