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 deepa.kernel@gmail.com --- include/linux/input.h | 14 +++++++++++++- src/evdev-mt-touchpad.c | 11 +++++++++-- src/evdev-tablet.c | 12 ++++++++---- 3 files changed, 30 insertions(+), 7 deletions(-)
diff --git a/include/linux/input.h b/include/linux/input.h index 06316b27..8274c292 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 <sys/time.h> #include <sys/ioctl.h> #include <sys/types.h> @@ -17,10 +19,20 @@
/* * 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 52df8fd2..7190df1c 100644 --- a/src/evdev-mt-touchpad.c +++ b/src/evdev-mt-touchpad.c @@ -522,7 +522,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; @@ -530,7 +536,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 8188686c..f81ad862 100644 --- a/src/evdev-tablet.c +++ b/src/evdev-tablet.c @@ -1650,12 +1650,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 }, @@ -1708,9 +1711,10 @@ tablet_proximity_out_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,
Sorry for the delay, too many things on at once. FTR, libinput patches should go to wayland-devel, this list is for low-level input tools.
On Mon, Jan 15, 2018 at 04:16:37PM -0800, Deepa Dinamani wrote:
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 deepa.kernel@gmail.com
Reviewed-by: Peter Hutterer peter.hutterer@who-t.net
Unless someone else has any comments, this looks good to me, I'll get this merged soon
Cheers, Peter
include/linux/input.h | 14 +++++++++++++- src/evdev-mt-touchpad.c | 11 +++++++++-- src/evdev-tablet.c | 12 ++++++++---- 3 files changed, 30 insertions(+), 7 deletions(-)
diff --git a/include/linux/input.h b/include/linux/input.h index 06316b27..8274c292 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 <sys/time.h> #include <sys/ioctl.h> #include <sys/types.h> @@ -17,10 +19,20 @@ /*
- 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 52df8fd2..7190df1c 100644 --- a/src/evdev-mt-touchpad.c +++ b/src/evdev-mt-touchpad.c @@ -522,7 +522,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; @@ -530,7 +536,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 8188686c..f81ad862 100644 --- a/src/evdev-tablet.c +++ b/src/evdev-tablet.c @@ -1650,12 +1650,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,
.type = EV_KEY, .code = BTN_TOOL_PEN, .value = 0 },.input_event_usec = tv.tv_usec,
{ .time = us2tv(now),
{ .input_event_sec = tv.tv_sec,
.type = EV_SYN, .code = SYN_REPORT, .value = 0 },.input_event_usec = tv.tv_usec,
@@ -1708,9 +1711,10 @@ tablet_proximity_out_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,
-- 2.14.1
Input-tools mailing list Input-tools@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/input-tools
Am 16.01.2018 01:16 schrieb Deepa Dinamani:
The struct input_event is not y2038 safe. Update the struct according to the kernel patch: https://lkml.org/lkml/2018/1/6/324
For me, this patch doesn't even apply -.- Could be my fault, but what are you creating this against?
Other than that, I would really not pull in changes that aren't even in Linus' tree yet. We'd have a lot of unnecessary work here if we track an experimental input tree before it's ever released in Linux.
thanks
martin
On Tue, Jan 30, 2018 at 9:50 AM, Martin Kepplinger martink@posteo.de wrote:
Am 16.01.2018 01:16 schrieb Deepa Dinamani:
The struct input_event is not y2038 safe. Update the struct according to the kernel patch: https://lkml.org/lkml/2018/1/6/324
For me, this patch doesn't even apply -.- Could be my fault, but what are you creating this against?
These patches were based on
mtdev commit 5f9caa26b81155feede6ff71c9b14fa0e8980fbd mtdev-matching.c: declare global variables static evemu commit 8cde0770ac4e45a93d4bcb0710c44b3ffe547a6f tools: s/evtest/evemu/ in the evemu-describe man page libevdev commit 022b2bc3b03320131966a465c464f989fa91905e include: sync with kernel 4.13
Other than that, I would really not pull in changes that aren't even in Linus' tree yet. We'd have a lot of unnecessary work here if we track an experimental input tree before it's ever released in Linux.
The patch is in linux-next: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?... . Adding Dmitry to clarify when he plans to merge this.
Apart from kernel, there should also be coordination between libraries. I'm not sure how this has been done in the past.
-Deepa
On Tue, Jan 30, 2018 at 05:45:55PM -0800, Deepa Dinamani wrote:
On Tue, Jan 30, 2018 at 9:50 AM, Martin Kepplinger martink@posteo.de wrote:
Am 16.01.2018 01:16 schrieb Deepa Dinamani:
The struct input_event is not y2038 safe. Update the struct according to the kernel patch: https://lkml.org/lkml/2018/1/6/324
For me, this patch doesn't even apply -.- Could be my fault, but what are you creating this against?
These patches were based on
mtdev commit 5f9caa26b81155feede6ff71c9b14fa0e8980fbd mtdev-matching.c: declare global variables static evemu commit 8cde0770ac4e45a93d4bcb0710c44b3ffe547a6f tools: s/evtest/evemu/ in the evemu-describe man page libevdev commit 022b2bc3b03320131966a465c464f989fa91905e include: sync with kernel 4.13
Other than that, I would really not pull in changes that aren't even in Linus' tree yet. We'd have a lot of unnecessary work here if we track an experimental input tree before it's ever released in Linux.
The patch is in linux-next: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?... . Adding Dmitry to clarify when he plans to merge this.
It will be merged in this merge window that just opened.
Thanks.
On Mon, Jan 15, 2018 at 04:16:37PM -0800, Deepa Dinamani wrote:
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 deepa.kernel@gmail.com
fwiw, this patch is now pushed to libinput, see commit ee163ef63e003f7d23a6e43dcb5f52a92dfebca7. Thanks!
Cheers, Peter
include/linux/input.h | 14 +++++++++++++- src/evdev-mt-touchpad.c | 11 +++++++++-- src/evdev-tablet.c | 12 ++++++++---- 3 files changed, 30 insertions(+), 7 deletions(-)
diff --git a/include/linux/input.h b/include/linux/input.h index 06316b27..8274c292 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 <sys/time.h> #include <sys/ioctl.h> #include <sys/types.h> @@ -17,10 +19,20 @@ /*
- 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 52df8fd2..7190df1c 100644 --- a/src/evdev-mt-touchpad.c +++ b/src/evdev-mt-touchpad.c @@ -522,7 +522,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; @@ -530,7 +536,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 8188686c..f81ad862 100644 --- a/src/evdev-tablet.c +++ b/src/evdev-tablet.c @@ -1650,12 +1650,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,
.type = EV_KEY, .code = BTN_TOOL_PEN, .value = 0 },.input_event_usec = tv.tv_usec,
{ .time = us2tv(now),
{ .input_event_sec = tv.tv_sec,
.type = EV_SYN, .code = SYN_REPORT, .value = 0 },.input_event_usec = tv.tv_usec,
@@ -1708,9 +1711,10 @@ tablet_proximity_out_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,
-- 2.14.1
Input-tools mailing list Input-tools@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/input-tools