Change proximity sensor calibration on CM13

From Tom's notes
Jump to navigation Jump to search

On Cyanogenmod 13 you can change the proximity sensor calibration in the following way so that it keeps the calibration across reboots. First you'll have to find the value at which to set the threshold. Log in using 'adb shell', a local terminal or ssh on your GSM.

To check the old threshold you can do

cat /sys/devices/virtual/sensors/proximity_sensor/prox_thresh

To find a good value, repeatedly execute the following command whilst covering/uncovering the proximity sensor:

cat /sys/devices/virtual/sensors/proximity_sensor/raw_data

When you find a good threshold value you can immediately test it by executing the following command (assume you want to use 100 as the new threshold)

echo 100>/sys/devices/virtual/sensors/proximity_sensor/prox_thresh

To have the change activate automatically after rebooting your phone do:

echo "echo 100>/sys/devices/virtual/sensors/proximity_sensor/prox_thresh">>/data/local/userinit.sh