summaryrefslogtreecommitdiffstats
path: root/external/meta-openembedded/meta-oe/recipes-graphics/tslib/tslib/0001-Fix-build-on-32bit-arches-with-64bit-time_t.patch
blob: 59bd97a0f2917bf1c43951e07e99113d793d01cf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
From 5455055660700be18eb8800e56e2423031ed4c76 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Sat, 30 Nov 2019 19:59:29 -0800
Subject: [PATCH] Fix build on 32bit arches with 64bit time_t

time element is deprecated on new input_event structure in kernel's
input.h [1]

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit?id=152194fe9c3f

Upstream-Status: Submitted [https://github.com/libts/tslib/pull/162]

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 plugins/input-raw.c | 59 +++++++++++++++++++++++++++-------------
 tools/ts_uinput.c   | 66 ++++++++++++++++++++++++++++++---------------
 2 files changed, 85 insertions(+), 40 deletions(-)

diff --git a/plugins/input-raw.c b/plugins/input-raw.c
index 64f0156..f030836 100644
--- a/plugins/input-raw.c
+++ b/plugins/input-raw.c
@@ -40,6 +40,11 @@
 # include <linux/input.h>
 #endif
 
+#ifndef input_event_sec
+#define input_event_sec time.tv_sec
+#define input_event_usec time.tv_usec
+#endif
+
 #ifndef EV_SYN /* 2.4 kernel headers */
 # define EV_SYN 0x00
 #endif
@@ -384,7 +389,8 @@ static int ts_input_read(struct tslib_module_info *inf,
 						samp->y = i->current_y;
 						samp->pressure = i->current_p;
 					}
-					samp->tv = ev.time;
+					samp->tv.tv_sec = ev.input_event_sec;
+					samp->tv.tv_usec = ev.input_event_usec;
 			#ifdef DEBUG
 				fprintf(stderr,
 					"RAW---------------------> %d %d %d %ld.%ld\n",
@@ -519,7 +525,8 @@ static int ts_input_read(struct tslib_module_info *inf,
 					samp->pressure = i->current_p = ev.value;
 					break;
 				}
-				samp->tv = ev.time;
+				samp->tv.tv_sec = ev.input_event_sec;
+				samp->tv.tv_usec = ev.input_event_usec;
 	#ifdef DEBUG
 				fprintf(stderr,
 					"RAW---------------------------> %d %d %d\n",
@@ -536,7 +543,8 @@ static int ts_input_read(struct tslib_module_info *inf,
 						samp->x = 0;
 						samp->y = 0;
 						samp->pressure = 0;
-						samp->tv = ev.time;
+						samp->tv.tv_sec = ev.input_event_sec;
+						samp->tv.tv_usec = ev.input_event_usec;
 						samp++;
 						total++;
 					}
@@ -651,7 +659,8 @@ static int ts_input_read_mt(struct tslib_module_info *inf,
 				switch (i->ev[it].code) {
 				case BTN_TOUCH:
 					i->buf[total][i->slot].pen_down = i->ev[it].value;
-					i->buf[total][i->slot].tv = i->ev[it].time;
+					i->buf[total][i->slot].tv.tv_sec = i->ev[it].input_event_sec;
+					i->buf[total][i->slot].tv.tv_usec = i->ev[it].input_event_usec;
 					i->buf[total][i->slot].valid |= TSLIB_MT_VALID;
 					if (i->ev[it].value == 0)
 						pen_up = 1;
@@ -751,7 +760,8 @@ static int ts_input_read_mt(struct tslib_module_info *inf,
 					// fall through
 				case ABS_MT_POSITION_X:
 					i->buf[total][i->slot].x = i->ev[it].value;
-					i->buf[total][i->slot].tv = i->ev[it].time;
+					i->buf[total][i->slot].tv.tv_sec = i->ev[it].input_event_sec;
+					i->buf[total][i->slot].tv.tv_usec = i->ev[it].input_event_usec;
 					i->buf[total][i->slot].valid |= TSLIB_MT_VALID;
 					break;
 				case ABS_Y:
@@ -760,7 +770,8 @@ static int ts_input_read_mt(struct tslib_module_info *inf,
 					// fall through
 				case ABS_MT_POSITION_Y:
 					i->buf[total][i->slot].y = i->ev[it].value;
-					i->buf[total][i->slot].tv = i->ev[it].time;
+					i->buf[total][i->slot].tv.tv_sec = i->ev[it].input_event_sec;
+					i->buf[total][i->slot].tv.tv_usec = i->ev[it].input_event_usec;
 					i->buf[total][i->slot].valid |= TSLIB_MT_VALID;
 					break;
 				case ABS_PRESSURE:
@@ -769,12 +780,14 @@ static int ts_input_read_mt(struct tslib_module_info *inf,
 					// fall through
 				case ABS_MT_PRESSURE:
 					i->buf[total][i->slot].pressure = i->ev[it].value;
-					i->buf[total][i->slot].tv = i->ev[it].time;
+					i->buf[total][i->slot].tv.tv_sec = i->ev[it].input_event_sec;
+					i->buf[total][i->slot].tv.tv_usec = i->ev[it].input_event_usec;
 					i->buf[total][i->slot].valid |= TSLIB_MT_VALID;
 					break;
 				case ABS_MT_TOOL_X:
 					i->buf[total][i->slot].tool_x = i->ev[it].value;
-					i->buf[total][i->slot].tv = i->ev[it].time;
+					i->buf[total][i->slot].tv.tv_sec = i->ev[it].input_event_sec;
+					i->buf[total][i->slot].tv.tv_usec = i->ev[it].input_event_usec;
 					i->buf[total][i->slot].valid |= TSLIB_MT_VALID;
 					/* for future use
 					 * i->buf[total][i->slot].valid |= TSLIB_MT_VALID_TOOL;
@@ -782,7 +795,8 @@ static int ts_input_read_mt(struct tslib_module_info *inf,
 					break;
 				case ABS_MT_TOOL_Y:
 					i->buf[total][i->slot].tool_y = i->ev[it].value;
-					i->buf[total][i->slot].tv = i->ev[it].time;
+					i->buf[total][i->slot].tv.tv_sec = i->ev[it].input_event_sec;
+					i->buf[total][i->slot].tv.tv_usec = i->ev[it].input_event_usec;
 					i->buf[total][i->slot].valid |= TSLIB_MT_VALID;
 					/* for future use
 					 * i->buf[total][i->slot].valid |= TSLIB_MT_VALID_TOOL;
@@ -790,7 +804,8 @@ static int ts_input_read_mt(struct tslib_module_info *inf,
 					break;
 				case ABS_MT_TOOL_TYPE:
 					i->buf[total][i->slot].tool_type = i->ev[it].value;
-					i->buf[total][i->slot].tv = i->ev[it].time;
+					i->buf[total][i->slot].tv.tv_sec = i->ev[it].input_event_sec;
+					i->buf[total][i->slot].tv.tv_usec = i->ev[it].input_event_usec;
 					i->buf[total][i->slot].valid |= TSLIB_MT_VALID;
 					/* for future use
 					 * i->buf[total][i->slot].valid |= TSLIB_MT_VALID_TOOL;
@@ -798,12 +813,14 @@ static int ts_input_read_mt(struct tslib_module_info *inf,
 					break;
 				case ABS_MT_ORIENTATION:
 					i->buf[total][i->slot].orientation = i->ev[it].value;
-					i->buf[total][i->slot].tv = i->ev[it].time;
+					i->buf[total][i->slot].tv.tv_sec = i->ev[it].input_event_sec;
+					i->buf[total][i->slot].tv.tv_usec = i->ev[it].input_event_usec;
 					i->buf[total][i->slot].valid |= TSLIB_MT_VALID;
 					break;
 				case ABS_MT_DISTANCE:
 					i->buf[total][i->slot].distance = i->ev[it].value;
-					i->buf[total][i->slot].tv = i->ev[it].time;
+					i->buf[total][i->slot].tv.tv_sec = i->ev[it].input_event_sec;
+					i->buf[total][i->slot].tv.tv_usec = i->ev[it].input_event_usec;
 					i->buf[total][i->slot].valid |= TSLIB_MT_VALID;
 
 					if (i->special_device == EGALAX_VERSION_210) {
@@ -816,34 +833,40 @@ static int ts_input_read_mt(struct tslib_module_info *inf,
 					break;
 				case ABS_MT_BLOB_ID:
 					i->buf[total][i->slot].blob_id = i->ev[it].value;
-					i->buf[total][i->slot].tv = i->ev[it].time;
+					i->buf[total][i->slot].tv.tv_sec = i->ev[it].input_event_sec;
+					i->buf[total][i->slot].tv.tv_usec = i->ev[it].input_event_usec;
 					i->buf[total][i->slot].valid |= TSLIB_MT_VALID;
 					break;
 				case ABS_MT_TOUCH_MAJOR:
 					i->buf[total][i->slot].touch_major = i->ev[it].value;
-					i->buf[total][i->slot].tv = i->ev[it].time;
+					i->buf[total][i->slot].tv.tv_sec = i->ev[it].input_event_sec;
+					i->buf[total][i->slot].tv.tv_usec = i->ev[it].input_event_usec;
 					i->buf[total][i->slot].valid |= TSLIB_MT_VALID;
 					if (i->ev[it].value == 0)
 						i->buf[total][i->slot].pressure = 0;
 					break;
 				case ABS_MT_WIDTH_MAJOR:
 					i->buf[total][i->slot].width_major = i->ev[it].value;
-					i->buf[total][i->slot].tv = i->ev[it].time;
+					i->buf[total][i->slot].tv.tv_sec = i->ev[it].input_event_sec;
+					i->buf[total][i->slot].tv.tv_usec = i->ev[it].input_event_usec;
 					i->buf[total][i->slot].valid |= TSLIB_MT_VALID;
 					break;
 				case ABS_MT_TOUCH_MINOR:
 					i->buf[total][i->slot].touch_minor = i->ev[it].value;
-					i->buf[total][i->slot].tv = i->ev[it].time;
+					i->buf[total][i->slot].tv.tv_sec = i->ev[it].input_event_sec;
+					i->buf[total][i->slot].tv.tv_usec = i->ev[it].input_event_usec;
 					i->buf[total][i->slot].valid |= TSLIB_MT_VALID;
 					break;
 				case ABS_MT_WIDTH_MINOR:
 					i->buf[total][i->slot].width_minor = i->ev[it].value;
-					i->buf[total][i->slot].tv = i->ev[it].time;
+					i->buf[total][i->slot].tv.tv_sec = i->ev[it].input_event_sec;
+					i->buf[total][i->slot].tv.tv_usec = i->ev[it].input_event_usec;
 					i->buf[total][i->slot].valid |= TSLIB_MT_VALID;
 					break;
 				case ABS_MT_TRACKING_ID:
 					i->buf[total][i->slot].tracking_id = i->ev[it].value;
-					i->buf[total][i->slot].tv = i->ev[it].time;
+					i->buf[total][i->slot].tv.tv_sec = i->ev[it].input_event_sec;
+					i->buf[total][i->slot].tv.tv_usec = i->ev[it].input_event_usec;
 					i->buf[total][i->slot].valid |= TSLIB_MT_VALID;
 					if (i->ev[it].value == -1)
 						i->buf[total][i->slot].pressure = 0;
diff --git a/tools/ts_uinput.c b/tools/ts_uinput.c
index 6ca4c3d..1832a07 100644
--- a/tools/ts_uinput.c
+++ b/tools/ts_uinput.c
@@ -170,14 +170,16 @@ static int send_touch_events(struct data_t *data, struct ts_sample_mt **s,
 				continue;
 
 			if (s[j][i].pen_down == 1) {
-				data->ev[c].time = s[j][i].tv;
+				data->ev[c].input_event_sec = s[j][i].tv.tv_sec;
+				data->ev[c].input_event_usec = s[j][i].tv.tv_usec;
 				data->ev[c].type = EV_KEY;
 				data->ev[c].code = BTN_TOUCH;
 				data->ev[c].value = s[j][i].pen_down;
 				c++;
 			}
 
-			data->ev[c].time = s[j][i].tv;
+			data->ev[c].input_event_sec = s[j][i].tv.tv_sec;
+			data->ev[c].input_event_usec = s[j][i].tv.tv_usec;
 			data->ev[c].type = EV_ABS;
 			data->ev[c].code = ABS_MT_SLOT;
 			data->ev[c].value = s[j][i].slot;
@@ -190,111 +192,129 @@ static int send_touch_events(struct data_t *data, struct ts_sample_mt **s,
 			 * we should use slot 1 and so on.
 			 */
 			if (i == 0) {
-				data->ev[c].time = s[j][i].tv;
+				data->ev[c].input_event_sec = s[j][i].tv.tv_sec;
+				data->ev[c].input_event_usec = s[j][i].tv.tv_usec;
 				data->ev[c].type = EV_ABS;
 				data->ev[c].code = ABS_X;
 				data->ev[c].value = s[j][i].x;
 				c++;
 
-				data->ev[c].time = s[j][i].tv;
+				data->ev[c].input_event_sec = s[j][i].tv.tv_sec;
+				data->ev[c].input_event_usec = s[j][i].tv.tv_usec;
 				data->ev[c].type = EV_ABS;
 				data->ev[c].code = ABS_Y;
 				data->ev[c].value = s[j][i].y;
 				c++;
 
-				data->ev[c].time = s[j][i].tv;
+				data->ev[c].input_event_sec = s[j][i].tv.tv_sec;
+				data->ev[c].input_event_usec = s[j][i].tv.tv_usec;
 				data->ev[c].type = EV_ABS;
 				data->ev[c].code = ABS_PRESSURE;
 				data->ev[c].value = s[j][i].pressure;
 				c++;
 			}
 
-			data->ev[c].time = s[j][i].tv;
+			data->ev[c].input_event_sec = s[j][i].tv.tv_sec;
+			data->ev[c].input_event_usec = s[j][i].tv.tv_usec;
 			data->ev[c].type = EV_ABS;
 			data->ev[c].code = ABS_MT_POSITION_X;
 			data->ev[c].value = s[j][i].x;
 			c++;
 
-			data->ev[c].time = s[j][i].tv;
+			data->ev[c].input_event_sec = s[j][i].tv.tv_sec;
+			data->ev[c].input_event_usec = s[j][i].tv.tv_usec;
 			data->ev[c].type = EV_ABS;
 			data->ev[c].code = ABS_MT_POSITION_Y;
 			data->ev[c].value = s[j][i].y;
 			c++;
 
-			data->ev[c].time = s[j][i].tv;
+			data->ev[c].input_event_sec = s[j][i].tv.tv_sec;
+			data->ev[c].input_event_usec = s[j][i].tv.tv_usec;
 			data->ev[c].type = EV_ABS;
 			data->ev[c].code = ABS_MT_PRESSURE;
 			data->ev[c].value = s[j][i].pressure;
 			c++;
 
-			data->ev[c].time = s[j][i].tv;
+			data->ev[c].input_event_sec = s[j][i].tv.tv_sec;
+			data->ev[c].input_event_usec = s[j][i].tv.tv_usec;
 			data->ev[c].type = EV_ABS;
 			data->ev[c].code = ABS_MT_TOUCH_MAJOR;
 			data->ev[c].value = s[j][i].touch_major;
 			c++;
 
-			data->ev[c].time = s[j][i].tv;
+			data->ev[c].input_event_sec = s[j][i].tv.tv_sec;
+			data->ev[c].input_event_usec = s[j][i].tv.tv_usec;
 			data->ev[c].type = EV_ABS;
 			data->ev[c].code = ABS_MT_WIDTH_MAJOR;
 			data->ev[c].value = s[j][i].width_major;
 			c++;
 
-			data->ev[c].time = s[j][i].tv;
+			data->ev[c].input_event_sec = s[j][i].tv.tv_sec;
+			data->ev[c].input_event_usec = s[j][i].tv.tv_usec;
 			data->ev[c].type = EV_ABS;
 			data->ev[c].code = ABS_MT_TOUCH_MINOR;
 			data->ev[c].value = s[j][i].touch_minor;
 			c++;
 
-			data->ev[c].time = s[j][i].tv;
+			data->ev[c].input_event_sec = s[j][i].tv.tv_sec;
+			data->ev[c].input_event_usec = s[j][i].tv.tv_usec;
 			data->ev[c].type = EV_ABS;
 			data->ev[c].code = ABS_MT_WIDTH_MINOR;
 			data->ev[c].value = s[j][i].width_minor;
 			c++;
 
-			data->ev[c].time = s[j][i].tv;
+			data->ev[c].input_event_sec = s[j][i].tv.tv_sec;
+			data->ev[c].input_event_usec = s[j][i].tv.tv_usec;
 			data->ev[c].type = EV_ABS;
 			data->ev[c].code = ABS_MT_TOOL_TYPE;
 			data->ev[c].value = s[j][i].tool_type;
 			c++;
 
-			data->ev[c].time = s[j][i].tv;
+			data->ev[c].input_event_sec = s[j][i].tv.tv_sec;
+			data->ev[c].input_event_usec = s[j][i].tv.tv_usec;
 			data->ev[c].type = EV_ABS;
 			data->ev[c].code = ABS_MT_TOOL_X;
 			data->ev[c].value = s[j][i].tool_x;
 			c++;
 
-			data->ev[c].time = s[j][i].tv;
+			data->ev[c].input_event_sec = s[j][i].tv.tv_sec;
+			data->ev[c].input_event_usec = s[j][i].tv.tv_usec;
 			data->ev[c].type = EV_ABS;
 			data->ev[c].code = ABS_MT_TOOL_Y;
 			data->ev[c].value = s[j][i].tool_y;
 			c++;
 
-			data->ev[c].time = s[j][i].tv;
+			data->ev[c].input_event_sec = s[j][i].tv.tv_sec;
+			data->ev[c].input_event_usec = s[j][i].tv.tv_usec;
 			data->ev[c].type = EV_ABS;
 			data->ev[c].code = ABS_MT_ORIENTATION;
 			data->ev[c].value = s[j][i].orientation;
 			c++;
 
-			data->ev[c].time = s[j][i].tv;
+			data->ev[c].input_event_sec = s[j][i].tv.tv_sec;
+			data->ev[c].input_event_usec = s[j][i].tv.tv_usec;
 			data->ev[c].type = EV_ABS;
 			data->ev[c].code = ABS_MT_DISTANCE;
 			data->ev[c].value = s[j][i].distance;
 			c++;
 
-			data->ev[c].time = s[j][i].tv;
+			data->ev[c].input_event_sec = s[j][i].tv.tv_sec;
+			data->ev[c].input_event_usec = s[j][i].tv.tv_usec;
 			data->ev[c].type = EV_ABS;
 			data->ev[c].code = ABS_MT_BLOB_ID;
 			data->ev[c].value = s[j][i].blob_id;
 			c++;
 
-			data->ev[c].time = s[j][i].tv;
+			data->ev[c].input_event_sec = s[j][i].tv.tv_sec;
+			data->ev[c].input_event_usec = s[j][i].tv.tv_usec;
 			data->ev[c].type = EV_ABS;
 			data->ev[c].code = ABS_MT_TRACKING_ID;
 			data->ev[c].value = s[j][i].tracking_id;
 			c++;
 
 			if (data->mt_type_a == 1) {
-				data->ev[c].time = s[j][i].tv;
+				data->ev[c].input_event_sec = s[j][i].tv.tv_sec;
+				data->ev[c].input_event_usec = s[j][i].tv.tv_usec;
 				data->ev[c].type = EV_SYN;
 				data->ev[c].code = SYN_MT_REPORT;
 				data->ev[c].value = 0;
@@ -302,7 +322,8 @@ static int send_touch_events(struct data_t *data, struct ts_sample_mt **s,
 			}
 
 			if (s[j][i].pen_down == 0) {
-				data->ev[c].time = s[j][i].tv;
+				data->ev[c].input_event_sec = s[j][i].tv.tv_sec;
+				data->ev[c].input_event_usec = s[j][i].tv.tv_usec;
 				data->ev[c].type = EV_KEY;
 				data->ev[c].code = BTN_TOUCH;
 				data->ev[c].value = s[j][i].pen_down;
@@ -312,7 +333,8 @@ static int send_touch_events(struct data_t *data, struct ts_sample_mt **s,
 		}
 
 		if (c > 0) {
-			data->ev[c].time = s[j][i].tv;
+			data->ev[c].input_event_sec = s[j][i].tv.tv_sec;
+			data->ev[c].input_event_usec = s[j][i].tv.tv_usec;
 			data->ev[c].type = EV_SYN;
 			data->ev[c].code = SYN_REPORT;
 			data->ev[c].value = 0;
-- 
2.24.0