Open main menu
TODO This page needs some tips on testing all the sensors that can be found in the device

Devices usually have some sensors such as IMU, light or proximity sensors in them. This page is intended to provide various tips on enabling and testing those sensors.


A visualization of different rotation states.

The accelerometer is used for automatic screen rotation.

iio-sensor-proxy is used by some UI's to track the display orientation, you can use monitor-sensor tool to see, what it thinks the orientation of the device is.

If the rotation is reported incorrectly, you may need to define mount-matrix. See e.g. this explanation.

Proximity sensor

Proximity sensor is usually located behind the screen on top of the device and is used to blank the screen when the user takes the device near the ear.


iio-sensor-proxy can report the "near" state to other programs on the device but it needs to know what's the "near" level to report it.

There are multiple ways to provide that information:

  • Define proximity-near-level in the devicetree. The iio device driver must support reading and reporting that value.
  • For those drivers that don't support the DT property, it's possible to add an udev rule like this: (Consider extending the driver like this instead)
# iio-sensor-proxy
# Set PROXIMITY_NEAR_LEVEL for iio-sensor-proxy to pick up the proximity sensor

# Set the sensor type for all the types we recognise
ACTION=="add", SUBSYSTEM=="iio", TEST=="in_proximity_raw", ENV{PROXIMITY_NEAR_LEVEL}="250"

As with other sensors that iio-sensor-proxy monitors, you can use monitor-sensor tool to check the proximity sensor.