diff options
| author | Khem Raj <raj.khem@gmail.com> | 2019-11-30 11:27:48 -0800 |
|---|---|---|
| committer | Khem Raj <raj.khem@gmail.com> | 2019-12-01 11:24:26 -0800 |
| commit | 18805e625b1da4964864bc9f0b165635e814edd8 (patch) | |
| tree | dff8b1ff52fe9a0c151116427d8329bc90cda194 | |
| parent | 459dbf10783a89540d9334e823524ec1dbb21502 (diff) | |
| download | meta-openembedded-18805e625b1da4964864bc9f0b165635e814edd8.tar.gz | |
python-evdev: Fix build for 32bit arches with 64bit time_t
Signed-off-by: Khem Raj <raj.khem@gmail.com>
| -rw-r--r-- | meta-python/recipes-devtools/python/python-evdev.inc | 4 | ||||
| -rw-r--r-- | meta-python/recipes-devtools/python/python-evdev/0001-Fix-build-on-32bit-arches-with-64bit-time_t.patch | 83 |
2 files changed, 87 insertions, 0 deletions
diff --git a/meta-python/recipes-devtools/python/python-evdev.inc b/meta-python/recipes-devtools/python/python-evdev.inc index 953094ba74..a536815358 100644 --- a/meta-python/recipes-devtools/python/python-evdev.inc +++ b/meta-python/recipes-devtools/python/python-evdev.inc | |||
| @@ -3,6 +3,10 @@ HOMEPAGE = "https://github.com/gvalkov/python-evdev" | |||
| 3 | LICENSE = "BSD-3-Clause" | 3 | LICENSE = "BSD-3-Clause" |
| 4 | LIC_FILES_CHKSUM = "file://LICENSE;md5=18debddbb3f52c661a129724a883a8e2" | 4 | LIC_FILES_CHKSUM = "file://LICENSE;md5=18debddbb3f52c661a129724a883a8e2" |
| 5 | 5 | ||
| 6 | FILESEXTRAPATHS_prepend := "${THISDIR}/python-evdev:" | ||
| 7 | |||
| 8 | SRC_URI += " file://0001-Fix-build-on-32bit-arches-with-64bit-time_t.patch" | ||
| 9 | |||
| 6 | SRC_URI[md5sum] = "53e440943dfa2514f95b3c448d6a36cb" | 10 | SRC_URI[md5sum] = "53e440943dfa2514f95b3c448d6a36cb" |
| 7 | SRC_URI[sha256sum] = "b03f5e1be5b4a5327494a981b831d251a142b09e8778eda1a8b53eba91100166" | 11 | SRC_URI[sha256sum] = "b03f5e1be5b4a5327494a981b831d251a142b09e8778eda1a8b53eba91100166" |
| 8 | 12 | ||
diff --git a/meta-python/recipes-devtools/python/python-evdev/0001-Fix-build-on-32bit-arches-with-64bit-time_t.patch b/meta-python/recipes-devtools/python/python-evdev/0001-Fix-build-on-32bit-arches-with-64bit-time_t.patch new file mode 100644 index 0000000000..154172ca88 --- /dev/null +++ b/meta-python/recipes-devtools/python/python-evdev/0001-Fix-build-on-32bit-arches-with-64bit-time_t.patch | |||
| @@ -0,0 +1,83 @@ | |||
| 1 | From 435e78aaf6745e4da0fe3d4455473011626c77d1 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Khem Raj <raj.khem@gmail.com> | ||
| 3 | Date: Sat, 30 Nov 2019 11:21:20 -0800 | ||
| 4 | Subject: [PATCH] Fix build on 32bit arches with 64bit time_t | ||
| 5 | |||
| 6 | time element is deprecated on new input_event structure in kernel's | ||
| 7 | input.h [1] | ||
| 8 | |||
| 9 | [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit?id=152194fe9c3f | ||
| 10 | |||
| 11 | Upstream-Status: Submitted [https://github.com/gvalkov/python-evdev/pull/112] | ||
| 12 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 13 | --- | ||
| 14 | evdev/input.c | 13 +++++++++---- | ||
| 15 | evdev/uinput.c | 9 ++++++++- | ||
| 16 | 2 files changed, 17 insertions(+), 5 deletions(-) | ||
| 17 | |||
| 18 | diff --git a/evdev/input.c b/evdev/input.c | ||
| 19 | index 67b9348..432db92 100644 | ||
| 20 | --- a/evdev/input.c | ||
| 21 | +++ b/evdev/input.c | ||
| 22 | @@ -24,6 +24,11 @@ | ||
| 23 | #include <linux/input.h> | ||
| 24 | #endif | ||
| 25 | |||
| 26 | +#ifndef input_event_sec | ||
| 27 | +#define input_event_sec time.tv_sec | ||
| 28 | +#define input_event_usec time.tv_usec | ||
| 29 | +#endif | ||
| 30 | + | ||
| 31 | #define MAX_NAME_SIZE 256 | ||
| 32 | |||
| 33 | extern char* EV_NAME[EV_CNT]; | ||
| 34 | @@ -60,8 +65,8 @@ device_read(PyObject *self, PyObject *args) | ||
| 35 | return NULL; | ||
| 36 | } | ||
| 37 | |||
| 38 | - PyObject* sec = PyLong_FromLong(event.time.tv_sec); | ||
| 39 | - PyObject* usec = PyLong_FromLong(event.time.tv_usec); | ||
| 40 | + PyObject* sec = PyLong_FromLong(event.input_event_sec); | ||
| 41 | + PyObject* usec = PyLong_FromLong(event.input_event_usec); | ||
| 42 | PyObject* val = PyLong_FromLong(event.value); | ||
| 43 | PyObject* py_input_event = NULL; | ||
| 44 | |||
| 45 | @@ -102,8 +107,8 @@ device_read_many(PyObject *self, PyObject *args) | ||
| 46 | |||
| 47 | // Construct a list of event tuples, which we'll make sense of in Python | ||
| 48 | for (unsigned i = 0 ; i < nread/event_size ; i++) { | ||
| 49 | - sec = PyLong_FromLong(event[i].time.tv_sec); | ||
| 50 | - usec = PyLong_FromLong(event[i].time.tv_usec); | ||
| 51 | + sec = PyLong_FromLong(event[i].input_event_sec); | ||
| 52 | + usec = PyLong_FromLong(event[i].input_event_usec); | ||
| 53 | val = PyLong_FromLong(event[i].value); | ||
| 54 | |||
| 55 | py_input_event = Py_BuildValue("OOhhO", sec, usec, event[i].type, event[i].code, val); | ||
| 56 | diff --git a/evdev/uinput.c b/evdev/uinput.c | ||
| 57 | index 192568d..56fe86c 100644 | ||
| 58 | --- a/evdev/uinput.c | ||
| 59 | +++ b/evdev/uinput.c | ||
| 60 | @@ -16,6 +16,10 @@ | ||
| 61 | #include <linux/uinput.h> | ||
| 62 | #endif | ||
| 63 | |||
| 64 | +#ifndef input_event_sec | ||
| 65 | +#define input_event_sec time.tv_sec | ||
| 66 | +#define input_event_usec time.tv_usec | ||
| 67 | +#endif | ||
| 68 | |||
| 69 | // Workaround for installing on kernels newer than 4.4. | ||
| 70 | #ifndef FF_MAX_EFFECTS | ||
| 71 | @@ -232,8 +236,11 @@ uinput_write(PyObject *self, PyObject *args) | ||
| 72 | if (!ret) return NULL; | ||
| 73 | |||
| 74 | struct input_event event; | ||
| 75 | + struct timeval tval; | ||
| 76 | memset(&event, 0, sizeof(event)); | ||
| 77 | - gettimeofday(&event.time, 0); | ||
| 78 | + gettimeofday(&tval, 0); | ||
| 79 | + event.input_event_usec = tval.tv_usec; | ||
| 80 | + event.input_event_sec = tval.tv_sec; | ||
| 81 | event.type = type; | ||
| 82 | event.code = code; | ||
| 83 | event.value = value; | ||
