Skip to content

WIP:compass: Add support for polling uncalibrated devices

Aims to address #310

  • data/80-iio-sensor-proxy.rules: Add rule matching pollable compasses
  • src/drivers.h: Add iio_poll_compass_uncalibrated
  • src/drv-iio-poll-compass-uncalibrated.c: Add driver able to handle calibration data
  • src/meson.build: Build new driver

TODO:

  • Gather calibration samples
  • Start/Stop Calibration (DBus)
  • Load Calibration Data from disk (currently hardcoded for my device)
  • Not sure if I'm doing the heading correctly

With this MR the geoclue user will see heading changes:

mobian@mobian:/sys/bus/iio/devices/iio:device2$ sudo su - geoclue -s /usr/bin/monitor-sensor
    Waiting for iio-sensor-proxy to appear
+++ iio-sensor-proxy appeared
=== Has accelerometer (orientation: left-up)
=== Has ambient light sensor (value: 0.100000, unit: lux)
=== Has proximity sensor (near: 0)
=== Has compass (heading: unset)
    Light changed: 0.200000 (lux)
    Compass heading changed: 70.722457
    Compass heading changed: 71.268989
    Light changed: 0.100000 (lux)
    Compass heading changed: 70.264022
    Compass heading changed: 70.829150
    Compass heading changed: 57.851192
    Light changed: 0.200000 (lux)
    Compass heading changed: 53.891157
    Compass heading changed: 41.468459
    Compass heading changed: 41.753111

Any review/feedback appreciated!

Edited by Evangelos Ribeiro Tzaras

Merge request reports

Loading