void-packages/srcpkgs/python-evdev/patches/time64.patch
Đoàn Trần Công Danh 49cb564d14 srcpkgs/p*: convert patches to -Np1
* par is kept at -Np0

```sh
git grep -l '^patch_args=-Np0' "srcpkgs/$1*/template" |
while read template; do
	for p in ${template%/template}/patches/*; do
		sed -i '
			\,^[+-][+-][+-] /dev/null,b
			/^[*-]\+ [0-9]\+\(,[0-9]\+\)\? [*-]\+$/b
			s,^[*][*][*] ,&a/,
			/^--- /{
				s,\(^--- \)\(./\)*,\1a/,
				s,[.-][Oo][Rr][Ii][Gg]\([	/]\),\1,
				s/[.-][Oo][Rr][Ii][Gg]$//
				s/[.]patched[.]\([^.]\)/.\1/
				h
			}
			/^+++ -/{
				g
				s/^--- a/+++ b/
				b
			}
			s,\(^+++ \)\(./\)*,\1b/,
		' "$p"
	done
	sed -i '/^patch_args=/d' $template
done
```
2021-06-20 13:17:29 +07:00

45 lines
1.6 KiB
Diff

--- a/evdev/input.c 2019-04-07 17:40:25.000000000 +0200
+++ b/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);
--- a/evdev/uinput.c 2019-04-07 17:40:25.000000000 +0200
+++ b/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;