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 <deepa.kernel@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Deepa Dinamani 2018-01-15 16:16:37 -08:00 committed by Peter Hutterer
parent 30a398591b
commit ee163ef63e
3 changed files with 30 additions and 6 deletions

View file

@ -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,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;

View file

@ -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:

View file

@ -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,