ponty / framebuffer-vncserver

VNC server for Linux framebuffer devices
GNU General Public License v2.0
169 stars 69 forks source link

Add compatibility for 32bit systems #10

Closed ektor5 closed 3 years ago

ektor5 commented 3 years ago

On 32bit systems there is no timeval struct in input devices

Signed-off-by: Ettore Chimenti ek5.chimenti@gmail.com

ponty commented 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
ektor5 commented 3 years ago

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.

ektor5 commented 3 years ago

Seems ok, it compiles and it seems to work :) Need to rebase?

ponty commented 3 years ago

Thanks.