From 6df9eee5f76cbc4acad268b1da95a8833be2d34a Mon Sep 17 00:00:00 2001 From: Jari Vetoniemi Date: Wed, 4 Jul 2018 21:11:48 +0300 Subject: linux: add hack for 32bit client since we aren't inventing new portable api here, we'll just always assume host is 64bit --- clients/linux/linux-uinput.c | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/clients/linux/linux-uinput.c b/clients/linux/linux-uinput.c index 0a1588b..d585e2f 100644 --- a/clients/linux/linux-uinput.c +++ b/clients/linux/linux-uinput.c @@ -17,6 +17,24 @@ struct core { int input; }; +// we assume 64bit host, see packet.h for rant + +#if UINTPTR_MAX != 0xffffffffffffffff +#define NOT_64BIT + +struct timeval_64 { + uint64_t tv_sec, tv_usec; +}; + +struct input_event_64 { + struct timeval_64 time; + uint16_t type; + uint16_t code; + int32_t value; +}; + +#endif + static int _ioctl(const int fd, const unsigned long request, void *arg) { @@ -218,7 +236,11 @@ info(void) warnx("version %s", UINPUTD_VERSION); warnx("remote ip: %s", (remote ? remote : "none")); warnx("sizeof(struct packet) is %zu bytes", sizeof(struct packet)); +#ifdef NOT_64BIT + warnx("sizeof(struct input_event) is %zu bytes", sizeof(struct input_event_64)); +#else warnx("sizeof(struct input_event) is %zu bytes", sizeof(struct input_event)); +#endif warnx("sizeof(struct uinput_user_dev) is %zu bytes", sizeof(struct uinput_user_dev)); } @@ -256,8 +278,20 @@ main(int argc, const char *argv[]) { struct input_event event; - while (read(core.input, &event, sizeof(event)) == sizeof(event)) + while (read(core.input, &event, sizeof(event)) == sizeof(event)) { +#ifdef NOT_64BIT + struct input_event_64 ev = { + .time.tv_sec = event.time.tv_sec, + .time.tv_usec = event.time.tv_usec, + .type = event.type, + .code = event.code, + .value = event.value, + }; + uinputd_write(sizeof(ev), &ev); +#else uinputd_write(sizeof(event), &event); +#endif + } err(EXIT_FAILURE, "read"); } -- cgit v1.2.3