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 2021-10-04 18:39:07
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/iio-sensor-proxy (Old)
 and      /work/SRC/openSUSE:Factory/.iio-sensor-proxy.new.2443 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "iio-sensor-proxy"

Mon Oct  4 18:39:07 2021 rev:20 rq:922372 version:3.3

Changes:
--------
--- /work/SRC/openSUSE:Factory/iio-sensor-proxy/iio-sensor-proxy.changes        
2021-06-18 10:14:12.998028377 +0200
+++ 
/work/SRC/openSUSE:Factory/.iio-sensor-proxy.new.2443/iio-sensor-proxy.changes  
    2021-10-04 18:39:34.778019967 +0200
@@ -1,0 +2,13 @@
+Thu Sep 30 00:25:09 UTC 2021 - Atri Bhattacharya <[email protected]>
+
+- Update to version 3.3:
+  * Fix a bug left-over in one of the 3.2 bug fixes where some
+    accelerometers would fail to initialise.
+- Changes from version 3.2:
+  * Fix problems parsing numbers with decimal separator.
+- Require gudev >= 237 for building (for consistency with
+  upstream).
+- Drop the rpmlintrc file and add back appropriate service macros
+  in pre/post scriptlets.
+
+-------------------------------------------------------------------

Old:
----
  iio-sensor-proxy-3.1.tar.bz2
  iio-sensor-proxy-rpmlintrc

New:
----
  iio-sensor-proxy-3.3.tar.bz2

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ iio-sensor-proxy.spec ++++++
--- /var/tmp/diff_new_pack.IKCApV/_old  2021-10-04 18:39:35.194020643 +0200
+++ /var/tmp/diff_new_pack.IKCApV/_new  2021-10-04 18:39:35.198020650 +0200
@@ -17,21 +17,19 @@
 
 
 Name:           iio-sensor-proxy
-Version:        3.1
+Version:        3.3
 Release:        0
 Summary:        Proxy for IIO and input subsystems
 License:        GPL-3.0-only
 Group:          System/Monitoring
 URL:            https://gitlab.freedesktop.org/hadess/iio-sensor-proxy
 Source0:        %{url}/-/archive/%{version}/%{name}-%{version}.tar.bz2
-
-Source99:       iio-sensor-proxy-rpmlintrc
 BuildRequires:  gtk-doc
 BuildRequires:  meson
 BuildRequires:  pkgconfig
 BuildRequires:  pkgconfig(glib-2.0) >= 2.56
 BuildRequires:  pkgconfig(gobject-2.0)
-BuildRequires:  pkgconfig(gudev-1.0) >= 234
+BuildRequires:  pkgconfig(gudev-1.0) >= 237
 BuildRequires:  pkgconfig(systemd) >= 219
 BuildRequires:  pkgconfig(udev) >= 219
 Requires:       user(srvGeoClue)
@@ -61,13 +59,21 @@
 %install
 %meson_install
 
+%pre
+%service_add_pre %{name}.service
+
+%preun
+%service_del_preun %{name}.service
+
 %post
 %udev_hwdb_update
 %udev_rules_update
+%service_add_post %{name}.service
 
 %postun
 %udev_hwdb_update
 %udev_rules_update
+%service_del_postun %{name}.service
 
 %files
 %{_bindir}/monitor-sensor

++++++ iio-sensor-proxy-3.1.tar.bz2 -> iio-sensor-proxy-3.3.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/iio-sensor-proxy-3.1/.gitlab-ci.yml 
new/iio-sensor-proxy-3.3/.gitlab-ci.yml
--- old/iio-sensor-proxy-3.1/.gitlab-ci.yml     2021-06-14 13:40:32.000000000 
+0200
+++ new/iio-sensor-proxy-3.3/.gitlab-ci.yml     2021-08-16 14:52:44.000000000 
+0200
@@ -2,6 +2,7 @@
 
 variables:
   DEPENDENCIES: gcc
+                glibc-langpack-fr
                 gtk-doc
                 pkgconfig(udev)
                 pkgconfig(systemd)
@@ -18,10 +19,11 @@
 
 build_stable:
   before_script:
-    - dnf upgrade -y --nogpgcheck fedora-release fedora-repos*
-    # Work-around uninstallable python-dbusmock
-    - dnf install -y 
https://kojipkgs.fedoraproject.org//packages/python-dbusmock/0.23.0/1.fc35/noarch/python3-dbusmock-0.23.0-1.fc35.noarch.rpm
+    # Undo delangification present in the Fedora Docker images
+    - rm -f /etc/rpm/macros.image-language-conf
     - dnf update -y && dnf install -y $DEPENDENCIES
+    - dnf reinstall -y glib2
+    - rpm -Uvh 
https://kojipkgs.fedoraproject.org//work/tasks/4390/73864390/libgudev-237-1.fc36.x86_64.rpm
 
https://kojipkgs.fedoraproject.org//work/tasks/4390/73864390/libgudev-devel-237-1.fc36.x86_64.rpm
   script:
     - meson -Dgtk_doc=true -Dgtk-tests=true _build
     - ninja -v -C _build
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/iio-sensor-proxy-3.1/NEWS 
new/iio-sensor-proxy-3.3/NEWS
--- old/iio-sensor-proxy-3.1/NEWS       2021-06-14 13:40:32.000000000 +0200
+++ new/iio-sensor-proxy-3.3/NEWS       2021-08-16 14:52:44.000000000 +0200
@@ -1,3 +1,17 @@
+3.3
+---
+
+This update fixes a bug left-over in one of the 3.2 bug fixes where some
+accelerometers would fail to initialise.
+
+3.2
+---
+
+This update fixes a number of problems new to 3.1 where we started initialising
+internationalisation support in the daemon, and caused problems parsing
+numbers with decimal separator. This update also requires an updated
+version of libgudev to fix one of the bugs uncovered.
+
 3.1
 ---
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/iio-sensor-proxy-3.1/meson.build 
new/iio-sensor-proxy-3.3/meson.build
--- old/iio-sensor-proxy-3.1/meson.build        2021-06-14 13:40:32.000000000 
+0200
+++ new/iio-sensor-proxy-3.3/meson.build        2021-08-16 14:52:44.000000000 
+0200
@@ -1,5 +1,5 @@
 project('iio-sensor-proxy', [ 'c' ],
-        version: '3.1',
+        version: '3.3',
         license: 'GPLv3+',
         default_options: [
           'buildtype=debugoptimized',
@@ -43,7 +43,7 @@
     gtk_dep = dependency('gtk+-3.0', required: false)
 endif
 gio_dep = dependency('gio-2.0')
-gudev_dep = dependency('gudev-1.0', version: '>= 234')
+gudev_dep = dependency('gudev-1.0', version: '>= 237')
 
 gnome = import('gnome')
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/iio-sensor-proxy-3.1/src/accel-mount-matrix.c 
new/iio-sensor-proxy-3.3/src/accel-mount-matrix.c
--- old/iio-sensor-proxy-3.1/src/accel-mount-matrix.c   2021-06-14 
13:40:32.000000000 +0200
+++ new/iio-sensor-proxy-3.3/src/accel-mount-matrix.c   2021-08-16 
14:52:44.000000000 +0200
@@ -87,33 +87,69 @@
        return ret;
 }
 
+static char **
+strsplit_num_tokens (const gchar *string,
+                     const gchar *delimiter,
+                     gint         num_tokens)
+{
+       g_auto(GStrv) elems = NULL;
+       guint i;
+
+       elems = g_strsplit (string, delimiter, num_tokens);
+       if (elems == NULL)
+               return NULL;
+       for (i = 0; i < num_tokens; i++) {
+               if (elems[i] == NULL)
+                       return NULL;
+       }
+       return g_steal_pointer (&elems);
+}
+
 gboolean
-parse_mount_matrix (const char *mtx,
-                   AccelVec3  *vecs[3])
+parse_mount_matrix (const char  *mtx,
+                   AccelVec3  **vecs)
 {
        AccelVec3 *ret;
        guint i;
+       g_auto(GStrv) axis = NULL;
 
        g_return_val_if_fail (vecs != NULL, FALSE);
 
 
        /* Empty string means we use the identity matrix */
        if (mtx == NULL || *mtx == '\0') {
+#if GLIB_CHECK_VERSION(2, 68, 0)
+               *vecs = g_memdup2 (id_matrix, sizeof(id_matrix));
+#else
                *vecs = g_memdup (id_matrix, sizeof(id_matrix));
+#endif
                return TRUE;
        }
 
        ret = g_new0 (AccelVec3, 3);
-       if (sscanf (mtx, "%f, %f, %f; %f, %f, %f; %f, %f, %f",
-                   &ret[0].x, &ret[0].y, &ret[0].z,
-                   &ret[1].x, &ret[1].y, &ret[1].z,
-                   &ret[2].x, &ret[2].y, &ret[2].z) != 9) {
+       axis = strsplit_num_tokens (mtx, ";", 3);
+       if (!axis) {
                g_free (ret);
                g_warning ("Failed to parse '%s' as a mount matrix", mtx);
                return FALSE;
        }
 
        for (i = 0; i < G_N_ELEMENTS(id_matrix); i++) {
+               g_auto(GStrv) elems = NULL;
+
+               elems = strsplit_num_tokens (axis[i], ",", 3);
+               if (elems == NULL) {
+                       g_free (ret);
+                       g_warning ("Failed to parse '%s' as a mount matrix", 
mtx);
+                       return FALSE;
+               }
+
+               ret[i].x = g_ascii_strtod (elems[0], NULL);
+               ret[i].y = g_ascii_strtod (elems[1], NULL);
+               ret[i].z = g_ascii_strtod (elems[2], NULL);
+       }
+
+       for (i = 0; i < G_N_ELEMENTS(id_matrix); i++) {
                if (ret[i].x == 0.0f &&
                    ret[i].y == 0.0f &&
                    ret[i].z == 0.0f) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/iio-sensor-proxy-3.1/src/accel-mount-matrix.h 
new/iio-sensor-proxy-3.3/src/accel-mount-matrix.h
--- old/iio-sensor-proxy-3.1/src/accel-mount-matrix.h   2021-06-14 
13:40:32.000000000 +0200
+++ new/iio-sensor-proxy-3.3/src/accel-mount-matrix.h   2021-08-16 
14:52:44.000000000 +0200
@@ -18,8 +18,8 @@
 
 AccelVec3 *setup_mount_matrix (GUdevDevice *device);
 
-gboolean parse_mount_matrix (const char *mtx,
-                             AccelVec3  *vecs[3]);
+gboolean parse_mount_matrix (const char  *mtx,
+                             AccelVec3  **vecs);
 
 gboolean apply_mount_matrix (const AccelVec3  vecs[3],
                              AccelVec3       *accel);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/iio-sensor-proxy-3.1/src/iio-buffer-utils.c 
new/iio-sensor-proxy-3.3/src/iio-buffer-utils.c
--- old/iio-sensor-proxy-3.1/src/iio-buffer-utils.c     2021-06-14 
13:40:32.000000000 +0200
+++ new/iio-sensor-proxy-3.3/src/iio-buffer-utils.c     2021-08-16 
14:52:44.000000000 +0200
@@ -155,8 +155,9 @@
                          const char *name,
                          const char *generic_name)
 {
-       g_autoptr(FILE) sysfsfp = NULL;
        char *builtname, *filename;
+       g_autofree char *contents = NULL;
+       g_autoptr(GError) error = NULL;
        int ret = 0;
 
        g_debug ("Trying to read '%s_%s' (name) from dir '%s'", name, 
param_name, device_dir);
@@ -165,16 +166,17 @@
        filename = g_build_filename (device_dir, builtname, NULL);
        g_free (builtname);
 
-       sysfsfp = fopen (filename, "r");
-       if (sysfsfp) {
-               ret = fscanf (sysfsfp, "%f", output);
-               g_free (filename);
-               if (ret == 1)
+       if (g_file_get_contents (filename, &contents, NULL, &error)) {
+               char *endptr;
+               *output = g_ascii_strtod (contents, &endptr);
+               if (*output != 0.0 || endptr != contents)
                        return 0;
+               g_warning ("Couldn't convert '%s' from %s to float", g_strchomp 
(contents), filename);
+               g_clear_pointer (&contents, g_free);
+       } else {
+               g_debug ("Failed to read float from %s: %s", filename, 
error->message);
+               g_clear_error (&error);
        }
-
-       ret = -errno;
-       g_debug ("Failed to read float from %s: %s", filename, g_strerror 
(-ret));
        g_free (filename);
 
        g_debug ("Trying to read '%s_%s' (generic name) from dir '%s'", 
generic_name, param_name, device_dir);
@@ -183,20 +185,22 @@
        filename = g_build_filename (device_dir, builtname, NULL);
        g_free (builtname);
 
-       sysfsfp = fopen (filename, "r");
-       if (sysfsfp) {
-               if (fscanf (sysfsfp, "%f", output) != 1) {
-                       g_debug ("Failed to read float from %s", filename);
+       if (g_file_get_contents (filename, &contents, NULL, &error)) {
+               char *endptr;
+               *output = g_ascii_strtod (contents, &endptr);
+               if (*output == 0.0 && endptr == contents) {
+                       g_warning ("Couldn't convert '%s' from %s to float", 
g_strchomp (contents), filename);
                        ret = -EINVAL;
                }
        } else {
-               ret = -errno;
-               if (ret != -ENOENT)
-                       g_warning ("Failed to read float from %s: %s", 
filename, g_strerror (-ret));
-               else
-                       g_debug ("Failed to read float from %s: %s", filename, 
g_strerror (-ret));
+               if (g_error_matches (error, G_FILE_ERROR, G_FILE_ERROR_NOENT)) {
+                       ret = -ENOENT;
+                       g_debug ("Failed to read float from non-existent %s", 
filename);
+               } else {
+                       ret = -EINVAL;
+                       g_warning ("Failed to read float from %s: %s", 
filename, error->message);
+               }
        }
-
        g_free (filename);
 
        return ret;
@@ -296,6 +300,8 @@
                                                        current->generic_name);
                        if ((ret < 0) && (ret != -ENOENT))
                                goto error;
+                       if (current->scale == 0.0)
+                               goto error;
 
                        ret = iioutils_get_param_float (&current->offset,
                                                        "offset",
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/iio-sensor-proxy-3.1/src/test-accel-location.c 
new/iio-sensor-proxy-3.3/src/test-accel-location.c
--- old/iio-sensor-proxy-3.1/src/test-accel-location.c  2021-06-14 
13:40:32.000000000 +0200
+++ new/iio-sensor-proxy-3.3/src/test-accel-location.c  2021-08-16 
14:52:44.000000000 +0200
@@ -7,6 +7,7 @@
  *
  */
 
+#include <locale.h>
 #include "accel-attributes.h"
 
 #define VALID_DISPLAY_LOCATION "display"
@@ -60,6 +61,7 @@
 
 int main (int argc, char **argv)
 {
+       setlocale(LC_ALL, "");
        g_test_init (&argc, &argv, NULL);
 
        g_test_add_func ("/iio-sensor-proxy/accel-location", 
test_accel_location);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/iio-sensor-proxy-3.1/src/test-mount-matrix.c 
new/iio-sensor-proxy-3.3/src/test-mount-matrix.c
--- old/iio-sensor-proxy-3.1/src/test-mount-matrix.c    2021-06-14 
13:40:32.000000000 +0200
+++ new/iio-sensor-proxy-3.3/src/test-mount-matrix.c    2021-08-16 
14:52:44.000000000 +0200
@@ -7,10 +7,12 @@
  *
  */
 
+#include <locale.h>
 #include "accel-mount-matrix.h"
 
 #define SWAP_Y_Z_MATRIX "1, 0, 0; 0, 0, 1; 0, 1, 0"
 #define INVALID_MATRIX "0, 1, 0; 1, 0, 0; 0, 0, 0"
+#define DEFAULT_MATRIX "1, 0, 0; 0, 1, 0; 0, 0, 1"
 
 static void
 print_vecs (AccelVec3 vecs[3])
@@ -61,11 +63,30 @@
        g_test_assert_expected_messages ();
 }
 
+static void
+test_comma_decimal_separator (void)
+{
+       char *old_locale;
+       AccelVec3 *vecs;
+
+       old_locale = setlocale (LC_ALL, "fr_FR.UTF-8");
+       /* French locale not available? */
+       g_assert_nonnull (old_locale);
+
+       /* Default matrix */
+       g_assert_true (parse_mount_matrix (DEFAULT_MATRIX, &vecs));
+       g_free (vecs);
+
+       setlocale (LC_ALL, old_locale);
+}
+
 int main (int argc, char **argv)
 {
+       setlocale(LC_ALL, "");
        g_test_init (&argc, &argv, NULL);
 
        g_test_add_func ("/iio-sensor-proxy/mount-matrix", test_mount_matrix);
+       g_test_add_func ("/iio-sensor-proxy/comma-decimal-separator", 
test_comma_decimal_separator);
 
        return g_test_run ();
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/iio-sensor-proxy-3.1/src/test-orientation-gtk.c 
new/iio-sensor-proxy-3.3/src/test-orientation-gtk.c
--- old/iio-sensor-proxy-3.1/src/test-orientation-gtk.c 2021-06-14 
13:40:32.000000000 +0200
+++ new/iio-sensor-proxy-3.3/src/test-orientation-gtk.c 2021-08-16 
14:52:44.000000000 +0200
@@ -7,6 +7,7 @@
  *
  */
 
+#include <locale.h>
 #include <gtk/gtk.h>
 #include "orientation.h"
 
@@ -37,6 +38,7 @@
        GtkWidget *window;
        GtkWidget *grid;
 
+       setlocale(LC_ALL, "");
        gtk_init (&argc, &argv);
 
        window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/iio-sensor-proxy-3.1/src/test-orientation.c 
new/iio-sensor-proxy-3.3/src/test-orientation.c
--- old/iio-sensor-proxy-3.1/src/test-orientation.c     2021-06-14 
13:40:32.000000000 +0200
+++ new/iio-sensor-proxy-3.3/src/test-orientation.c     2021-08-16 
14:52:44.000000000 +0200
@@ -9,6 +9,7 @@
 
 #include <glib.h>
 #include <stdlib.h>
+#include <locale.h>
 #include "orientation.h"
 #include "accel-mount-matrix.h"
 
@@ -207,6 +208,7 @@
 
 int main (int argc, char **argv)
 {
+       setlocale(LC_ALL, "");
        g_test_init (&argc, &argv, NULL);
 
        if (argc > 1) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/iio-sensor-proxy-3.1/tests/integration-test 
new/iio-sensor-proxy-3.3/tests/integration-test
--- old/iio-sensor-proxy-3.1/tests/integration-test     2021-06-14 
13:40:32.000000000 +0200
+++ new/iio-sensor-proxy-3.3/tests/integration-test     2021-08-16 
14:52:44.000000000 +0200
@@ -549,6 +549,122 @@
 
         self.stop_daemon()
 
+    def test_iio_scale_decimal_separator(self):
+        '''scale decimal separator'''
+        top_srcdir = os.getenv('top_srcdir', '.')
+        mock_dev_data = self.testbed.get_root_dir() + '/iio-dev-data.bin'
+        accel = self.testbed.add_device('iio', 'iio-buffer-accel0', None,
+            ['name', 'IIO Test Accelerometer',
+             'buffer/enable', '0',
+             'trigger/current_trigger', '',
+             'in_accel_scale', '0.000010\n',
+             'in_accel_offset', '0.0\n',
+             'in_accel_mount_matrix', '1, 0, 0; 0, 1, 0; 0, 0, 1\n',
+             'scan_elements/in_accel_x_en', '0',
+             'scan_elements/in_accel_x_index', '0',
+             'scan_elements/in_accel_x_type', 'le:s16/32>>0',
+             'scan_elements/in_accel_y_en', '0',
+             'scan_elements/in_accel_y_index', '1',
+             'scan_elements/in_accel_y_type', 'le:s16/32>>0',
+             'scan_elements/in_accel_z_en', '0',
+             'scan_elements/in_accel_z_index', '2',
+             'scan_elements/in_accel_z_type', 'le:s16/32>>0',
+             'scan_elements/in_timestamp_en', '1',
+             'scan_elements/in_timestamp_index', '3',
+             'scan_elements/in_timestamp_type', 'le:s64/64>>0'],
+            ['NAME', '"IIO Accelerometer"',
+             'DEVNAME', '/dev/iio-buffer-accel-test',
+             'IIO_SENSOR_PROXY_TYPE', 'iio-buffer-accel']
+        )
+        trigger = self.testbed.add_device('iio', 'trigger0', None,
+            ['name', 'accel_3d-dev0'],
+            []
+        )
+        env = os.environ.copy()
+        env['LC_NUMERIC'] = 'fr_FR.UTF-8'
+        self.start_daemon(env=env)
+
+        self.assertEqual(self.get_dbus_property('HasAccelerometer'), True)
+        data = self.read_file(top_srcdir + 
'/tests/iio-buffer-accel-data/orientation-normal.bin')
+        with open(mock_dev_data,'wb') as mock_file:
+            mock_file.write(data)
+        self.proxy.ClaimAccelerometer()
+        self.assertEventually(lambda: self.have_text_in_log('Accel sent by 
driver'))
+        # If the 2nd test fails, it's likely that fr_FR.UTF-8 locale isn't 
supported
+        self.assertEqual(self.have_text_in_log('scale: 
0,000000,0,000000,0,000000'), False)
+        self.assertEqual(self.have_text_in_log('scale: 
0,000010,0,000010,0,000010'), True)
+
+        self.stop_daemon()
+
+    def test_iio_scale_decimal_separator_offset(self):
+        '''scale decimal separator with specific offset'''
+        top_srcdir = os.getenv('top_srcdir', '.')
+        mock_dev_data = self.testbed.get_root_dir() + '/iio-dev-data.bin'
+        accel = self.testbed.add_device('iio', 'iio-buffer-accel0', None,
+            ['name', 'IIO Test Accelerometer',
+             'buffer/enable', '0',
+             'trigger/current_trigger', '',
+             'in_accel_scale', '0.000010\n',
+             'in_accel_x_offset', '0.0\n',
+             'in_accel_mount_matrix', '1, 0, 0; 0, 1, 0; 0, 0, 1\n',
+             'scan_elements/in_accel_x_en', '0',
+             'scan_elements/in_accel_x_index', '0',
+             'scan_elements/in_accel_x_type', 'le:s16/32>>0',
+             'scan_elements/in_accel_y_en', '0',
+             'scan_elements/in_accel_y_index', '1',
+             'scan_elements/in_accel_y_type', 'le:s16/32>>0',
+             'scan_elements/in_accel_z_en', '0',
+             'scan_elements/in_accel_z_index', '2',
+             'scan_elements/in_accel_z_type', 'le:s16/32>>0',
+             'scan_elements/in_timestamp_en', '1',
+             'scan_elements/in_timestamp_index', '3',
+             'scan_elements/in_timestamp_type', 'le:s64/64>>0'],
+            ['NAME', '"IIO Accelerometer"',
+             'DEVNAME', '/dev/iio-buffer-accel-test',
+             'IIO_SENSOR_PROXY_TYPE', 'iio-buffer-accel']
+        )
+        trigger = self.testbed.add_device('iio', 'trigger0', None,
+            ['name', 'accel_3d-dev0'],
+            []
+        )
+        env = os.environ.copy()
+        env['LC_NUMERIC'] = 'fr_FR.UTF-8'
+        self.start_daemon(env=env)
+
+        self.assertEqual(self.get_dbus_property('HasAccelerometer'), True)
+
+        self.stop_daemon()
+
+    def test_iio_scale_decimal_separator2(self):
+        '''scale decimal separator polling'''
+        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',
+             'name', 'IIO Test Accelerometer'],
+            ['NAME', '"IIO Accelerometer"',
+             'IIO_SENSOR_PROXY_TYPE', 'iio-poll-accel']
+        )
+        env = os.environ.copy()
+        env['LC_NUMERIC'] = 'fr_FR.UTF-8'
+        self.start_daemon(env=env)
+
+        self.proxy.ClaimAccelerometer()
+        self.assertEventually(lambda: self.have_text_in_log('Accel read from 
IIO on'))
+        # If the 2nd test fails, it's likely that fr_FR.UTF-8 locale isn't 
supported
+        self.assertEqual(self.have_text_in_log('scale 
1,000000,1,000000,1,000000'), False)
+        self.assertEqual(self.have_text_in_log('scale 
0,000001,0,000001,0,000001'), True)
+
+        self.assertEventually(lambda: 
self.get_dbus_property('AccelerometerOrientation') == 'normal')
+
+        self.testbed.set_attribute(accel, 'in_accel_x_raw', '-256000000')
+        self.testbed.set_attribute(accel, 'in_accel_y_raw', '0')
+        self.assertEventually(lambda: 
self.get_dbus_property('AccelerometerOrientation') == 'right-up')
+
+        self.stop_daemon()
+
     #
     # Helper methods
     #

Reply via email to