That article is quite outdated at this point, it describes how to talk to the sensors without using any driver - you’d use that knowledge while writing a driver, which you don’t have to do because it’s there now For use in applications, you rather want to use iio-sensor-proxy’s API, and for testing, you can use monitor-sensor.
In case you want to talk to sensors directly anyway, you can still do it by using -y switch. Keep in mind that the sensors could be powered down by the driver while not in use though.
Thanks, that works for ambient light. But how do I test/get values of the proximity sensor and the accelerometer:
purism@pureos:~$ monitor-sensor
Waiting for iio-sensor-proxy to appear
+++ iio-sensor-proxy appeared
=== Has accelerometer (orientation: undefined)
=== Has ambient light sensor (value: 1.920000, unit: lux)
=== Has proximity sensor (near: 0)
monitor-sensor will show you the orientation (just move the phone around and see it changing), and proximity sensor getting above its threshold (just cover the area above the screen and see it changing). However, to get raw values from the sensors, you’ll have to resort to using i2c directly at this point. AFAIK there is a raw API for accelerometers being worked on in iio-sensor-proxy (so things like games could then use it), but that’s not ready yet.
Enabling lockdown mode and disabling it again, proximity sensor does not come up again:
purism@pureos:~$ monitor-sensor
Waiting for iio-sensor-proxy to appear
+++ iio-sensor-proxy appeared
=== Has accelerometer (orientation: left-up)
=== Has ambient light sensor (value: 12.240000, unit: lux)
=== No proximity sensor
After restart proximity sensor is back. This seems to be a bug.
Thank you very much! This seems to be a similar issue. There the problem is that the “accelerometer not regonized”, here it is the proximity sensor. The common thing is the lockdown mode which makes the problem.