1
0
Fork 0
mirror of https://gitlab.postmarketos.org/postmarketOS/pmaports.git synced 2025-07-12 16:19:48 +03:00
pmaports/temp/iio-sensor-proxy/0013-integration-test-add-test-for-sensors-that-report-no.patch
Sicelo A. Mhlongo b2399f7f09
temp: iio-sensor-proxy: import fix for broken buffer sensors
Import
https://gitlab.freedesktop.org/hadess/iio-sensor-proxy/-/merge_requests/400
pending merge and tagging of new upstream release.

In pmOS, the chromebooks need these patches, since their accelerometer driver
has been found to implement buffers in a broken way.

Part-of: https://gitlab.postmarketos.org/postmarketos/pmaports/-/merge_requests/6747
2025-07-06 11:46:09 +02:00

63 lines
2.7 KiB
Diff

From 5349b67bf68e07b3d4fef5d39579a2879a144a65 Mon Sep 17 00:00:00 2001
From: "Sicelo A. Mhlongo" <absicsz@gmail.com>
Date: Mon, 26 May 2025 18:05:38 +0200
Subject: [PATCH 4/4] integration-test: add test for sensors that report
non-working buffers
Confirm that when a sensor reports support for buffer operation, and the mode
can actually be enabled, but no data is returned, iio-sensor-proxy will detect
this and switch to polling mode.
---
tests/integration-test.py | 36 ++++++++++++++++++++++++++++++++++++
1 file changed, 36 insertions(+)
diff --git a/tests/integration-test.py b/tests/integration-test.py
index b596eaa..95b9da3 100755
--- a/tests/integration-test.py
+++ b/tests/integration-test.py
@@ -630,6 +630,42 @@ class Tests(dbusmock.DBusTestCase):
self.stop_daemon()
+ def test_iio_broken_buffer_accel(self):
+ '''iio sensor reporting broken buffer support'''
+ 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', '',
+ '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 iio-poll-accel']
+ )
+ trigger = self.testbed.add_device('iio', 'trigger0', None,
+ ['name', 'accel_3d-dev0'],
+ []
+ )
+ self.start_daemon()
+ self.assertEqual(self.have_text_in_log('Built channel array'), True)
+ self.assertEqual(self.have_text_in_log('Disabled sensor'), True)
+ self.assertEqual(self.have_text_in_log('Found IIO poll accelerometer'), True)
+ self.assertEqual(self.get_dbus_property('HasAccelerometer'), True)
+
+ self.stop_daemon()
+
def test_unrequested_readings(self):
'''unrequested property updates'''
self.testbed.add_device('input', 'fake-light', None,
--
2.50.0