Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package iio-sensor-proxy for openSUSE:Factory checked in at 2023-08-01 14:15:26
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/iio-sensor-proxy (Old)
and /work/SRC/openSUSE:Factory/.iio-sensor-proxy.new.32662 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "iio-sensor-proxy"
Tue Aug 1 14:15:26 2023 rev:23 rq:1101424 version:3.5
Changes:
--------
--- /work/SRC/openSUSE:Factory/iio-sensor-proxy/iio-sensor-proxy.changes 2022-10-16 16:09:16.290762545 +0200
+++ /work/SRC/openSUSE:Factory/.iio-sensor-proxy.new.32662/iio-sensor-proxy.changes 2023-08-01 14:15:27.735463807 +0200
@@ -1,0 +2,10 @@
+Wed Jul 26 23:25:11 UTC 2023 - Atri Bhattacharya <badshah400(a)gmail.com>
+
+- Update to version 3.5:
+ * Fix sensor hotplugging
+ * Fix some sensors not working when they were assigned a
+ sampling frequency they did not support.
+ * Add more tests.
+ * Correct the location of the D-Bus policy file.
+
+-------------------------------------------------------------------
Old:
----
iio-sensor-proxy-3.4.tar.bz2
New:
----
iio-sensor-proxy-3.5.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ iio-sensor-proxy.spec ++++++
--- /var/tmp/diff_new_pack.fFr14C/_old 2023-08-01 14:15:28.439467942 +0200
+++ /var/tmp/diff_new_pack.fFr14C/_new 2023-08-01 14:15:28.447467990 +0200
@@ -1,7 +1,7 @@
#
# spec file for package iio-sensor-proxy
#
-# Copyright (c) 2022 SUSE LLC
+# Copyright (c) 2023 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -17,7 +17,7 @@
Name: iio-sensor-proxy
-Version: 3.4
+Version: 3.5
Release: 0
Summary: Proxy for IIO and input subsystems
License: GPL-3.0-only
@@ -59,24 +59,22 @@
%install
%meson_install
-mkdir -p %{buildroot}%{_datadir}/dbus-1/system.d
-mv %{buildroot}%{_sysconfdir}/dbus-1/system.d/net.hadess.SensorProxy.conf %{buildroot}%{_datadir}/dbus-1/system.d
%pre
-%service_add_pre %{name}.service
+%service_add_pre iio-sensor-proxy.service
%preun
-%service_del_preun %{name}.service
+%service_del_preun iio-sensor-proxy.service
%post
%udev_hwdb_update
%udev_rules_update
-%service_add_post %{name}.service
+%service_add_post iio-sensor-proxy.service
%postun
%udev_hwdb_update
%udev_rules_update
-%service_del_postun %{name}.service
+%service_del_postun iio-sensor-proxy.service
%files
%{_bindir}/monitor-sensor
++++++ iio-sensor-proxy-3.4.tar.bz2 -> iio-sensor-proxy-3.5.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/iio-sensor-proxy-3.4/.gitlab-ci.yml new/iio-sensor-proxy-3.5/.gitlab-ci.yml
--- old/iio-sensor-proxy-3.4/.gitlab-ci.yml 2022-07-15 15:08:38.000000000 +0200
+++ new/iio-sensor-proxy-3.5/.gitlab-ci.yml 2023-07-25 10:28:22.000000000 +0200
@@ -18,6 +18,11 @@
python3-psutil
umockdev
+workflow:
+ rules:
+ - if: $CI_PIPELINE_SOURCE == 'merge_request_event'
+ - if: $CI_PIPELINE_SOURCE == 'push'
+
build_stable:
before_script:
# Undo delangification present in the Fedora Docker images
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/iio-sensor-proxy-3.4/NEWS new/iio-sensor-proxy-3.5/NEWS
--- old/iio-sensor-proxy-3.4/NEWS 2022-07-15 15:08:38.000000000 +0200
+++ new/iio-sensor-proxy-3.5/NEWS 2023-07-25 10:28:22.000000000 +0200
@@ -1,3 +1,10 @@
+3.5
+---
+
+This update fixes sensor hotplugging, and fixes some sensors not working when
+they were assigned a sampling frequency they did not support. This update also
+adds more tests, and corrects the location of the D-Bus policy file.
+
3.4
---
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/iio-sensor-proxy-3.4/meson.build new/iio-sensor-proxy-3.5/meson.build
--- old/iio-sensor-proxy-3.4/meson.build 2022-07-15 15:08:38.000000000 +0200
+++ new/iio-sensor-proxy-3.5/meson.build 2023-07-25 10:28:22.000000000 +0200
@@ -1,5 +1,5 @@
project('iio-sensor-proxy', [ 'c' ],
- version: '3.4',
+ version: '3.5',
license: 'GPLv3+',
default_options: [
'buildtype=debugoptimized',
@@ -26,7 +26,7 @@
prefix = get_option('prefix')
libexecdir = prefix / get_option('libexecdir')
bindir = get_option('bindir')
-dbusconfdir = get_option('sysconfdir') / 'dbus-1' / 'system.d'
+dbusconfdir = get_option('datadir') / 'dbus-1' / 'system.d'
mathlib_dep = cc.find_library('m', required: false)
udev_rules_dir = get_option('udevrulesdir')
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/iio-sensor-proxy-3.4/src/iio-buffer-utils.c new/iio-sensor-proxy-3.5/src/iio-buffer-utils.c
--- old/iio-sensor-proxy-3.4/src/iio-buffer-utils.c 2022-07-15 15:08:38.000000000 +0200
+++ new/iio-sensor-proxy-3.5/src/iio-buffer-utils.c 2023-07-25 10:28:22.000000000 +0200
@@ -13,7 +13,10 @@
#include "iio-buffer-utils.h"
#include "utils.h"
+#include <ctype.h>
#include <fcntl.h>
+#include <float.h>
+#include <math.h>
#include <string.h>
#include <errno.h>
#include <stdio.h>
@@ -548,6 +551,61 @@
}
/**
+ * iio_round_sampling_frequency: Round sampling_frequency to a supported value
+ * @dev: the IIO device to round the sampling frequency for
+ * @name: name of the *sampling_frequency attribute for which to round value
+ * @desired: desired value
+ *
+ * Check "<name>_available" and if that attribute exists round the desired
+ * value to a supported value, rounding up where possible.
+ */
+static double
+iio_round_sampling_frequency (GUdevDevice *dev, const char *name, double desired)
+{
+ g_autofree char *available_attr = NULL;
+ const char *available_str;
+ char *endptr;
+ double closest_higher = DBL_MAX;
+ double closest_lower = 0.0;
+ double available;
+
+ available_attr = g_strconcat (name, "_available", NULL);
+ available_str = g_udev_device_get_sysfs_attr (dev, available_attr);
+
+ if (!available_str)
+ return desired;
+
+ while (*available_str) {
+ available = g_ascii_strtod (available_str, &endptr);
+ if (available_str == endptr || (*endptr && !isspace (*endptr)))
+ break;
+
+ available_str = endptr;
+
+ /* 0 disables sampling, skip */
+ if (available == 0.0)
+ continue;
+
+ if (available >= desired) {
+ if (available < closest_higher)
+ closest_higher = available;
+ } else {
+ if (available > closest_lower)
+ closest_lower = available;
+ }
+ }
+
+ /* Prefer higher values */
+ if (closest_higher != DBL_MAX)
+ return closest_higher;
+
+ if (closest_lower != 0.0)
+ return closest_lower;
+
+ return desired;
+}
+
+/**
* iio_fixup_sampling_frequency: Fixup devices *sampling_frequency attributes
* @dev: the IIO device to fix the sampling frequencies for
*
@@ -566,6 +624,7 @@
const char *device_dir;
const char *name;
g_autoptr(GError) error = NULL;
+ char sample_freq_str[G_ASCII_DTOSTR_BUF_SIZE];
double sample_freq;
device_dir = g_udev_device_get_sysfs_path (dev);
@@ -583,8 +642,16 @@
if (sample_freq >= IIO_MIN_SAMPLING_FREQUENCY)
continue; /* Continue with pre-set sample freq. */
- /* Sample freq too low, set it to 10Hz */
- if (write_sysfs_int (name, device_dir, IIO_MIN_SAMPLING_FREQUENCY) < 0)
+ /* Sample freq too low, set it to a supported freq close to 10Hz */
+ sample_freq = iio_round_sampling_frequency (dev, name, IIO_MIN_SAMPLING_FREQUENCY);
+
+ /*
+ * Some sample_freq IIO sysfs attr only accept integers, most will
+ * accept floats but not all. g_ascii_dtostr() uses the shortest
+ * possible representation, omitting the "." for whole numbers.
+ */
+ g_ascii_dtostr (sample_freq_str, G_ASCII_DTOSTR_BUF_SIZE, sample_freq);
+ if (write_sysfs_string (name, device_dir, sample_freq_str) < 0)
g_warning ("Could not fix sample-freq for %s/%s", device_dir, name);
}
g_dir_close (dir);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/iio-sensor-proxy-3.4/src/iio-sensor-proxy.c new/iio-sensor-proxy-3.5/src/iio-sensor-proxy.c
--- old/iio-sensor-proxy-3.4/src/iio-sensor-proxy.c 2022-07-15 15:08:38.000000000 +0200
+++ new/iio-sensor-proxy-3.5/src/iio-sensor-proxy.c 2023-07-25 10:28:22.000000000 +0200
@@ -950,16 +950,21 @@
SensorDriver *driver = (SensorDriver *) drivers[i];
if (!driver_type_exists (data, driver->type) &&
driver_discover (driver, device)) {
+ SensorDevice *sensor_device = NULL;
+
g_debug ("Found hotplugged device %s of type %s at %s",
g_udev_device_get_sysfs_path (device),
driver_type_to_str (driver->type),
driver->driver_name);
- if (driver_open (driver, device,
- driver_type_to_callback_func (driver->type), data)) {
+ sensor_device = driver_open (driver, device,
+ driver_type_to_callback_func (driver->type), data);
+
+ if (sensor_device) {
GHashTable *ht;
UDEV_DEVICE_FOR_TYPE(driver->type) = g_object_ref (device);
+ DEVICE_FOR_TYPE(driver->type) = sensor_device;
DRIVER_FOR_TYPE(driver->type) = (SensorDriver *) driver;
send_driver_changed_dbus_event (data, driver->type);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/iio-sensor-proxy-3.4/src/meson.build new/iio-sensor-proxy-3.5/src/meson.build
--- old/iio-sensor-proxy-3.4/src/meson.build 2022-07-15 15:08:38.000000000 +0200
+++ new/iio-sensor-proxy-3.5/src/meson.build 2023-07-25 10:28:22.000000000 +0200
@@ -50,18 +50,22 @@
install: false
)
-executable('test-mount-matrix',
+test_mount_matrix = executable('test-mount-matrix',
[ 'test-mount-matrix.c', 'accel-mount-matrix.c' ],
dependencies: deps,
install: false
)
-executable('test-orientation',
+test('test-mount-matrix', test_mount_matrix)
+
+test_orientation = executable('test-orientation',
[ 'test-orientation.c', 'orientation.c', 'accel-mount-matrix.c', 'accel-scale.c' ],
dependencies: deps,
install: false
)
+test('test-orientation', test_orientation)
+
if get_option('gtk-tests')
executable('test-orientation-gtk',
[ 'test-orientation-gtk.c', 'orientation.c', 'accel-scale.c' ],
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/iio-sensor-proxy-3.4/tests/integration-test.py new/iio-sensor-proxy-3.5/tests/integration-test.py
--- old/iio-sensor-proxy-3.4/tests/integration-test.py 2022-07-15 15:08:38.000000000 +0200
+++ new/iio-sensor-proxy-3.5/tests/integration-test.py 2023-07-25 10:28:22.000000000 +0200
@@ -643,6 +643,46 @@
self.stop_daemon()
+ def test_sampling_freq_available_integer(self):
+ 'Check whether the sampling frequency gets corrected to >= 10Hz, integer numbers sorted low to high'
+
+ accel = self.testbed.add_device('iio', 'iio-accel', None,
+ ['in_accel_x_raw', '0',
+ 'in_accel_y_raw', '-256000000',
+ 'in_accel_z_raw', '0',
+ 'in_accel_scale', '0.000001',
+ 'sampling_frequency', '5.2',
+ # Real world example taken from LSM303DA accelerometer
+ 'sampling_frequency_available', '3 6 12 25 50 100 200 400 800 1600',
+ 'name', 'IIO Test Accelerometer'],
+ ['NAME', '"IIO Accelerometer"',
+ 'IIO_SENSOR_PROXY_TYPE', 'iio-poll-accel']
+ )
+ self.start_daemon()
+ self.assertEqual(self.get_dbus_property('HasAccelerometer'), True)
+ self.assertEqual(self.read_sysfs_attr(accel, 'sampling_frequency'), b'12')
+ self.stop_daemon()
+
+ def test_sampling_freq_available_double(self):
+ 'Check whether the sampling frequency gets corrected to >= 10Hz, double numbers sorted high to low'
+
+ accel = self.testbed.add_device('iio', 'iio-accel', None,
+ ['in_accel_x_raw', '0',
+ 'in_accel_y_raw', '-256000000',
+ 'in_accel_z_raw', '0',
+ 'in_accel_scale', '0.000001',
+ 'sampling_frequency', '5.2',
+ # Real world example taken from drivers/iio/accel/mma8452.c
+ 'sampling_frequency_available', '800.000000 400.000000 200.000000 100.000000 50.000000 12.500000 6.250000 1.560000',
+ 'name', 'IIO Test Accelerometer'],
+ ['NAME', '"IIO Accelerometer"',
+ 'IIO_SENSOR_PROXY_TYPE', 'iio-poll-accel']
+ )
+ self.start_daemon()
+ self.assertEqual(self.get_dbus_property('HasAccelerometer'), True)
+ self.assertEqual(self.read_sysfs_attr(accel, 'sampling_frequency'), b'12.5')
+ self.stop_daemon()
+
def test_iio_scale_decimal_separator2(self):
'''scale decimal separator polling'''
accel = self.testbed.add_device('iio', 'iio-accel', None,