Commit Graph

405 Commits

Author SHA1 Message Date
Bastien Nocera
e4eb952da2 main: Pass SensorDevice to sensor callbacks
Rather than SensorDriver. This would make it possible to differentiate
readings from 2 devices of the same type, eg. 2 accelerometers.
2021-01-19 11:11:29 +01:00
Bastien Nocera
16a206247a main: Simplify setting callback func and user_data
Set those in the drivers functions, rather than in each driver
implementation.
2021-01-18 15:43:22 +01:00
Bastien Nocera
4baa1ff2f7 main: Make it possible to instantiate multiple drivers
Split off "drivers" (class) and "devices" (instance) so that it's
possible to instantiate multiple devices of the same type, for example,
accelerometers in the base and the lid of laptops, or light sensors
in a removable keyboard as well as the display.

Note that we do not make use of that functionality just yet.
2021-01-18 15:43:22 +01:00
Bastien Nocera
c28a200f75 tests: Add test for the iio-poll-proximity driver 2021-01-18 15:29:52 +01:00
Bastien Nocera
d636116ec3 tests: Add test for the iio-poll-light driver 2021-01-18 15:29:52 +01:00
Bastien Nocera
9244491e0d tests: Add test for the iio-poll-accel driver 2021-01-18 15:29:52 +01:00
Bastien Nocera
a0c4f38243 tests: Clean up fake compass test
Extra debug output and unused variable.
2021-01-18 15:29:52 +01:00
Bastien Nocera
483af259af ci: Export test failures as artifacts 2021-01-18 15:29:52 +01:00
Bastien Nocera
fc9c055e36 README: Simplify instructions on getting debug info 2021-01-15 13:49:12 +01:00
Bastien Nocera
2a033f9b07 main: Simplify driver implementation of close()
Seeing as every driver disables polling in close(), do that in the
common implementation.
2021-01-15 13:42:20 +01:00
Bastien Nocera
8dffb918d2 main: Fix program name in help output
Closes: #316
2021-01-15 12:37:44 +01:00
Bastien Nocera
df7472f3bc tests: Add test suite
IIO devices aren't supported by umockdev, so make do with supporting
hwmon devices, as well as our 2 fake light and compass drivers.
2021-01-15 12:35:41 +01:00
Bastien Nocera
39ff633f48 ci: Add test dependencies 2021-01-15 12:35:41 +01:00
Bastien Nocera
1bf7d32fc5 ci: Indent package dependencies
To make it clearer when adding or removing deps
2021-01-15 12:35:41 +01:00
Bastien Nocera
ad3d25ba8f main: Remove DriverSpecificType
And its place in the struct, it's not actually used.
2021-01-14 17:04:48 +01:00
Bastien Nocera
9f49caaf17 main: Add command-line options
Those options allow replacing a running instance, and enabling debug.
2021-01-14 17:01:29 +01:00
Max Leiter
630b461149 light: test for in_intensity_clear_{raw,input} property
Allows detection of RGBC sensing devices such as the apds9960 by checking for
the in_intensity_clear_ property, which reports the unprocessed lux value for the ALS photodiode.
More information on the field can be found in the kernel iio docs:
https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-bus-iio.

Tested on a MSHW1084, which is compatible with te apds9960. The apsd9960
reference can be found here: https://docs.broadcom.com/doc/AV02-4191EN.
2020-12-11 02:20:43 -08:00
Bastien Nocera
dbd8daccdd proximity: Use new gudev API
Remove another copy of sysfs_get_int() in favour of
g_udev_device_get_sysfs_attr_as_int_uncached().
2020-09-29 16:56:51 +02:00
Bastien Nocera
110bf47a6f accel: Use new gudev API
Remove sysfs_get_int() and use
g_udev_device_get_sysfs_attr_as_int_uncached() instead.
2020-09-29 16:56:51 +02:00
Bastien Nocera
b303eb6415 hwmon: Use new gudev API
Use g_udev_device_get_sysfs_attr_uncached() to simplify fetch loop.
2020-09-29 16:56:51 +02:00
Bastien Nocera
23859b43ce build: Require newer gudev for the uncached sysfs attr API 2020-09-29 16:56:51 +02:00
Bastien Nocera
61e46e98d4 main: Add .editorconfig
For the benefit of contributors.
2020-09-29 16:33:41 +02:00
Bastien Nocera
80588ea42a build: Make sure libexecdir is an absolute path 2020-08-07 11:21:53 +02:00
Bastien Nocera
a0fdaac529 docs: Better list in API docs 2020-07-13 08:01:29 +02:00
Bastien Nocera
4d5df7062e README: Fix daemon binary path 2020-07-07 17:45:32 +02:00
Bastien Nocera
0e5ae3798c build: Update meson.build license to match COPYING 2020-07-03 11:54:59 +02:00
Bastien Nocera
79922459b4 build: Remove AUTHORS file
It was required by autotools and empty. git has the list of contributors
already :)
2020-07-03 11:48:29 +02:00
Bastien Nocera
bede00ea45 README: Document the mount matrix
Closes: #285
2020-07-02 13:38:23 +02:00
Bastien Nocera
e56dc79788 README: Link to Linux, Windows and Android docs for mount matrix
Closes: #295
2020-07-01 21:56:20 +02:00
Bastien Nocera
622efff5c1 README: Install system-wide to avoid non-working setups 2020-07-01 14:23:32 +02:00
Bastien Nocera
af2f3a1055 build: Install daemon in libexecdir
Rather than sbindir, which would have meant it could be in the PATH.
2020-06-27 14:02:32 +02:00
Bastien Nocera
e3adea6626 README: Update install instructions 2020-06-27 14:01:38 +02:00
Bastien Nocera
919108999f build: Remove unneeded or empty files
README is only required by the autotools, and we already have the
README.md file it links to. ChangeLog was similarly required but empty.
2020-06-26 18:20:16 +02:00
Bastien Nocera
27db244d97 build: Remove autotools build 2020-06-26 18:20:16 +02:00
Bastien Nocera
e3e939bcae ci: Use meson in the CI 2020-06-26 18:20:16 +02:00
Bastien Nocera
62bdf03fab build: Add COPYING file 2020-06-26 18:16:42 +02:00
Bastien Nocera
cf1ac31f55 build: Add meson build system files 2020-06-26 18:16:42 +02:00
Bastien Nocera
52e701aa8a main: Move _GNU_SOURCE definition to the build files 2020-06-26 17:56:50 +02:00
Bastien Nocera
b802147fd9 main: Fix support for older polling accelerometers
Add support for per-axis accel scaling as required for older
accelerometers:
"
It used to be hard to have the same range out of the plane of the silicon
than within it, so was common to have sensors with different ranges and
hence scales in z direction from x and y.
"

Fetch the scale for each axis from sysfs for polling accelerometers.
2020-05-04 14:52:25 +02:00
Bastien Nocera
eaa3fbc800 main: Use AccelScale everywhere
Use AccelScale, which supports per-axis accelerometer scaling everywhere
we would have had a single scale value.

This adds per-axis support from the ring-buffer for accelerometers
with triggers.
2020-05-04 14:49:55 +02:00
Bastien Nocera
1b8c1c6b37 accel: Add per-axis accel scale helpers 2020-05-04 12:00:42 +02:00
Your Name
ed427251b7 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
2020-03-25 12:11:03 +01:00
Bastien Nocera
a4e4e55c06 3.0 2020-03-23 10:59:29 +01:00
Bastien Nocera
876987b418 main: Reword "no supported sensors" debug message
To stop users thinking that we'd be responsible for providing support
for their sensors when it's the kernel's job.
2020-03-23 10:58:40 +01:00
Guido Günther
fcf951b3bc data: Don't overwrite IIO_SENSOR_PROXY_TYPE
Don't overwrite an already set type for light and ambient to support
multi channel sensors.

This reverts commit 5ef75b57a988a8a6acc2611cde760f28fc7b48d6.
2020-03-04 09:41:44 +00:00
Guido Günther
de1e1ea35a drivers: Support multi-function sensors
There are multi channel sensors like the vcnl4040 that provide
als and proximity information via the same device but different
sysfs files.
2020-03-04 09:41:44 +00:00
Guido Günther
aca6f81e25 monitor-sensor: support proximity 2020-03-04 09:39:50 +00:00
Guido Günther
1a9489afb6 data: Detect proximity sensors 2020-03-04 09:39:50 +00:00
Guido Günther
1497d965a3 proximity: Use a margin around near_level
This makes sure we don't trigger too often on small movements
around the near level.
2020-03-04 09:39:50 +00:00
Guido Günther
11778ab603 proximity: Read near level from udev property
The levels are sensor dependend and are also affected by how the sensor
is built into the device (e.g. the distance to the cover glass).

Android even does this in sensor specific code. Android x86 works
around this by using setprop:

https://groups.google.com/forum/#!topic/android-x86/RFXYW5MNCuk
2020-03-04 09:39:50 +00:00