blob: 2f766465e1c24377306702939d0e4b39e7f35564 [file] [log] [blame]
Brad Bishope42b3e32020-01-15 22:08:42 -05001From 0b66557f2e924023b12006b58d8e86149c745aed Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Sat, 30 Nov 2019 20:34:33 -0800
4Subject: [PATCH] Fix build on 32bit arches with 64bit time_t
5
6time element is deprecated on new input_event structure in kernel's
7input.h [1]
8
9[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit?id=152194fe9c3f
10
11Upstream-Status: Pending
12Signed-off-by: Khem Raj <raj.khem@gmail.com>
13---
14 inputdrivers/linux_input/linux_input.c | 36 ++++++++++++++++++--------
15 1 file changed, 25 insertions(+), 11 deletions(-)
16
17diff --git a/inputdrivers/linux_input/linux_input.c b/inputdrivers/linux_input/linux_input.c
18index 7e9a6ad..03deebc 100644
19--- a/inputdrivers/linux_input/linux_input.c
20+++ b/inputdrivers/linux_input/linux_input.c
21@@ -42,6 +42,11 @@ typedef unsigned long kernel_ulong_t;
22
23 #include <linux/input.h>
24
25+#ifndef input_event_sec
26+#define input_event_sec time.tv_sec
27+#define input_event_usec time.tv_usec
28+#endif
29+
30 #ifndef KEY_OK
31 /* Linux kernel 2.5.42+ defines additional keys in linux/input.h */
32 #include "input_fake.h"
33@@ -754,7 +759,8 @@ translate_event( const LinuxInputData *data,
34 DFBInputEvent *devt )
35 {
36 devt->flags = DIEF_TIMESTAMP;
37- devt->timestamp = levt->time;
38+ devt->timestamp.tv_sec = levt->input_event_sec;
39+ devt->timestamp.tv_usec = levt->input_event_usec;
40
41 switch (levt->type) {
42 case EV_KEY:
43@@ -2139,7 +2145,8 @@ touchpad_translate( struct touchpad_fsm_state *state,
44 int abs, rel;
45
46 devt->flags = DIEF_TIMESTAMP | (dfb_config->linux_input_touch_abs ? DIEF_AXISABS : DIEF_AXISREL);
47- devt->timestamp = levt->time;
48+ devt->timestamp.tv_sec = levt->input_event_sec;
49+ devt->timestamp.tv_usec = levt->input_event_usec;
50 devt->type = DIET_AXISMOTION;
51
52 switch (levt->code) {
53@@ -2204,7 +2211,7 @@ touchpad_fsm( struct touchpad_fsm_state *state,
54 DFBInputEvent *devt )
55 {
56 struct timeval timeout = { 0, 125000 };
57-
58+ struct timeval tval;
59 /* select() timeout? */
60 if (!levt) {
61 /* Check if button release is due. */
62@@ -2223,6 +2230,8 @@ touchpad_fsm( struct touchpad_fsm_state *state,
63 return 0;
64 }
65
66+ tval.tv_sec = levt->input_event_sec;
67+ tval.tv_usec = levt->input_event_usec;
68 /* More or less ignore these events for now */
69 if ((levt->type == EV_SYN && levt->code == SYN_REPORT) ||
70 (levt->type == EV_ABS && levt->code == ABS_PRESSURE) ||
71@@ -2233,7 +2242,7 @@ touchpad_fsm( struct touchpad_fsm_state *state,
72
73 /* Check if button release is due. */
74 if (state->fsm_state == TOUCHPAD_FSM_DRAG_START &&
75- timeout_passed( &state->timeout, &levt->time )) {
76+ timeout_passed( &state->timeout, &tval )) {
77 devt->flags = DIEF_TIMESTAMP;
78 devt->timestamp = state->timeout; /* timeout of levt->time? */
79 devt->type = DIET_BUTTONRELEASE;
80@@ -2255,7 +2264,8 @@ touchpad_fsm( struct touchpad_fsm_state *state,
81 case TOUCHPAD_FSM_START:
82 if (touchpad_finger_landing( levt )) {
83 state->fsm_state = TOUCHPAD_FSM_MAIN;
84- state->timeout = levt->time;
85+ state->timeout.tv_sec = levt->input_event_sec;
86+ state->timeout.tv_usec = levt->input_event_usec;
87 timeout_add( &state->timeout, &timeout );
88 }
89 return 0;
90@@ -2268,15 +2278,17 @@ touchpad_fsm( struct touchpad_fsm_state *state,
91 }
92 }
93 else if (touchpad_finger_leaving( levt )) {
94- if (!timeout_passed( &state->timeout, &levt->time )) {
95+ if (!timeout_passed( &state->timeout, &tval )) {
96 devt->flags = DIEF_TIMESTAMP;
97- devt->timestamp = levt->time;
98+ devt->timestamp.tv_sec = levt->input_event_sec;
99+ devt->timestamp.tv_usec = levt->input_event_usec;
100 devt->type = DIET_BUTTONPRESS;
101 devt->button = DIBI_FIRST;
102
103 touchpad_fsm_init( state );
104 state->fsm_state = TOUCHPAD_FSM_DRAG_START;
105- state->timeout = levt->time;
106+ state->timeout.tv_sec = levt->input_event_sec;
107+ state->timeout.tv_usec = levt->input_event_usec;
108 timeout_add( &state->timeout, &timeout );
109 return 1;
110 }
111@@ -2287,7 +2299,7 @@ touchpad_fsm( struct touchpad_fsm_state *state,
112 return 0;
113
114 case TOUCHPAD_FSM_DRAG_START:
115- if (timeout_passed( &state->timeout, &levt->time )){
116+ if (timeout_passed( &state->timeout, &tval )){
117 devt->flags = DIEF_TIMESTAMP;
118 devt->timestamp = state->timeout; /* timeout of levt->time? */
119 devt->type = DIET_BUTTONRELEASE;
120@@ -2299,7 +2311,8 @@ touchpad_fsm( struct touchpad_fsm_state *state,
121 else {
122 if (touchpad_finger_landing( levt )) {
123 state->fsm_state = TOUCHPAD_FSM_DRAG_MAIN;
124- state->timeout = levt->time;
125+ state->timeout.tv_sec = levt->input_event_sec;
126+ state->timeout.tv_usec = levt->input_event_usec;
127 timeout_add( &state->timeout, &timeout );
128 }
129 }
130@@ -2314,7 +2327,8 @@ touchpad_fsm( struct touchpad_fsm_state *state,
131 }
132 else if (touchpad_finger_leaving( levt )) {
133 devt->flags = DIEF_TIMESTAMP;
134- devt->timestamp = levt->time;
135+ devt->timestamp.tv_sec = levt->input_event_sec;
136+ devt->timestamp.tv_usec = levt->input_event_usec;
137 devt->type = DIET_BUTTONRELEASE;
138 devt->button = DIBI_FIRST;
139