diff options
author | Bart Ribbers <bribbers@disroot.org> | 2020-02-25 10:43:52 +0100 |
---|---|---|
committer | Leo <thinkabit.ukim@gmail.com> | 2020-02-25 07:48:23 -0300 |
commit | 862ae97d4ad4f59f52c18c732fb0ab2b2929cd15 (patch) | |
tree | 1f3e3ec0518477723a90cae1826cf1f3b6540139 /community/iio-sensor-proxy | |
parent | 5851615b553d8b2dd7a74be84671ca1083a687ad (diff) | |
download | aports-862ae97d4ad4f59f52c18c732fb0ab2b2929cd15.tar.bz2 aports-862ae97d4ad4f59f52c18c732fb0ab2b2929cd15.tar.xz |
community/iio-sensor-proxy: add patches for Tegra devices
Patches have been merged upstream already but there is no new release
yet. Will be included in 2.9
Diffstat (limited to 'community/iio-sensor-proxy')
-rw-r--r-- | community/iio-sensor-proxy/292.patch | 68 | ||||
-rw-r--r-- | community/iio-sensor-proxy/299.patch | 91 | ||||
-rw-r--r-- | community/iio-sensor-proxy/APKBUILD | 10 |
3 files changed, 166 insertions, 3 deletions
diff --git a/community/iio-sensor-proxy/292.patch b/community/iio-sensor-proxy/292.patch new file mode 100644 index 0000000000..d5c7b0d487 --- /dev/null +++ b/community/iio-sensor-proxy/292.patch @@ -0,0 +1,68 @@ +From eba0aca224c18624b7e398171fb8688728baf398 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Guido=20G=C3=BCnther?= <agx@sigxcpu.org> +Date: Sat, 21 Dec 2019 14:31:51 +0100 +Subject: [PATCH] light: Support sensors using raw values as well + +E.g. the vcnl4000 class devices reports a raw value and a scale +to calculate lux. +--- + data/80-iio-sensor-proxy.rules | 1 + + src/drv-iio-poll-light.c | 16 ++++++++++++++-- + 2 files changed, 15 insertions(+), 2 deletions(-) + +diff --git a/data/80-iio-sensor-proxy.rules b/data/80-iio-sensor-proxy.rules +index 06040dc..5bcb207 100644 +--- a/data/80-iio-sensor-proxy.rules ++++ b/data/80-iio-sensor-proxy.rules +@@ -9,6 +9,7 @@ SUBSYSTEM=="iio", TEST=="in_accel_x_raw", TEST=="in_accel_y_raw", TEST=="in_acce + SUBSYSTEM=="iio", TEST=="scan_elements/in_accel_x_en", TEST=="scan_elements/in_accel_y_en", TEST=="scan_elements/in_accel_z_en", ENV{IIO_SENSOR_PROXY_TYPE}="iio-buffer-accel" + SUBSYSTEM=="iio", TEST=="scan_elements/in_rot_from_north_magnetic_tilt_comp_en", ENV{IIO_SENSOR_PROXY_TYPE}="iio-buffer-compass" + SUBSYSTEM=="iio", TEST=="in_illuminance_input", ENV{IIO_SENSOR_PROXY_TYPE}="iio-poll-als" ++SUBSYSTEM=="iio", TEST=="in_illuminance_raw", ENV{IIO_SENSOR_PROXY_TYPE}="iio-poll-als" + SUBSYSTEM=="iio", TEST=="scan_elements/in_intensity_both_en", ENV{IIO_SENSOR_PROXY_TYPE}="iio-buffer-als" + SUBSYSTEM=="input", ENV{ID_INPUT_ACCELEROMETER}=="1", ENV{IIO_SENSOR_PROXY_TYPE}="input-accel" + +diff --git a/src/drv-iio-poll-light.c b/src/drv-iio-poll-light.c +index d0da7df..a7423c6 100644 +--- a/src/drv-iio-poll-light.c ++++ b/src/drv-iio-poll-light.c +@@ -24,6 +24,8 @@ typedef struct DrvData { + char *input_path; + guint interval; + guint timeout_id; ++ ++ double scale; + } DrvData; + + static DrvData *drv_data = NULL; +@@ -55,8 +57,8 @@ light_changed (gpointer user_data) + g_error_free (error); + return G_SOURCE_CONTINUE; + } +- +- readings.level = level; ++ readings.level = level * drv_data->scale; ++ g_debug ("Light read from IIO: %lf, (scale %lf)", level, drv_data->scale); + + /* Even though the IIO kernel API declares in_intensity* values as unitless, + * we use Microsoft's hid-sensors-usages.docx which mentions that Windows 8 +@@ -125,6 +127,16 @@ iio_poll_light_open (GUdevDevice *device, + drv_data->input_path = g_build_filename (g_udev_device_get_sysfs_path (device), + "in_illuminance_input", + NULL); ++ if (!g_file_test (drv_data->input_path, G_FILE_TEST_EXISTS)) { ++ g_free (drv_data->input_path); ++ drv_data->input_path = g_build_filename (g_udev_device_get_sysfs_path (device), ++ "in_illuminance_raw", ++ NULL); ++ } ++ ++ drv_data->scale = g_udev_device_get_sysfs_attr_as_double (device, "in_illuminance_scale"); ++ if (drv_data->scale == 0.0) ++ drv_data->scale = 1.0; + + return TRUE; + } +-- +2.24.1 + diff --git a/community/iio-sensor-proxy/299.patch b/community/iio-sensor-proxy/299.patch new file mode 100644 index 0000000000..971418102e --- /dev/null +++ b/community/iio-sensor-proxy/299.patch @@ -0,0 +1,91 @@ +From e11bb33e7b179e2a8198653ee7bf4c044f3eff1e Mon Sep 17 00:00:00 2001 +From: Dmitry Osipenko <digetx@gmail.com> +Date: Sat, 18 Jan 2020 19:29:08 +0300 +Subject: [PATCH 1/2] mount-matrix: Support IIO sysfs in_mount_matrix + +Linux kernel IIO drivers provide mount matrix via standardized sysfs +interface. The IIO mount matrix could specified by "directory" and by +"type", this patch adds support for the "directory" type which may be +used by drivers that use the same shared matrix for all of the sensors +or if driver provides only one accelerometer sensor at all. +--- + src/accel-mount-matrix.c | 15 +++++++++++++++ + 1 file changed, 15 insertions(+) + +diff --git a/src/accel-mount-matrix.c b/src/accel-mount-matrix.c +index c66b440..25a0ea5 100644 +--- a/src/accel-mount-matrix.c ++++ b/src/accel-mount-matrix.c +@@ -50,6 +50,21 @@ setup_mount_matrix (GUdevDevice *device) + g_clear_pointer (&ret, g_free); + } + ++ /* Linux kernel IIO accelerometer drivers provide mount matrix ++ * via standardized sysfs interface. ++ * ++ * See https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-bus-iio ++ * for more details. */ ++ mount_matrix = g_udev_device_get_sysfs_attr (device, "in_mount_matrix"); ++ if (mount_matrix) { ++ if (parse_mount_matrix (mount_matrix, &ret)) ++ return ret; ++ ++ g_warning ("Failed to parse in_mount_matrix ('%s') from sysfs", ++ mount_matrix); ++ g_clear_pointer (&ret, g_free); ++ } ++ + g_debug ("Failed to auto-detect mount matrix, falling back to identity"); + parse_mount_matrix (NULL, &ret); + return ret; +-- +2.24.1 + + +From 9fdbb3636370e3681f7700fd5c6c66c8003e3b13 Mon Sep 17 00:00:00 2001 +From: Dmitry Osipenko <digetx@gmail.com> +Date: Mon, 20 Jan 2020 22:48:52 +0300 +Subject: [PATCH 2/2] mount-matrix: Support IIO sysfs in_accel_mount_matrix + +Linux kernel IIO drivers provide mount matrix via standardized sysfs +interface. The IIO mount matrix could specified by "directory" and by +"type", this patch adds support for the "by type" option which is used +by drivers that use individual matrices for each of the sensors. Tested +on Nexus 7 and Acer A500 tablet devices using MPU6050 and KXTF9 IIO drivers +respectively, now monitor-sensor reports display's orientation correctly +on these devices. +--- + src/accel-mount-matrix.c | 17 +++++++++++++++++ + 1 file changed, 17 insertions(+) + +diff --git a/src/accel-mount-matrix.c b/src/accel-mount-matrix.c +index 25a0ea5..0ba0191 100644 +--- a/src/accel-mount-matrix.c ++++ b/src/accel-mount-matrix.c +@@ -50,6 +50,23 @@ setup_mount_matrix (GUdevDevice *device) + g_clear_pointer (&ret, g_free); + } + ++ /* Some IIO drivers provide multiple sensors via the same sysfs path ++ * and thus they may have different matrices like in a case of ++ * accelerometer and angular velocity for example. The accelerometer ++ * mount matrix is named as in_accel_mount_matrix in that case. ++ * ++ * See https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-bus-iio ++ * for more details. */ ++ mount_matrix = g_udev_device_get_sysfs_attr (device, "in_accel_mount_matrix"); ++ if (mount_matrix) { ++ if (parse_mount_matrix (mount_matrix, &ret)) ++ return ret; ++ ++ g_warning ("Failed to parse in_accel_mount_matrix ('%s') from sysfs", ++ mount_matrix); ++ g_clear_pointer (&ret, g_free); ++ } ++ + /* Linux kernel IIO accelerometer drivers provide mount matrix + * via standardized sysfs interface. + * +-- +2.24.1 + diff --git a/community/iio-sensor-proxy/APKBUILD b/community/iio-sensor-proxy/APKBUILD index de8b196570..8fff4499ce 100644 --- a/community/iio-sensor-proxy/APKBUILD +++ b/community/iio-sensor-proxy/APKBUILD @@ -2,7 +2,7 @@ # Maintainer: Rasmus Thomsen <oss@cogitri.dev> pkgname=iio-sensor-proxy pkgver=2.8 -pkgrel=1 +pkgrel=2 pkgdesc="IIO sensors to D-Bus proxy" url="https://developer.gnome.org/iio-sensor-proxy/1.0/" arch="all" @@ -11,7 +11,9 @@ makedepends="eudev-dev libgudev-dev glib-dev autoconf automake libtool gtk+3.0-d subpackages="$pkgname-doc $pkgname-openrc" source="https://github.com/hadess/iio-sensor-proxy/releases/download/$pkgver/iio-sensor-proxy-$pkgver.tar.xz iio-sensor-proxy.initd - 0001-Revert-build-Check-for-.pc-files-before-using-them.patch" + 0001-Revert-build-Check-for-.pc-files-before-using-them.patch + 292.patch + 299.patch" prepare() { default_prepare @@ -42,4 +44,6 @@ package() { sha512sums="2631ca1bc3fc115d392772010c0e879750cdb1f8d3bb247483527481232c9107212d2c8cbf3bdc30942ef3bd34f4e5c56f168367cafcb8d6381b47ff908014c8 iio-sensor-proxy-2.8.tar.xz b0f2875074ff1211faeca3e29b32f60c5604ca31b6dac3d4d99f057ed32e2453aefc4495c34cf3885badacc7168b6c032f3d084052db52977bbe8438e76eac5f iio-sensor-proxy.initd -5480763f85cb22fd7b1b791609baa3a4b251fc30a025b40aee2de584fa114686bf181a87a249ba4b0cb9080881ff55498baa7e496513bc39fa1af7c43253c465 0001-Revert-build-Check-for-.pc-files-before-using-them.patch" +5480763f85cb22fd7b1b791609baa3a4b251fc30a025b40aee2de584fa114686bf181a87a249ba4b0cb9080881ff55498baa7e496513bc39fa1af7c43253c465 0001-Revert-build-Check-for-.pc-files-before-using-them.patch +68a2815f4bd54c05af286a096ca8b7cac11e159cb47b012187b277ff03a9a73f0e0c26e5e67b1855e6d67714f9be8cf94a6292d5e3d85d23ced00f43ae75f433 292.patch +b7aef50fb08e33ebca508da4c394dfa02135a9da2c2efac73f3d43b6bfe3e973484892c9f3ec76e9a762b32c0f647e42de6f0bad5ec4b520e14dfc6ae6839445 299.patch" |