summaryrefslogtreecommitdiffstats
path: root/meta/recipes-graphics/wayland/libinput
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2019-11-25 00:44:50 -0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-11-27 13:25:18 +0000
commitcb69525031eee3fea53d012c9a7ad7a381e06b8a (patch)
tree31381dc3496b50baa23fe63844303897ad15be86 /meta/recipes-graphics/wayland/libinput
parentcd06e458ad6246c65cf4e91874b4fbf2fbd30113 (diff)
downloadpoky-cb69525031eee3fea53d012c9a7ad7a381e06b8a.tar.gz
libinput: Fix build when using 64bit time_t on 32bit machines
(From OE-Core rev: 49cf09110e18204f8ee47efbdc22d7eb346ea9d1) Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-graphics/wayland/libinput')
-rw-r--r--meta/recipes-graphics/wayland/libinput/0001-adjust-for-64bit-time_t-for-32bit-architectures.patch386
1 files changed, 386 insertions, 0 deletions
diff --git a/meta/recipes-graphics/wayland/libinput/0001-adjust-for-64bit-time_t-for-32bit-architectures.patch b/meta/recipes-graphics/wayland/libinput/0001-adjust-for-64bit-time_t-for-32bit-architectures.patch
new file mode 100644
index 0000000000..344e6aaf8f
--- /dev/null
+++ b/meta/recipes-graphics/wayland/libinput/0001-adjust-for-64bit-time_t-for-32bit-architectures.patch
@@ -0,0 +1,386 @@
1From ab6ce09bfb669177c90cc5c10155eec44e9fc34b Mon Sep 17 00:00:00 2001
2From: Peter Hutterer <peter.hutterer@who-t.net>
3Date: Sat, 23 Nov 2019 17:23:56 -0800
4Subject: [PATCH] Adjust for 64bit time_t for 32bit architectures
5
6Upstream-Status: Submitted [https://gitlab.freedesktop.org/libinput/libinput/merge_requests/346]
7Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
8---
9 meson.build | 1 +
10 src/evdev-mt-touchpad-buttons.c | 15 ++++---
11 src/evdev.c | 5 ++-
12 src/util-input-event.h | 69 +++++++++++++++++++++++++++++++++
13 tools/libinput-record.c | 16 +++++---
14 5 files changed, 90 insertions(+), 16 deletions(-)
15 create mode 100644 src/util-input-event.h
16
17--- a/meson.build
18+++ b/meson.build
19@@ -220,7 +220,8 @@ endif
20 ############ libinput-util.a ############
21 src_libinput_util = [
22 'src/libinput-util.c',
23- 'src/libinput-util.h'
24+ 'src/libinput-util.h',
25+ 'src/util-input-event.h'
26 ]
27 libinput_util = static_library('libinput-util',
28 src_libinput_util,
29--- a/src/evdev-mt-touchpad-buttons.c
30+++ b/src/evdev-mt-touchpad-buttons.c
31@@ -30,6 +30,7 @@
32 #include <unistd.h>
33 #include "linux/input.h"
34
35+#include "util-input-event.h"
36 #include "evdev-mt-touchpad.h"
37
38 #define DEFAULT_BUTTON_ENTER_TIMEOUT ms2us(100)
39@@ -1145,14 +1146,12 @@ tp_notify_clickpadbutton(struct tp_dispa
40 if (tp->buttons.trackpoint) {
41 if (is_topbutton) {
42 struct evdev_dispatch *dispatch = tp->buttons.trackpoint->dispatch;
43- struct input_event event;
44- struct input_event syn_report = {{ 0, 0 }, EV_SYN, SYN_REPORT, 0 };
45+ struct input_event event, syn_report;
46+ int value;
47
48- event.time = us2tv(time);
49- event.type = EV_KEY;
50- event.code = button;
51- event.value = (state == LIBINPUT_BUTTON_STATE_PRESSED) ? 1 : 0;
52- syn_report.time = event.time;
53+ value = (state == LIBINPUT_BUTTON_STATE_PRESSED) ? 1 : 0;
54+ event = input_event_init(time, EV_KEY, button, value);
55+ syn_report = input_event_init(time, EV_SYN, SYN_REPORT, 0);
56 dispatch->interface->process(dispatch,
57 tp->buttons.trackpoint,
58 &event,
59--- a/src/evdev.c
60+++ b/src/evdev.c
61@@ -44,6 +44,7 @@
62 #include "filter.h"
63 #include "libinput-private.h"
64 #include "quirks.h"
65+#include "util-input-event.h"
66
67 #if HAVE_LIBWACOM
68 #include <libwacom/libwacom.h>
69@@ -859,7 +860,7 @@ evdev_print_event(struct evdev_device *d
70 {
71 static uint32_t offset = 0;
72 static uint32_t last_time = 0;
73- uint32_t time = us2ms(tv2us(&e->time));
74+ uint32_t time = us2ms(input_event_time(e));
75
76 if (offset == 0) {
77 offset = time;
78@@ -891,7 +892,7 @@ static inline void
79 evdev_process_event(struct evdev_device *device, struct input_event *e)
80 {
81 struct evdev_dispatch *dispatch = device->dispatch;
82- uint64_t time = tv2us(&e->time);
83+ uint64_t time = input_event_time(e);
84
85 #if 0
86 evdev_print_event(device, e);
87--- /dev/null
88+++ b/src/util-input-event.h
89@@ -0,0 +1,69 @@
90+/*
91+ * Copyright © 2019 Red Hat, Inc.
92+ *
93+ * Permission is hereby granted, free of charge, to any person obtaining a
94+ * copy of this software and associated documentation files (the "Software"),
95+ * to deal in the Software without restriction, including without limitation
96+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
97+ * and/or sell copies of the Software, and to permit persons to whom the
98+ * Software is furnished to do so, subject to the following conditions:
99+ *
100+ * The above copyright notice and this permission notice (including the next
101+ * paragraph) shall be included in all copies or substantial portions of the
102+ * Software.
103+ *
104+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
105+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
106+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
107+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
108+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
109+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
110+ * DEALINGS IN THE SOFTWARE.
111+ */
112+
113+#pragma once
114+
115+#include "config.h"
116+
117+#include "util-time.h"
118+#include <linux/input.h>
119+
120+static inline struct input_event
121+input_event_init(uint64_t time,
122+ unsigned int code,
123+ unsigned int type,
124+ int value)
125+{
126+ struct input_event ev;
127+ struct timeval tval = us2tv(time);
128+
129+ ev.input_event_sec = tval.tv_sec;
130+ ev.input_event_usec = tval.tv_usec;
131+ ev.type = type;
132+ ev.code = code;
133+ ev.value = value;
134+
135+ return ev;
136+}
137+
138+static inline uint64_t
139+input_event_time(const struct input_event *e)
140+{
141+ struct timeval tval;
142+
143+ tval.tv_sec = e->input_event_sec;
144+ tval.tv_usec = e->input_event_usec;
145+
146+ return tv2us(&tval);
147+}
148+
149+
150+static inline void
151+input_event_set_time(struct input_event *e,
152+ uint64_t time)
153+{
154+ struct timeval tval = us2tv(time);
155+
156+ e->input_event_sec = tval.tv_sec;
157+ e->input_event_usec = tval.tv_usec;
158+}
159--- a/tools/libinput-record.c
160+++ b/tools/libinput-record.c
161@@ -41,6 +41,7 @@
162 #include <stdbool.h>
163
164 #include "libinput-versionsort.h"
165+#include "util-input-event.h"
166 #include "libinput-util.h"
167 #include "libinput-version.h"
168 #include "libinput-git-version.h"
169@@ -196,8 +197,9 @@ print_evdev_event(struct record_context
170 const char *cname;
171 bool was_modified = false;
172 char desc[1024];
173+ uint64_t time = input_event_time(ev) - ctx->offset;
174
175- ev->time = us2tv(tv2us(&ev->time) - ctx->offset);
176+ input_event_set_time(ev, time);
177
178 /* Don't leak passwords unless the user wants to */
179 if (!ctx->show_keycodes)
180@@ -215,7 +217,7 @@ print_evdev_event(struct record_context
181 static unsigned long last_ms = 0;
182 unsigned long time, dt;
183
184- time = us2ms(tv2us(&ev->time));
185+ time = us2ms(input_event_time(ev));
186 dt = time - last_ms;
187 last_ms = time;
188
189@@ -239,8 +241,8 @@ print_evdev_event(struct record_context
190
191 iprintf(ctx,
192 "- [%3lu, %6u, %3d, %3d, %6d] # %s\n",
193- ev->time.tv_sec,
194- (unsigned int)ev->time.tv_usec,
195+ ev->input_event_sec,
196+ (unsigned int)ev->input_event_usec,
197 ev->type,
198 ev->code,
199 ev->value,
200@@ -268,16 +270,18 @@ handle_evdev_frame(struct record_context
201 while (libevdev_next_event(evdev,
202 LIBEVDEV_READ_FLAG_NORMAL,
203 &e) == LIBEVDEV_READ_STATUS_SUCCESS) {
204+ uint64_t time;
205
206 if (ctx->offset == 0)
207- ctx->offset = tv2us(&e.time);
208+ ctx->offset = input_event_time(&e);
209
210 if (d->nevents == d->events_sz)
211 resize(d->events, d->events_sz);
212
213 event = &d->events[d->nevents++];
214 event->type = EVDEV;
215- event->time = tv2us(&e.time) - ctx->offset;
216+ time = input_event_time(&e);
217+ input_event_set_time(&e, time - ctx->offset);
218 event->u.evdev = e;
219 count++;
220
221--- a/src/libinput-private.h
222+++ b/src/libinput-private.h
223@@ -39,6 +39,7 @@
224
225 #include "libinput.h"
226 #include "libinput-util.h"
227+#include "util-time.h"
228 #include "libinput-version.h"
229
230 #if LIBINPUT_VERSION_MICRO >= 90
231--- a/src/libinput-util.h
232+++ b/src/libinput-util.h
233@@ -206,12 +206,6 @@ clear_bit(unsigned char *array, int bit)
234 array[bit / 8] &= ~(1 << (bit % 8));
235 }
236
237-static inline void
238-msleep(unsigned int ms)
239-{
240- usleep(ms * 1000);
241-}
242-
243 static inline bool
244 long_bit_is_set(const unsigned long *array, int bit)
245 {
246@@ -453,53 +447,6 @@ bool
247 parse_switch_reliability_property(const char *prop,
248 enum switch_reliability *reliability);
249
250-static inline uint64_t
251-us(uint64_t us)
252-{
253- return us;
254-}
255-
256-static inline uint64_t
257-ns2us(uint64_t ns)
258-{
259- return us(ns / 1000);
260-}
261-
262-static inline uint64_t
263-ms2us(uint64_t ms)
264-{
265- return us(ms * 1000);
266-}
267-
268-static inline uint64_t
269-s2us(uint64_t s)
270-{
271- return ms2us(s * 1000);
272-}
273-
274-static inline uint32_t
275-us2ms(uint64_t us)
276-{
277- return (uint32_t)(us / 1000);
278-}
279-
280-static inline uint64_t
281-tv2us(const struct timeval *tv)
282-{
283- return s2us(tv->tv_sec) + tv->tv_usec;
284-}
285-
286-static inline struct timeval
287-us2tv(uint64_t time)
288-{
289- struct timeval tv;
290-
291- tv.tv_sec = time / ms2us(1000);
292- tv.tv_usec = time % ms2us(1000);
293-
294- return tv;
295-}
296-
297 static inline bool
298 safe_atoi_base(const char *str, int *val, int base)
299 {
300--- /dev/null
301+++ b/src/util-time.h
302@@ -0,0 +1,84 @@
303+/*
304+ * Copyright © 2013-2019 Red Hat, Inc.
305+ *
306+ * Permission is hereby granted, free of charge, to any person obtaining a
307+ * copy of this software and associated documentation files (the "Software"),
308+ * to deal in the Software without restriction, including without limitation
309+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
310+ * and/or sell copies of the Software, and to permit persons to whom the
311+ * Software is furnished to do so, subject to the following conditions:
312+ *
313+ * The above copyright notice and this permission notice (including the next
314+ * paragraph) shall be included in all copies or substantial portions of the
315+ * Software.
316+ *
317+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
318+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
319+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
320+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
321+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
322+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
323+ * DEALINGS IN THE SOFTWARE.
324+ */
325+
326+#pragma once
327+
328+#include "config.h"
329+
330+#include <time.h>
331+#include <stdint.h>
332+#include <unistd.h>
333+#include <linux/input.h>
334+
335+static inline void
336+msleep(unsigned int ms)
337+{
338+ usleep(ms * 1000);
339+}
340+
341+static inline uint64_t
342+us(uint64_t us)
343+{
344+ return us;
345+}
346+
347+static inline uint64_t
348+ns2us(uint64_t ns)
349+{
350+ return us(ns / 1000);
351+}
352+
353+static inline uint64_t
354+ms2us(uint64_t ms)
355+{
356+ return us(ms * 1000);
357+}
358+
359+static inline uint64_t
360+s2us(uint64_t s)
361+{
362+ return ms2us(s * 1000);
363+}
364+
365+static inline uint32_t
366+us2ms(uint64_t us)
367+{
368+ return (uint32_t)(us / 1000);
369+}
370+
371+static inline uint64_t
372+tv2us(const struct timeval *tv)
373+{
374+ return s2us(tv->tv_sec) + tv->tv_usec;
375+}
376+
377+static inline struct timeval
378+us2tv(uint64_t time)
379+{
380+ struct timeval tv;
381+
382+ tv.tv_sec = time / ms2us(1000);
383+ tv.tv_usec = time % ms2us(1000);
384+
385+ return tv;
386+}