proximity: Get near-level from sysfs if available

DT based devices can set the near-level via sysfs. Parse it from
there too.

Signed-off-by: Guido Günther <agx@sigxcpu.org>
Closes: #297
This commit is contained in:
Your Name
2020-03-25 11:59:03 +01:00
committed by Guido Günther
parent a4e4e55c06
commit ed427251b7

View File

@@ -100,6 +100,9 @@ get_near_level (GUdevDevice *device)
gint near_level;
near_level = g_udev_device_get_property_as_int (device, PROXIMITY_NEAR_LEVEL);
if (!near_level)
near_level = g_udev_device_get_sysfs_attr_as_int (device, "in_proximity_nearlevel");
if (!near_level) {
g_warning ("Found proximity sensor but no " PROXIMITY_NEAR_LEVEL " udev property");
g_warning ("See https://gitlab.freedesktop.org/hadess/iio-sensor-proxy/blob/master/README.md");