diff options
| author | Jari Vetoniemi <mailroxas@gmail.com> | 2018-07-04 21:11:48 +0300 | 
|---|---|---|
| committer | Jari Vetoniemi <mailroxas@gmail.com> | 2018-07-04 21:11:48 +0300 | 
| commit | 6df9eee5f76cbc4acad268b1da95a8833be2d34a (patch) | |
| tree | e43c438b42ecd82270adcd336fd56223aeb1c840 /clients | |
| parent | 0699cbd82b577a4358d199a627e9bc4497f436e7 (diff) | |
linux: add hack for 32bit client
since we aren't inventing new portable api here, we'll just always
assume host is 64bit
Diffstat (limited to 'clients')
| -rw-r--r-- | clients/linux/linux-uinput.c | 36 | 
1 files changed, 35 insertions, 1 deletions
| 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");     } | 
