1
0
Fork 0
mirror of https://gitlab.alpinelinux.org/alpine/aports.git synced 2025-07-23 11:15:13 +03:00

testing/enjoy: new aport

https://github.com/cjacker/enjoy
daemon to map joystick events to mouse/key events
This commit is contained in:
Marian Buschsieweke 2022-03-23 16:58:50 +01:00 committed by alice
parent 46e0124e45
commit a9c99cfad6
3 changed files with 96 additions and 0 deletions

View file

@ -0,0 +1,28 @@
From 33a2902f242ad95308a5970a88369d0100a4c66a Mon Sep 17 00:00:00 2001
From: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
Date: Wed, 23 Mar 2022 17:26:05 +0100
Subject: [PATCH] fix printf format specifier
`%ld` is the format specifier for long. The correct format specifier
for `size_t` is `%zu`. Because `%zu` is somewhat obscure, cast the
`size_t` variable to `long` instead and keep `%ld`.
---
enjoy.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/enjoy.c b/enjoy.c
index a698f17..4f0bf33 100644
--- a/enjoy.c
+++ b/enjoy.c
@@ -410,7 +410,7 @@ int main(int argc, char *argv[])
break;
char axis_as_mouse_key[20];
- sprintf(axis_as_mouse_key, "axis%ld_as_mouse", axis);
+ sprintf(axis_as_mouse_key, "axis%zu_as_mouse", axis);
/* null to 0. */
if(!(atoi(cfg_get(cfg, axis_as_mouse_key) ? cfg_get(cfg, axis_as_mouse_key) : "0"))) {
if(axes[axis].x != 0 || axes[axis].y != 0)
--
2.35.1

View file

@ -0,0 +1,37 @@
From 9c35cf9caf031d6f67ec0211b8125d76f1983f58 Mon Sep 17 00:00:00 2001
From: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
Date: Wed, 23 Mar 2022 17:45:43 +0100
Subject: [PATCH] fix setting timestamp of input event
On (some) 32 bit systems `struct input_event` has no member `time`.
Instead, the macros `input_event_sec` and `input_event_usec` can be
used in a portable fashion to access the timestamp.
---
uinput.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/uinput.c b/uinput.c
index 41e2cac..fe3a3d5 100644
--- a/uinput.c
+++ b/uinput.c
@@ -17,12 +17,19 @@
extern int axis_y_direction;
extern int motion_interval;
+static void _set_input_time(struct input_event *ie)
+{
+ struct timeval time;
+ gettimeofday(&time, NULL);
+ ie->input_event_sec = time.tv_sec;
+ ie->input_event_usec = time.tv_usec;
+}
void emit(int fd, int type, int code, int val)
{
struct input_event ie;
memset(&ie, 0, sizeof(ie));
- gettimeofday(&ie.time, NULL);
+ _set_input_time(&ie);
ie.type = type;
ie.code = code;

31
testing/enjoy/APKBUILD Normal file
View file

@ -0,0 +1,31 @@
# Maintainer: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
# Contributor: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
pkgname=enjoy
pkgver=0.3
pkgrel=0
pkgdesc="daemon to map joystick events to mouse/key events"
url="https://github.com/cjacker/enjoy"
arch="all"
license="MIT"
source="
$pkgname-$pkgver.tar.gz::https://github.com/cjacker/enjoy/archive/refs/tags/v$pkgver.tar.gz
0001-fix-printf-format-specifier.patch
0002-fix-setting-timestamp-of-input-event.patch
"
makedepends="linux-headers"
options="!check" # no unit tests provided
build() {
make
}
package() {
make DESTDIR="$pkgdir" install
}
sha512sums="
02dc462f8e2d88e090242ac28612e362baabd9d7071a8e9143f6e1d92f8a23ce747fd470fbb795c57d245908de6d42d5540273e755eecbac6c06c1ef26c7ba5c enjoy-0.3.tar.gz
37e2bc17aadf40e1a3bbbf412f34e51e897bf529121283a025eb7915248f211e5fdeffa4d82e07e816fed666dbcdadd865e59b7980ce5c76e95c7c92b60a08f1 0001-fix-printf-format-specifier.patch
6e89859c5b8752021e1517d2cfdb9a7e9e3bc89098cacbe4845c5ff76aed7b777949efaaeea152ee21a8cdc27112a34b3df2c0015fadc317e756ca626a735791 0002-fix-setting-timestamp-of-input-event.patch
"