summaryrefslogtreecommitdiffstats
path: root/external/meta-qt5/recipes-qt/qt5/qtbase/0018-input-Make-use-of-timeval-portable-for-64bit-time_t.patch
diff options
context:
space:
mode:
authortakeshi_hoshina <takeshi_hoshina@mail.toyota.co.jp>2020-11-02 11:07:33 +0900
committertakeshi_hoshina <takeshi_hoshina@mail.toyota.co.jp>2020-11-02 11:07:33 +0900
commit1c7d6584a7811b7785ae5c1e378f14b5ba0971cf (patch)
treecd70a267a5ef105ba32f200aa088e281fbd85747 /external/meta-qt5/recipes-qt/qt5/qtbase/0018-input-Make-use-of-timeval-portable-for-64bit-time_t.patch
parent4204309872da5cb401cbb2729d9e2d4869a87f42 (diff)
recipes
Diffstat (limited to 'external/meta-qt5/recipes-qt/qt5/qtbase/0018-input-Make-use-of-timeval-portable-for-64bit-time_t.patch')
-rw-r--r--external/meta-qt5/recipes-qt/qt5/qtbase/0018-input-Make-use-of-timeval-portable-for-64bit-time_t.patch70
1 files changed, 70 insertions, 0 deletions
diff --git a/external/meta-qt5/recipes-qt/qt5/qtbase/0018-input-Make-use-of-timeval-portable-for-64bit-time_t.patch b/external/meta-qt5/recipes-qt/qt5/qtbase/0018-input-Make-use-of-timeval-portable-for-64bit-time_t.patch
new file mode 100644
index 00000000..b0de9c26
--- /dev/null
+++ b/external/meta-qt5/recipes-qt/qt5/qtbase/0018-input-Make-use-of-timeval-portable-for-64bit-time_t.patch
@@ -0,0 +1,70 @@
+From 54328b4942eb8cc884bdf41d58f2408a60ea7605 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Mon, 25 Nov 2019 08:27:39 -0800
+Subject: [PATCH] input: Make use of timeval portable for 64bit time_t
+
+This patch avoids using time field of input_event structure which is not available
+on 32bit arches supporting 64bit time_t structs, Patch makes it compatible with new
+and keeps old input.h implementation functional as well.
+
+See https://sourceware.org/glibc/wiki/Y2038ProofnessDesign
+Upstream-Status: Submitted [https://codereview.qt-project.org/c/qt/qtbase/+/282610]
+Change-Id: Ie4d66a5e7d83065f1a904a542c711431e1d20845
+---
+ .../input/evdevkeyboard/qevdevkeyboardhandler.cpp | 10 +++++++++-
+ .../input/evdevtouch/qevdevtouchhandler.cpp | 7 ++++++-
+ 2 files changed, 15 insertions(+), 2 deletions(-)
+
+diff --git a/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler.cpp b/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler.cpp
+index 3555763b89..e7dc57c027 100644
+--- a/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler.cpp
++++ b/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler.cpp
+@@ -58,6 +58,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
++
+ QT_BEGIN_NAMESPACE
+
+ Q_LOGGING_CATEGORY(qLcEvdevKey, "qt.qpa.input")
+@@ -150,7 +155,10 @@ void QEvdevKeyboardHandler::switchLed(int led, bool state)
+ qCDebug(qLcEvdevKey, "switchLed %d %d", led, int(state));
+
+ struct ::input_event led_ie;
+- ::gettimeofday(&led_ie.time, 0);
++ struct timeval tval;
++ ::gettimeofday(&tval, 0);
++ led_ie.input_event_sec = tval.tv_sec;
++ led_ie.input_event_usec = tval.tv_usec;
+ led_ie.type = EV_LED;
+ led_ie.code = led;
+ led_ie.value = state;
+diff --git a/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp b/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp
+index c51db59e1f..1f3726e291 100644
+--- a/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp
++++ b/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp
+@@ -58,6 +58,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
++
+ #include <math.h>
+
+ #if QT_CONFIG(mtdev)
+@@ -576,7 +581,7 @@ void QEvdevTouchScreenData::processInputEvent(input_event *data)
+
+ // update timestamps
+ m_lastTimeStamp = m_timeStamp;
+- m_timeStamp = data->time.tv_sec + data->time.tv_usec / 1000000.0;
++ m_timeStamp = data->input_event_sec + data->input_event_usec / 1000000.0;
+
+ m_lastTouchPoints = m_touchPoints;
+ m_touchPoints.clear();