diff --git a/temp/iio-sensor-proxy/0001-Revert-build-Check-for-.pc-files-before-using-them.patch b/temp/iio-sensor-proxy/0001-Revert-build-Check-for-.pc-files-before-using-them.patch new file mode 100644 index 000000000..ddf43770e --- /dev/null +++ b/temp/iio-sensor-proxy/0001-Revert-build-Check-for-.pc-files-before-using-them.patch @@ -0,0 +1,34 @@ +It only needs systemd to determine the unit dir, so delete the dep for now. + +From a1c5436d11e3e0dabc3cd236bf8175b13ac929cb Mon Sep 17 00:00:00 2001 +From: Andrea Brancaleoni +Date: Fri, 23 Dec 2016 12:43:36 +0100 +Subject: [PATCH] Revert "build: Check for .pc files before using them" + +This reverts commit 78b4656fc24a1b21c948d8e68252f42df2a91735. +--- + configure.ac | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/configure.ac b/configure.ac +index f8ded66..1d54698 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -25,14 +25,12 @@ AX_COMPILER_FLAGS([WARN_CFLAGS],[WARN_LDFLAGS]) + + GTK_DOC_CHECK([1.11],[--flavour no-tmpl]) + +-PKG_CHECK_EXISTS(udev, [], [AC_MSG_ERROR(udev development libraries are required)]) + AC_ARG_WITH([udevrulesdir], + AS_HELP_STRING([--with-udevrulesdir=DIR], [Directory for udev rules]), + [], + [with_udevrulesdir=$($PKG_CONFIG --variable=udevdir udev)"/rules.d"]) + AC_SUBST([udevrulesdir], [$with_udevrulesdir]) + +-PKG_CHECK_EXISTS(systemd, [], [AC_MSG_ERROR(systemd development libraries are required)]) + AC_ARG_WITH([systemdsystemunitdir], + AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]), + [], +-- +2.11.0 + diff --git a/temp/iio-sensor-proxy/292.patch b/temp/iio-sensor-proxy/292.patch new file mode 100644 index 000000000..559118f58 --- /dev/null +++ b/temp/iio-sensor-proxy/292.patch @@ -0,0 +1,65 @@ +From eba0aca224c18624b7e398171fb8688728baf398 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Guido=20G=C3=BCnther?= +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; + } diff --git a/temp/iio-sensor-proxy/299.patch b/temp/iio-sensor-proxy/299.patch new file mode 100644 index 000000000..86fd8245d --- /dev/null +++ b/temp/iio-sensor-proxy/299.patch @@ -0,0 +1,63 @@ +From c94f5d31250f9cc75271a7f386104ce2fdfb268e Mon Sep 17 00:00:00 2001 +From: Dmitry Osipenko +Date: Sat, 18 Jan 2020 19:29:08 +0300 +Subject: [PATCH] mount-matrix: Support IIO sysfs matrices + +Linux kernel IIO drivers provide mount matrix via standardized sysfs +interface, let's support these drivers. 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 | 36 ++++++++++++++++++++++++++++++++++++ + 1 file changed, 36 insertions(+) + +diff --git a/src/accel-mount-matrix.c b/src/accel-mount-matrix.c +index c66b440..ced2819 100644 +--- a/src/accel-mount-matrix.c ++++ b/src/accel-mount-matrix.c +@@ -50,6 +50,42 @@ 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); ++ } ++ ++ /* ++ * 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); ++ } ++ + g_debug ("Failed to auto-detect mount matrix, falling back to identity"); + parse_mount_matrix (NULL, &ret); + return ret; +-- +2.24.1 + diff --git a/temp/iio-sensor-proxy/APKBUILD b/temp/iio-sensor-proxy/APKBUILD new file mode 100644 index 000000000..db221bba1 --- /dev/null +++ b/temp/iio-sensor-proxy/APKBUILD @@ -0,0 +1,50 @@ +# Forked from Alpine for RAW light sensor input and rotation matrix patches +pkgname=iio-sensor-proxy +pkgver=9999 +_pkgver=2.8 +pkgrel=2 +pkgdesc="IIO sensors to D-Bus proxy" +url="https://developer.gnome.org/iio-sensor-proxy/1.0/" +arch="all" +license="GPL-2.0-or-later" +makedepends="eudev-dev libgudev-dev glib-dev autoconf automake libtool gtk+3.0-dev" +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 + 292.patch + 299.patch" +builddir="$srcdir/$pkgname-$_pkgver" + +prepare() { + default_prepare + autoreconf -if +} + +build() { + ./configure \ + --build=$CBUILD \ + --host=$CHOST \ + --prefix=/usr \ + --sysconfdir=/etc \ + --mandir=/usr/share/man \ + --localstatedir=/var \ + --with-geoclue-user=geoclue + make +} + +check() { + make check +} + +package() { + make DESTDIR="$pkgdir" install + + install -Dm755 "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname +} + +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 +4848226fc95dfb89b3e2fd49268b69fef12c56b59feb02743c608aa2c707dadfe782717d9006a40db0158d6ef041df2bf24907912e311f4840ee0bbb585e6dad 292.patch +8785adb63b35bcd12028607dbc813779d4091629da79f35e8519b782ca5c3ca3fc960ea2ca7d73492e22ec7fad08cf978b0d14df5a5ee4afdec20078a7b4ac75 299.patch" diff --git a/temp/iio-sensor-proxy/iio-sensor-proxy.initd b/temp/iio-sensor-proxy/iio-sensor-proxy.initd new file mode 100644 index 000000000..73dc96df6 --- /dev/null +++ b/temp/iio-sensor-proxy/iio-sensor-proxy.initd @@ -0,0 +1,4 @@ +#!/sbin/openrc-run + +supervisor=supervise-daemon +command="/usr/sbin/iio-sensor-proxy"