Skip to content

drv-iio-poll-proximity: change near criterion

Change the near level comparison to a greater-than-or-equal-to to make the calculation match the kernel documentation. See: https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-bus-iio-proximity

The current code seems to abide to the old comment in systemd's hwdb/60-sensor.hwdb, but not to the kernel documentation for in_proximity_nearlevel as outlined in the kernel documentation.

This is based on the change in documentation I proposed to systemd's hwdb. See: https://github.com/systemd/systemd/issues/25793

A sensor reporting binary values 0/1 to indicate far/near would currently need a PROXIMITY_NEAR_LEVEL of 0 which is additionally problematic as a value of 0 is also reported by g_udev_device_get_property_as_int/g_udev_device_get_sysfs_attr_as_int or when the attribute/property query fails.

Fixes: #361

Edited by Philipp Jungkamp

Merge request reports

Loading