Skip to content

Commit

Permalink
python3-uinput: Re-add recipe
Browse files Browse the repository at this point in the history
- Added `python3-uinput_1.0.1.bb` recipe for the Python interface to
  the Linux uinput kernel module.
- Included a submitted patch to handle 64-bit `time_t` on 32-bit
  architectures to address Y2K38 issues in recent kernels and libcs.

Removed in b4efcecc63c86f3e7fa9d5c6205f1bd07d951fed for lack of
maintenance the situation change. There is a new release from 2024
March what addresses the build issues reported lately.

Signed-off-by: Pablo Saavedra <[email protected]>

Change-type: minor
  • Loading branch information
psaavedra committed Jan 22, 2025
1 parent be83f70 commit a9b6341
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
From 84d40417fcf58ed123cd0040e5e5678ec12e68b2 Mon Sep 17 00:00:00 2001
From: Khem Raj <[email protected]>
Date: Sat, 28 May 2022 15:50:50 -0700
Subject: [PATCH] Deal with 64bit time_t default on 32bit architectures

Deal with Y2K38 concerns related to Linux input events on more recent
kernels and libcs on 32-bit systems

Original-Author: Khem Raj <[email protected]>

Signed-off-by: Khem Raj <[email protected]>
Signed-off-by: Pablo Saavedra <[email protected]>

Upstream-Status: Submitted [https://github.com/pyinput/python-uinput/pull/2]

---
libsuinput/src/suinput.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/libsuinput/src/suinput.c b/libsuinput/src/suinput.c
index 8d5fb71..13ff16a 100644
--- a/libsuinput/src/suinput.c
+++ b/libsuinput/src/suinput.c
@@ -45,11 +45,20 @@ int suinput_emit(int uinput_fd, uint16_t ev_type, uint16_t ev_code,
struct input_event event;

memset(&event, 0, sizeof(event));
- gettimeofday(&event.time, 0);
event.type = ev_type;
event.code = ev_code;
event.value = ev_value;

+/* attempt to deal with 64-bit time keeping on recent 32-bit systems */
+#if (__BITS_PER_LONG != 32 || !defined(__USE_TIME_BITS64))
+ gettimeofday(&event.time, 0);
+#else
+ struct timeval now;
+ memset(&now, 0, sizeof(now));
+ gettimeofday(&now, 0);
+ event.input_event_sec = now.tv_sec;
+ event.input_event_usec = now.tv_usec;
+#endif
return suinput_write_event(uinput_fd, &event);
}

--
2.34.1

18 changes: 18 additions & 0 deletions recipes-devtools/python/python3-uinput_1.0.1.bb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
SUMMARY = "Python interface to Linux uinput kernel module."
HOMEPAGE = "https://pypi.org/project/python-uinput/"
LICENSE = "GPL-3.0-only"
LIC_FILES_CHKSUM = "file://COPYING;md5=f27defe1e96c2e1ecd4e0c9be8967949"

SRC_URI += "file://0001-Deal-with-64bit-time_t-default-on-32bit-architecture.patch"
SRC_URI[sha256sum] = "853697344b64df5537d4ae32ba6fbcf0515d51a9010910f5d5019959038b6eba"

PYPI_PACKAGE = "python-uinput"

inherit pypi setuptools3

DEPENDS += "udev"
RDEPENDS:${PN} += " \
python3-ctypes \
python3-setuptools \
"
RRECOMMENDS:${PN} += "kernel-module-uinput"

0 comments on commit a9b6341

Please sign in to comment.