diff options
-rw-r--r-- | clients/linux/linux-uinput.c | 31 | ||||
-rw-r--r-- | clients/vita/vita-uinput.c | 7 |
2 files changed, 14 insertions, 24 deletions
diff --git a/clients/linux/linux-uinput.c b/clients/linux/linux-uinput.c index 0b6e901..10151e9 100644 --- a/clients/linux/linux-uinput.c +++ b/clients/linux/linux-uinput.c @@ -17,24 +17,21 @@ struct core { int input; }; -// we assume 64bit host, see packet.h for rant - -#if UINTPTR_MAX != 0xffffffffffffffff -#define NOT_64BIT - -struct timeval_64 { +struct timeval_host { +#ifdef HOST_32BIT + uint32_t tv_sec, tv_usec; +#else uint64_t tv_sec, tv_usec; +#endif }; -struct input_event_64 { - struct timeval_64 time; +struct input_event_host { + struct timeval_host time; uint16_t type; uint16_t code; int32_t value; }; -#endif - static int _ioctl(const int fd, const unsigned long request, void *arg) { @@ -234,11 +231,7 @@ 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 input_event) is %zu bytes", sizeof(struct input_event_host)); warnx("sizeof(struct uinput_user_dev) is %zu bytes", sizeof(struct uinput_user_dev)); } @@ -277,18 +270,14 @@ main(int argc, const char *argv[]) { struct input_event event; while (read(core.input, &event, sizeof(event)) == sizeof(event)) { -#ifdef NOT_64BIT - struct input_event_64 ev = { + struct input_event_host event_host = { .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 + uinputd_write(sizeof(event_host), &event_host); } err(EXIT_FAILURE, "read"); } diff --git a/clients/vita/vita-uinput.c b/clients/vita/vita-uinput.c index 3a9b2f8..27632c2 100644 --- a/clients/vita/vita-uinput.c +++ b/clients/vita/vita-uinput.c @@ -81,11 +81,12 @@ struct uinput_user_dev { int32_t absflat[ABS_CNT]; }; -/** - * We are now expecting 64bit host, see the compatibility notes from uinputd.c - */ struct timeval { +#ifdef HOST_32BIT + uint32_t tv_sec, tv_usec; +#else uint64_t tv_sec, tv_usec; +#endif }; struct input_event { |