From b13b653d65dff2fa54f2799d6f033519b4a38bc5 Mon Sep 17 00:00:00 2001 From: Luca Weiss Date: Wed, 11 Sep 2019 09:43:28 +0200 Subject: [PATCH] main/iio-sensor-proxy: new aport (!622) --- ...ore-accelerometers-that-are-part-of-.patch | 112 ++++++++++++++++++ ...o-read-mount-matrix-from-in_accel_mo.patch | 41 +++++++ .../0002-Make-systemd-optional.patch | 30 +++++ main/iio-sensor-proxy/APKBUILD | 40 +++++++ main/iio-sensor-proxy/iio-sensor-proxy.initd | 7 ++ 5 files changed, 230 insertions(+) create mode 100644 main/iio-sensor-proxy/0001-Revert-accel-Ignore-accelerometers-that-are-part-of-.patch create mode 100644 main/iio-sensor-proxy/0001-mount-matrix-also-read-mount-matrix-from-in_accel_mo.patch create mode 100644 main/iio-sensor-proxy/0002-Make-systemd-optional.patch create mode 100644 main/iio-sensor-proxy/APKBUILD create mode 100644 main/iio-sensor-proxy/iio-sensor-proxy.initd diff --git a/main/iio-sensor-proxy/0001-Revert-accel-Ignore-accelerometers-that-are-part-of-.patch b/main/iio-sensor-proxy/0001-Revert-accel-Ignore-accelerometers-that-are-part-of-.patch new file mode 100644 index 000000000..2d8fd8ee7 --- /dev/null +++ b/main/iio-sensor-proxy/0001-Revert-accel-Ignore-accelerometers-that-are-part-of-.patch @@ -0,0 +1,112 @@ +From 6e6aead20f634ee782dd1f2711c66ee582b47d54 Mon Sep 17 00:00:00 2001 +From: Robert Yang +Date: Wed, 10 Oct 2018 14:08:52 -0400 +Subject: [PATCH 1/2] Revert "accel: Ignore accelerometers that are part of a + joypad" + +This reverts commit 401d59e54b3123860180d4401e09df8a1e1bc6c3. +--- + configure.ac | 2 +- + src/drv-input-accel.c | 62 ------------------------------------------- + 2 files changed, 1 insertion(+), 63 deletions(-) + +diff --git a/configure.ac b/configure.ac +index c487464..689946f 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -49,7 +49,7 @@ if test x$enable_gtk_tests = xyes; then + fi + AM_CONDITIONAL(HAVE_GTK_TESTS, test "x$enable_gtk_tests" = "xyes") + +-PKG_CHECK_MODULES(IIO_SENSOR_PROXY, gio-2.0 gudev-1.0 >= 232) ++PKG_CHECK_MODULES(IIO_SENSOR_PROXY, gio-2.0 gudev-1.0) + + AC_ARG_WITH(geoclue-user, + AS_HELP_STRING([--with-geoclue-user=USER], +diff --git a/src/drv-input-accel.c b/src/drv-input-accel.c +index 9cebcef..db658fa 100644 +--- a/src/drv-input-accel.c ++++ b/src/drv-input-accel.c +@@ -34,68 +34,10 @@ static DrvData *drv_data = NULL; + + static void input_accel_set_polling (gboolean state); + +-/* From src/linux/up-device-supply.c in UPower */ +-static GUdevDevice * +-get_sibling_with_subsystem (GUdevDevice *device, +- const char *subsystem) +-{ +- GUdevDevice *parent; +- GUdevClient *client; +- GUdevDevice *sibling; +- const char * class[] = { NULL, NULL }; +- const char *parent_path; +- GList *devices, *l; +- +- g_return_val_if_fail (device != NULL, NULL); +- g_return_val_if_fail (subsystem != NULL, NULL); +- +- parent = g_udev_device_get_parent (device); +- if (!parent) +- return NULL; +- parent_path = g_udev_device_get_sysfs_path (parent); +- +- sibling = NULL; +- class[0] = subsystem; +- client = g_udev_client_new (class); +- devices = g_udev_client_query_by_subsystem (client, subsystem); +- for (l = devices; l != NULL && sibling == NULL; l = l->next) { +- GUdevDevice *d = l->data; +- GUdevDevice *p; +- const char *p_path; +- +- p = g_udev_device_get_parent (d); +- if (!p) +- continue; +- p_path = g_udev_device_get_sysfs_path (p); +- if (g_strcmp0 (p_path, parent_path) == 0) +- sibling = g_object_ref (d); +- +- g_object_unref (p); +- } +- +- g_list_free_full (devices, (GDestroyNotify) g_object_unref); +- g_object_unref (client); +- g_object_unref (parent); +- +- return sibling; +-} +- +-static gboolean +-is_part_of_joypad (GUdevDevice *device) +-{ +- g_autoptr(GUdevDevice) sibling; +- +- sibling = get_sibling_with_subsystem (device, "input"); +- if (!sibling) +- return FALSE; +- return g_udev_device_get_property_as_boolean (sibling, "ID_INPUT_JOYSTICK"); +-} +- + static gboolean + input_accel_discover (GUdevDevice *device) + { + const char *path; +- g_autoptr(GUdevDevice) parent = NULL; + + if (g_strcmp0 (g_udev_device_get_property (device, "IIO_SENSOR_PROXY_TYPE"), "input-accel") != 0) + return FALSE; +@@ -106,10 +48,6 @@ input_accel_discover (GUdevDevice *device) + if (strstr (path, "/event") == NULL) + return FALSE; + +- parent = g_udev_device_get_parent (device); +- if (parent && is_part_of_joypad (parent)) +- return FALSE; +- + g_debug ("Found input accel at %s", g_udev_device_get_sysfs_path (device)); + return TRUE; + } +-- +2.17.1 + diff --git a/main/iio-sensor-proxy/0001-mount-matrix-also-read-mount-matrix-from-in_accel_mo.patch b/main/iio-sensor-proxy/0001-mount-matrix-also-read-mount-matrix-from-in_accel_mo.patch new file mode 100644 index 000000000..f73573711 --- /dev/null +++ b/main/iio-sensor-proxy/0001-mount-matrix-also-read-mount-matrix-from-in_accel_mo.patch @@ -0,0 +1,41 @@ +From 4584f840e1aa9b07096637c95deee6585aad8df0 Mon Sep 17 00:00:00 2001 +From: Icenowy Zheng +Date: Wed, 10 Apr 2019 13:54:46 +0800 +Subject: [PATCH] mount-matrix: also read mount-matrix from + in_accel_mount_matrix + +The IIO framework may also export mount matrix with sysfs filename +in_accel_mount_matrix (when the type of this extinfo is set to be +IIO_SHARED_BY_TYPE. + +Also try to read mount-matrix from this file. + +Signed-off-by: Icenowy Zheng +--- + src/accel-mount-matrix.c | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +diff --git a/src/accel-mount-matrix.c b/src/accel-mount-matrix.c +index c66b440..f4e1336 100644 +--- a/src/accel-mount-matrix.c ++++ b/src/accel-mount-matrix.c +@@ -40,6 +40,16 @@ setup_mount_matrix (GUdevDevice *device) + g_clear_pointer (&ret, g_free); + } + ++ 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 mount_matrix ('%s') from sysfs", ++ mount_matrix); ++ g_clear_pointer (&ret, g_free); ++ } ++ + mount_matrix = g_udev_device_get_sysfs_attr (device, "mount_matrix"); + if (mount_matrix) { + if (parse_mount_matrix (mount_matrix, &ret)) +-- +2.22.0 + diff --git a/main/iio-sensor-proxy/0002-Make-systemd-optional.patch b/main/iio-sensor-proxy/0002-Make-systemd-optional.patch new file mode 100644 index 000000000..40cb69cf6 --- /dev/null +++ b/main/iio-sensor-proxy/0002-Make-systemd-optional.patch @@ -0,0 +1,30 @@ +From c87e8bea9e31c921de5d9707f471c3eee479cb0a Mon Sep 17 00:00:00 2001 +From: Robert Yang +Date: Wed, 10 Oct 2018 17:52:32 -0400 +Subject: [PATCH 2/2] Make systemd optional + +--- + configure.ac | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/configure.ac b/configure.ac +index 689946f..97e9f7a 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -32,7 +32,12 @@ AC_ARG_WITH([udevrulesdir], + [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_ENABLE([systemd], ++ [AS_HELP_STRING([--disable-systemd],[do not build systemd service])], ++ [],[enable_systemd=yes]) ++if test x$enable_systemd = xyes; then ++ PKG_CHECK_EXISTS(systemd, [], [AC_MSG_ERROR(systemd development libraries are required)]) ++fi + AC_ARG_WITH([systemdsystemunitdir], + AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]), + [], +-- +2.17.1 + diff --git a/main/iio-sensor-proxy/APKBUILD b/main/iio-sensor-proxy/APKBUILD new file mode 100644 index 000000000..a57bd251e --- /dev/null +++ b/main/iio-sensor-proxy/APKBUILD @@ -0,0 +1,40 @@ +# Contributor: +# Maintainer: +pkgname=iio-sensor-proxy +pkgver=2.7 +pkgrel=0 +pkgdesc="IIO accelerometer sensor to input device proxy" +url="https://github.com/hadess/iio-sensor-proxy" +arch="all" +license="GPL-3.0-only" +makedepends="autoconf automake util-macros libtool autoconf-archive gtk-doc + eudev-dev glib-dev gtk+3.0-dev libgudev-dev" +subpackages="$pkgname-openrc" +source="$pkgname-$pkgver.tar.gz::https://github.com/hadess/iio-sensor-proxy/archive/$pkgver.tar.gz + iio-sensor-proxy.initd + 0001-Revert-accel-Ignore-accelerometers-that-are-part-of-.patch + 0002-Make-systemd-optional.patch + 0001-mount-matrix-also-read-mount-matrix-from-in_accel_mo.patch" +options="!check" + +build() { + ./autogen.sh \ + --prefix=/usr \ + --sysconfdir=/etc \ + --disable-systemd + make +} + +package() { + make install DESTDIR="$pkgdir" + + # openrc runscripts + install -Dm755 "$srcdir"/iio-sensor-proxy.initd \ + "$pkgdir"/etc/init.d/iio-sensor-proxy +} + +sha512sums="92e057ce0a95903009433fba265fbdd6f3ec3eece9ba6cde1f6f1461acfe3024a5ec63787e35837a2327e73aa6e911983295a6f4e7b66429082cb4efe61a72b5 iio-sensor-proxy-2.7.tar.gz +0b7c3a97c8e51b24b43a00f73b67831e8f55ec13b5b282d8cca9647f585e8e01a4eaa1c10ce53ce510e7a461e0327184de9df145b0a50dcf55fabd2a78653f79 iio-sensor-proxy.initd +aa713945d5a7f7190f744b76a6164641955db13a12a0ae258ebeefbfd7f0daf4fbb48f3f35951114e452f07c848e5ec7ebe1aa410fc2fdb2579ff72a356da873 0001-Revert-accel-Ignore-accelerometers-that-are-part-of-.patch +1693f61ab625d7f472248caab347e3fdfcac4832c8e3846dcffb25267a1e4fe2d9f810fb4fdbcaa75abf48a7c6f6bf816171c5d9ca1f4982c7a6a7d17564ea58 0002-Make-systemd-optional.patch +372e48effd63b36b22124d00fda8ee0e8d9ea304db592d2c9b76295eb025a88091e9e56d1b8ea6e82997eb72b3ce603844bcc5a9022602382591e9128265e240 0001-mount-matrix-also-read-mount-matrix-from-in_accel_mo.patch" diff --git a/main/iio-sensor-proxy/iio-sensor-proxy.initd b/main/iio-sensor-proxy/iio-sensor-proxy.initd new file mode 100644 index 000000000..8231910cd --- /dev/null +++ b/main/iio-sensor-proxy/iio-sensor-proxy.initd @@ -0,0 +1,7 @@ +#!/sbin/openrc-run + +command="/usr/sbin/iio-sensor-proxy" +pidfile="/run/${RC_SVCNAME}.pid" +command_args="" +command_background=true +command_user="root:user"