95.26. iio-sensor-proxy-3.9
IIO sensors to D-Bus — accelerometer, ambient light, compass and proximity for screen rotation and auto-brightness
3.9-1 · GPL-3.0-or-later · 0.1 SBU · 162.0 KiB, 6 files · 41_system, 674 of 1047 · ports/core/hardware/iio-sensor-proxy
Homepage: https://gitlab.freedesktop.org/hadess/iio-sensor-proxy
iio-sensor-proxy reads a machine’s accelerometer, ambient-light sensor, compass and proximity sensor through the kernel’s IIO and input interfaces and publishes them on the system bus as net.hadess.SensorProxy. KWin asks it for the device orientation to rotate a convertible’s or tablet’s screen, and PowerDevil for the ambient light to drive automatic brightness. A machine with no such sensor gains nothing from it, and the daemon then exits.
The daemon is /usr/libexec/iio-sensor-proxy, run as root under ksvc from an init script in the tree’s fs/ overlay; monitor-sensor prints what it reports.
Depends on: meson, ninja, pkgconf, glib, libgudev, eudev, polkit, dbus.
Required by (1): kde-plasma.
Sources: iio-sensor-proxy-3.9.tar.gz (77.1 KiB). Every step kpkg takes applies to this port.
Install: script/chroot/exec.sh bash -c 'source script/phases/41_system/phase.env && kpkg install iio-sensor-proxy'
build.sh:
meson setup build --prefix=/usr --sysconfdir=/etc --libdir=lib \
--buildtype=release \
-Dudevrulesdir=/usr/lib/udev/rules.d \
-Dsystemdsystemunitdir= \
-Dssc-support=disabled \
-Dtests=false \
-Dgtk-tests=false \
-Dgtk_doc=false
meson compile -C build
DESTDIR=$PKG meson install --no-rebuild -C build
-Dudevrulesdir=/usr/lib/udev/rules.d— Install80-iio-sensor-proxy.ruleswhere eudev reads rules. The rule tags each sensor withIIO_SENSOR_PROXY_TYPE, which the daemon reads to know what a device is. Upstream’sautoasksudev.pc, which names/lib/udev, the same directory under the merged/usr, by a path the package would then carry outsideusr.-Dsystemdsystemunitdir=— Install no systemd unit. An empty directory is meson’s switch for leaving a configured file uninstalled.-Dssc-support=disabled— No Qualcomm Sensor Core support, which needslibsscand serves only phones with a Qualcomm sensor DSP.-Dtests=false— With-Dgtk-tests=falseand-Dgtk_doc=false: no test programs, no GTK test window and no API reference.
Programs: monitor-sensor.
Directories: /usr/share/licenses/iio-sensor-proxy.
The D-Bus policy lets only root own net.hadess.SensorProxy and lets any client read it. Nothing installs a D-Bus activation file for the name: upstream starts the daemon only through its systemd unit (Type=dbus) and the rule’s SYSTEMD_WANTS, which eudev ignores. So the daemon must be running before KWin and PowerDevil ask for it, and on KDOS an init script starts it at boot under ksvc.
At start-up the daemon logs “No sensors or missing kernel drivers for the sensors. Exiting” and exits with status 0 when no device carries IIO_SENSOR_PROXY_TYPE, and it exits the same way when the last sensor is removed. A supervisor that restarts it on every exit would restart it every few seconds on a desktop, so the init script starts it only when udev reports a tagged device.