Closed ektor5 closed 3 years ago
"On 32bit systems there is no timeval struct in input devices"
I use the current version on 32 bit systems. So the condition is more complex:
(__BITS_PER_LONG != 32 || !defined(__USE_TIME_BITS64))
Do you have a test case with missing timeval struct? Your Dockerfile can be built with old code.
I found only __KERNEL__
in input.h There is no __KERNEL
input_event_usec
is not set. Why?
I try to avoid ifdefs. What about this without ifdef:
struct timeval time;
gettimeofday(&time, 0);
ev.input_event_sec = time.tv_sec;
ev.input_event_usec = time.tv_usec;
I found this QEMU patch which does the same: https://patchew.org/QEMU/20201117202846.138463-1-fontaine.fabrice@gmail.com/ It has additional code:
#ifndef input_event_sec
#define input_event_sec time.tv_sec
#define input_event_usec time.tv_usec
#endif
Hi @ponty,
I used the same syntax found in linux/input.h
, in 4.19 kernel
https://github.com/torvalds/linux/blob/v4.19/include/uapi/linux/input.h
I confirm that in newer kernels the UAPI is __KERNEL__
.
You say to patch it the other way around. I agree that seems nicer, but I don't know if it works as well. Let's try.
Seems ok, it compiles and it seems to work :) Need to rebase?
Thanks.
On 32bit systems there is no timeval struct in input devices
Signed-off-by: Ettore Chimenti ek5.chimenti@gmail.com