Proximity sensor fix on CM based ROM

Search This thread

likesatan

Senior Member
Sep 3, 2010
189
72
Paris
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
 
Last edited:

likesatan

Senior Member
Sep 3, 2010
189
72
Paris
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
 
Last edited:

likesatan

Senior Member
Sep 3, 2010
189
72
Paris
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
 
Last edited:

likesatan

Senior Member
Sep 3, 2010
189
72
Paris
/*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
 
Last edited:
  • Like
Reactions: naxus12

TU Homer

Senior Member
May 8, 2009
351
48
Tulsa
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.
 

likesatan

Senior Member
Sep 3, 2010
189
72
Paris
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 !

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 !

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
 

iBuu

Senior Member
Dec 5, 2014
56
5
"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.
 

likesatan

Senior Member
Sep 3, 2010
189
72
Paris
"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
 

ode_

Senior Member
Aug 19, 2014
200
65
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.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 8
    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
    5
    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
    2
    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
    1
    /*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
    1
    Another Placeholder thread, there is definitely seperate rules...

    And why placeholder? He post step by step what you must make. Is a guide. And helped a lot of ppl.

    Sent from my GT-I9506 using XDA Free mobile app
Our Apps
Get our official app!
The best way to access XDA on your phone
Nav Gestures
Add swipe gestures to any Android
One Handed Mode
Eases uses one hand with your phone