From ee163ef63e003f7d23a6e43dcb5f52a92dfebca7 Mon Sep 17 00:00:00 2001 From: Deepa Dinamani Date: Mon, 15 Jan 2018 16:16:37 -0800 Subject: Update struct input_event The struct input_event is not y2038 safe. Update the struct according to the kernel patch: https://lkml.org/lkml/2018/1/6/324 Signed-off-by: Deepa Dinamani Reviewed-by: Peter Hutterer Signed-off-by: Peter Hutterer --- include/linux/input.h | 13 +++++++++++++ src/evdev-mt-touchpad.c | 11 +++++++++-- src/evdev-tablet.c | 12 ++++++++---- 3 files changed, 30 insertions(+), 6 deletions(-) diff --git a/include/linux/input.h b/include/linux/input.h index 06316b27..b3044aec 100644 --- a/include/linux/input.h +++ b/include/linux/input.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * Copyright (c) 1999-2002 Vojtech Pavlik * @@ -8,6 +9,7 @@ #ifndef _INPUT_H #define _INPUT_H + #include #include #include @@ -17,10 +19,21 @@ /* * The event structure itself + * Note that __USE_TIME_BITS64 is defined by libc based on + * application's request to use 64 bit time_t. */ struct input_event { +#if (__BITS_PER_LONG != 32 || !defined(__USE_TIME_BITS64)) && !defined(__KERNEL) struct timeval time; +#define input_event_sec time.tv_sec +#define input_event_usec time.tv_usec +#else + __kernel_ulong_t __sec; + __kernel_ulong_t __usec; +#define input_event_sec __sec +#define input_event_usec __usec +#endif __u16 type; __u16 code; __s32 value; diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c index d4f02eb6..6560ac3e 100644 --- a/src/evdev-mt-touchpad.c +++ b/src/evdev-mt-touchpad.c @@ -608,7 +608,13 @@ tp_process_trackpoint_button(struct tp_dispatch *tp, { struct evdev_dispatch *dispatch; struct input_event event; - struct input_event syn_report = {{ 0, 0 }, EV_SYN, SYN_REPORT, 0 }; + struct input_event syn_report = { + .input_event_sec = 0, + .input_event_usec = 0, + .type = EV_SYN, + .code = SYN_REPORT, + .value = 0 + }; if (!tp->buttons.trackpoint) return; @@ -616,7 +622,8 @@ tp_process_trackpoint_button(struct tp_dispatch *tp, dispatch = tp->buttons.trackpoint->dispatch; event = *e; - syn_report.time = e->time; + syn_report.input_event_sec = e->input_event_sec; + syn_report.input_event_usec = e->input_event_usec; switch (event.code) { case BTN_0: diff --git a/src/evdev-tablet.c b/src/evdev-tablet.c index 021907f8..f3895fdd 100644 --- a/src/evdev-tablet.c +++ b/src/evdev-tablet.c @@ -1657,12 +1657,15 @@ static void tablet_proximity_out_quirk_timer_func(uint64_t now, void *data) { struct tablet_dispatch *tablet = data; + struct timeval tv = us2tv(now); struct input_event events[2] = { - { .time = us2tv(now), + { .input_event_sec = tv.tv_sec, + .input_event_usec = tv.tv_usec, .type = EV_KEY, .code = BTN_TOOL_PEN, .value = 0 }, - { .time = us2tv(now), + { .input_event_sec = tv.tv_sec, + .input_event_usec = tv.tv_usec, .type = EV_SYN, .code = SYN_REPORT, .value = 0 }, @@ -1729,9 +1732,10 @@ tablet_proximity_quirk_update(struct tablet_dispatch *tablet, /* If the timer function forced prox out before, fake a BTN_TOOL_PEN event */ if (tablet->quirks.proximity_out_forced) { - + struct timeval tv = us2tv(time); struct input_event fake_event = { - .time = us2tv(time), + .input_event_sec = tv.tv_sec, + .input_event_usec = tv.tv_usec, .type = EV_KEY, .code = BTN_TOOL_PEN, .value = 1, -- cgit v1.2.3