502 Commits

Author SHA1 Message Date
Bastien Nocera
f42263d434 tests: Add tests for 0.0 IIO offsets
Test both parts of iioutils_get_param_float() for 0.0 readings.
2021-08-16 14:44:57 +02:00
Bastien Nocera
8980b8b74f iio: Allow "0.0" as an offset
0.0 is a valid offset.

https://bugzilla.redhat.com/show_bug.cgi?id=1978419#c11
2021-08-16 14:26:04 +02:00
Bastien Nocera
b6c4c7ccb7 3.2 2021-08-15 00:30:39 +02:00
Bastien Nocera
93a10cd84d tests: Another test for misparsed scale in some locales
Polling accelerometer drivers read the accelerometer scales using
libgudev. Check that libgudev is new enough and this bug is fixed:
https://gitlab.gnome.org/GNOME/libgudev/-/merge_requests/17
2021-08-15 00:18:43 +02:00
Bastien Nocera
7559d9b652 build: Require a newer libgudev to fix scale parsing errors 2021-08-15 00:18:43 +02:00
Bastien Nocera
4a0033c8dd ci: Install newer libgudev 2021-08-15 00:18:35 +02:00
Bastien Nocera
2f94e4981f iio: Error out when scale is parsed as 0.0 2021-08-14 22:48:54 +02:00
Bastien Nocera
cb8b8c3282 tests: Test for misparsed scale in some locales
Check that the scale is correctly parsed in the French locale.
2021-08-14 22:48:54 +02:00
Bastien Nocera
a0d058eeb1 iio: Fix iioutils_get_param_float() in some locales
Reimplement iioutils_get_param_float() to parse float data like it would
in the C locale. This fixes the scale being '0' for every axis on some
systems and in some locales.

This is used to get the scale and offset parameters from buffer IIO drivers.

Fixes: 9f49caaf17

Closes: #331
2021-08-14 22:48:54 +02:00
Bastien Nocera
06b72df254 tests: Test for unparseable mount matrix in some locales 2021-08-14 22:48:54 +02:00
Bastien Nocera
55377329a2 mount-matrix: Fix parsing of mount matrix in some locales
Fix parsing of mount matrix in locales that use a comma as a decimal
separator.

Fixes: 9f49caaf17

Closes: #330
2021-08-14 22:48:54 +02:00
Bastien Nocera
38c1b4d5c1 ci: Add French locale to CI 2021-08-14 22:48:54 +02:00
Bastien Nocera
c5aea53101 tests: Initialise i18n in tests 2021-08-14 22:48:54 +02:00
Bastien Nocera
61a44175ca mount-matrix: Fix deprecation warning
src/accel-mount-matrix.c: In function ‘parse_mount_matrix’:
src/accel-mount-matrix.c:121:17: warning: ‘g_memdup’ is deprecated: Use 'g_memdup2' instead [-Wdeprecated-declarations]
  121 |                 *vecs = g_memdup (id_matrix, sizeof(id_matrix));
      |                 ^
2021-08-14 22:48:54 +02:00
Bastien Nocera
eb38ddb0d2 ci: Remove python-dbusmock hacks 2021-08-14 10:42:19 +02:00
Bastien Nocera
96c0b33191 mount-matrix: Fix stringop-overflow warnings
iio-sensor-proxy/src/accel-mount-matrix.c:77:21: warning: ‘parse_mount_matrix’ accessing 24 bytes in a region of size 8 [-Wstringop-overflow=]
   77 |                 if (parse_mount_matrix (mount_matrix, &ret))
      |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
iio-sensor-proxy/src/accel-mount-matrix.c:77:21: note: referencing argument 2 of type ‘AccelVec3 **’
iio-sensor-proxy/src/accel-mount-matrix.c:91:1: note: in a call to function ‘parse_mount_matrix’
   91 | parse_mount_matrix (const char  *mtx,
      | ^~~~~~~~~~~~~~~~~~
2021-07-25 00:38:23 +02:00
Bastien Nocera
49d3771716 3.1 2021-06-14 13:40:32 +02:00
Bastien Nocera
f9f4976582 ci: Export the created dist 2021-06-14 13:40:32 +02:00
Bastien Nocera
9300c064bd build: Update version
meson port was started before 3.0 was released, and we haven't had a
meson release yet, so this slipped.
2021-06-14 13:40:32 +02:00
Bastien Nocera
5c6fa19b17 ci: Work-around uninstallable python-dbusmock in rawhide 2021-06-14 13:30:46 +02:00
Bastien Nocera
99a3737418 tests: Add integration test for "label" accel location
Make sure that accelerometers with a "accel-base" label get ignored.
2021-06-11 12:54:54 +02:00
Bastien Nocera
27a325b2f5 accel: Add support for the new "accel-*" IIO labels
See https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=9a6df4b1ab0e467f23ccdcbb82700cfb3eaf44a3
2021-06-11 12:54:48 +02:00
Bastien Nocera
a1eb647c88 drivers: Remove unused declarations 2021-01-22 15:10:02 +01:00
Bastien Nocera
72bee8bbdb tests: Add test for property leaking to every listener
Add test that shows that even if a sensor is unclaimed by a client, that
client will still receive sensor updates because GDBusProxy is still
listening to signals from it.

See https://gitlab.freedesktop.org/hadess/iio-sensor-proxy/-/issues/210
2021-01-22 14:33:18 +01:00
Bastien Nocera
8225c4458a main: Only send properties to registered clients
Only send PropertiesChanged signals to clients that have registered
their interest by claiming a particular type of sensor.
2021-01-22 14:33:18 +01:00
Bastien Nocera
3059969313 monitor-sensor: Add options to only monitor specific sensors
Should make testing and debugging easier.
2021-01-22 14:33:18 +01:00
Bastien Nocera
203d6508dc tests: Fix test_input_accel() leaking a daemon
test_input_accel() uses umockdev-run, and killing umockdev-run doesn't
kill the child iio-sensor-proxy daemon we make it spawn, making any test
running after this one fail. As the tests are run alphabetically, we
were lucky that this test was the last one, but we can't rely on that.

Instead, use psutil to list all the children processes and kill those
before killing umockdev-run.
2021-01-22 11:05:42 +01:00
Bastien Nocera
2449acac70 tests: Fix umockdev device name in some tests
Which didn't correspond to the type of device being added.
2021-01-22 10:48:31 +01:00
Bastien Nocera
cd66a299cb main: Add debug in early exit paths for Claim/Release calls
Show some debug when Claim is being called for an already claimed
sensor, and Release is called for an unclaimed sensor.
2021-01-22 10:47:08 +01:00
Bastien Nocera
cc112408df fake-input-accelerometer: Simplify error paths 2021-01-21 16:15:46 +01:00
Bastien Nocera
39af04fc48 drivers: Use new g_auto* to simplify IIOSensorData handling 2021-01-21 16:15:46 +01:00
Bastien Nocera
7ab8378cdb iio: Add g_auto() helpers for IIOSensorData 2021-01-21 16:15:46 +01:00
Bastien Nocera
fbb67da3a7 utils: Fix get_device_file() retval
Possible use-after-free.
2021-01-21 16:15:46 +01:00
Bastien Nocera
e3594b879c main: Use new g_auto* to close file descriptors 2021-01-21 16:15:46 +01:00
Bastien Nocera
b60d9d3556 utils: Add a g_auto() types to close file descriptors 2021-01-21 16:15:46 +01:00
Bastien Nocera
303d106698 tests: Add iio-buffer-accel test 2021-01-20 18:30:58 +01:00
Bastien Nocera
793ecb7dee accel: Add support for mocking data read from device node 2021-01-20 18:30:42 +01:00
Bastien Nocera
fb00652028 accel: Use g_autofree to free the trigger name 2021-01-20 18:28:47 +01:00
Bastien Nocera
132b30a337 drivers: Print some debug when we can't find the trigger 2021-01-20 18:28:47 +01:00
Bastien Nocera
7591a2a76e hwmon: Lower poll timeout during tests
Makes the tests last about 8 seconds less.
2021-01-20 18:28:47 +01:00
Bastien Nocera
e8d22fe304 main: Add helper for mocking device node 2021-01-20 18:28:47 +01:00
Bastien Nocera
4f990284ce utils: Add helper to detect when running in tests 2021-01-20 18:28:02 +01:00
Bastien Nocera
7d562ea8d6 README: Reformat shell commands 2021-01-20 15:36:00 +01:00
Bastien Nocera
bec3165780 README: Add info on how to run iio_generic_buffer 2021-01-20 15:36:00 +01:00
Bastien Nocera
7a12f6bbc9 tests: Add simple test for input accel 2021-01-19 16:35:42 +01:00
Bastien Nocera
ccf5dbcd9e main: Set a name at the SensorDevice level
So that the core code can access that name for debugging purposes.
2021-01-19 11:55:17 +01:00
Bastien Nocera
a4b9cb73b5 main: Rename SensorDriver member name to driver_name
So we don't confuse it with the SensorDevice name field.
2021-01-19 11:21:57 +01:00
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