Hello,

the kernel documentation for the in_proximity_nearlevel on iio
proximity devices [0] states:

> If the value read from the sensor is above or equal to the value in
> this file an object should typically be considered near.

Meaning a 'greater than or equal to' comparison.

The documentation of PROXIMITY_NEAR_LEVEL in 60-sensors.hwdb [1] on the
other hand states:

> # and <value> is an integer value above which an object is considered
> # close by a proximity sensor:
> #   PROXIMITY_NEAR_LEVEL=100

Meaning a 'greater than' comparison.

The iio/light/hid-sensor-prox.c driver in the kernel exposes 'human
presence' HID sensor devices, which are binary 0 or 1.

Per the comment in 60-sensors.hwdb the proper value for these devices
would be 0. But the proper value for exposing it as a sysfs attribute
in the driver would be 1.

The hid-sensor-prox driver does not currently expose the
in_proximity_nearlevel attribute, but it still left me wondering
whether the discrepancy between the sysfs attribute and the hwdb
property is intentional.

I don't see any PROXIMITY_NEAR_LEVEL properties for any devices in the
hwdb files, so I don't know whether the edge case of binary proximity
values has been properly considered yet. I'd like to contribute an
entry for my device and use it with iio-sensor-proxy to add human
presence detection as an aid to idle time monitoring.

Should the meaning of PROXIMITY_NEAR_LEVEL be adjusted?
Would an PROXIMITY_NEAR_LEVEL=0 property be the desired solution?

Regards,
Philipp Jungkamp

[0]:
https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-bus-iio-proximity
[1]:
https://github.com/systemd/systemd/blob/e6319a102e5b6f7c1588ca851d66db7c3ade1665/hwdb.d/60-sensor.hwdb#L48-L50

Reply via email to