diff options
Diffstat (limited to 'meta-python/recipes-devtools/python/python3-uinput/0001-Deal-with-64bit-time_t-default-on-32bit-architecture.patch')
| -rw-r--r-- | meta-python/recipes-devtools/python/python3-uinput/0001-Deal-with-64bit-time_t-default-on-32bit-architecture.patch | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/meta-python/recipes-devtools/python/python3-uinput/0001-Deal-with-64bit-time_t-default-on-32bit-architecture.patch b/meta-python/recipes-devtools/python/python3-uinput/0001-Deal-with-64bit-time_t-default-on-32bit-architecture.patch new file mode 100644 index 0000000000..8658c83f82 --- /dev/null +++ b/meta-python/recipes-devtools/python/python3-uinput/0001-Deal-with-64bit-time_t-default-on-32bit-architecture.patch | |||
| @@ -0,0 +1,48 @@ | |||
| 1 | From 84d40417fcf58ed123cd0040e5e5678ec12e68b2 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Khem Raj <raj.khem@gmail.com> | ||
| 3 | Date: Sat, 28 May 2022 15:50:50 -0700 | ||
| 4 | Subject: [PATCH] Deal with 64bit time_t default on 32bit architectures | ||
| 5 | |||
| 6 | Deal with Y2K38 concerns related to Linux input events on more recent | ||
| 7 | kernels and libcs on 32-bit systems | ||
| 8 | |||
| 9 | Original-Author: Khem Raj <raj.khem@gmail.com> | ||
| 10 | |||
| 11 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 12 | Signed-off-by: Pablo Saavedra <psaavedra@igalia.com> | ||
| 13 | |||
| 14 | Upstream-Status: Submitted [https://github.com/pyinput/python-uinput/pull/2] | ||
| 15 | |||
| 16 | --- | ||
| 17 | libsuinput/src/suinput.c | 11 ++++++++++- | ||
| 18 | 1 file changed, 10 insertions(+), 1 deletion(-) | ||
| 19 | |||
| 20 | diff --git a/libsuinput/src/suinput.c b/libsuinput/src/suinput.c | ||
| 21 | index 8d5fb71..13ff16a 100644 | ||
| 22 | --- a/libsuinput/src/suinput.c | ||
| 23 | +++ b/libsuinput/src/suinput.c | ||
| 24 | @@ -45,11 +45,20 @@ int suinput_emit(int uinput_fd, uint16_t ev_type, uint16_t ev_code, | ||
| 25 | struct input_event event; | ||
| 26 | |||
| 27 | memset(&event, 0, sizeof(event)); | ||
| 28 | - gettimeofday(&event.time, 0); | ||
| 29 | event.type = ev_type; | ||
| 30 | event.code = ev_code; | ||
| 31 | event.value = ev_value; | ||
| 32 | |||
| 33 | +/* attempt to deal with 64-bit time keeping on recent 32-bit systems */ | ||
| 34 | +#if (__BITS_PER_LONG != 32 || !defined(__USE_TIME_BITS64)) | ||
| 35 | + gettimeofday(&event.time, 0); | ||
| 36 | +#else | ||
| 37 | + struct timeval now; | ||
| 38 | + memset(&now, 0, sizeof(now)); | ||
| 39 | + gettimeofday(&now, 0); | ||
| 40 | + event.input_event_sec = now.tv_sec; | ||
| 41 | + event.input_event_usec = now.tv_usec; | ||
| 42 | +#endif | ||
| 43 | return suinput_write_event(uinput_fd, &event); | ||
| 44 | } | ||
| 45 | |||
| 46 | -- | ||
| 47 | 2.34.1 | ||
| 48 | |||
