46 lines
1.6 KiB
Diff
46 lines
1.6 KiB
Diff
--- evdev/input.c 2019-04-07 17:40:25.000000000 +0200
|
|
+++ evdev/input.c 2020-12-14 14:48:49.568344738 +0100
|
|
@@ -60,8 +60,8 @@
|
|
return NULL;
|
|
}
|
|
|
|
- PyObject* sec = PyLong_FromLong(event.time.tv_sec);
|
|
- PyObject* usec = PyLong_FromLong(event.time.tv_usec);
|
|
+ PyObject* sec = PyLong_FromLong(event.input_event_sec);
|
|
+ PyObject* usec = PyLong_FromLong(event.input_event_usec);
|
|
PyObject* val = PyLong_FromLong(event.value);
|
|
PyObject* py_input_event = NULL;
|
|
|
|
@@ -102,8 +102,8 @@
|
|
|
|
// Construct a list of event tuples, which we'll make sense of in Python
|
|
for (unsigned i = 0 ; i < nread/event_size ; i++) {
|
|
- sec = PyLong_FromLong(event[i].time.tv_sec);
|
|
- usec = PyLong_FromLong(event[i].time.tv_usec);
|
|
+ sec = PyLong_FromLong(event[i].input_event_sec);
|
|
+ usec = PyLong_FromLong(event[i].input_event_usec);
|
|
val = PyLong_FromLong(event[i].value);
|
|
|
|
py_input_event = Py_BuildValue("OOhhO", sec, usec, event[i].type, event[i].code, val);
|
|
--- evdev/uinput.c 2019-04-07 17:40:25.000000000 +0200
|
|
+++ evdev/uinput.c 2020-12-14 14:51:58.809761744 +0100
|
|
@@ -226,6 +226,7 @@
|
|
static PyObject *
|
|
uinput_write(PyObject *self, PyObject *args)
|
|
{
|
|
+ struct timeval tv;
|
|
int fd, type, code, value;
|
|
|
|
int ret = PyArg_ParseTuple(args, "iiii", &fd, &type, &code, &value);
|
|
@@ -233,7 +234,9 @@
|
|
|
|
struct input_event event;
|
|
memset(&event, 0, sizeof(event));
|
|
- gettimeofday(&event.time, 0);
|
|
+ gettimeofday(&tv, 0);
|
|
+ event.input_event_sec = tv.tv_sec;
|
|
+ event.input_event_usec = tv.tv_usec;
|
|
event.type = type;
|
|
event.code = code;
|
|
event.value = value;
|