summaryrefslogtreecommitdiffstats
path: root/src/platformsupport
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@digia.com>2013-09-24 16:37:59 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-09-26 18:45:16 +0200
commit091ca0ede21b62a55893307018722b384052c642 (patch)
tree4b98a70628cb62fe51db9ec3b87db8d1ed39c055 /src/platformsupport
parent4ec31ce56adf6cd36cc7e31306fb9d0d1bb1b4f9 (diff)
evdevtouch: Fix ABS limit queries
Add the missing parentheses around the conditional expression. EVIOCGABS and similar macros do not have guarding parentheses in older kernel headers. Change-Id: I5f464351e9407d90643d4e73d4afdbb2ad88b02b Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
Diffstat (limited to 'src/platformsupport')
-rw-r--r--src/platformsupport/input/evdevtouch/qevdevtouch.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/platformsupport/input/evdevtouch/qevdevtouch.cpp b/src/platformsupport/input/evdevtouch/qevdevtouch.cpp
index a7502fbcc0..176373e9f9 100644
--- a/src/platformsupport/input/evdevtouch/qevdevtouch.cpp
+++ b/src/platformsupport/input/evdevtouch/qevdevtouch.cpp
@@ -254,16 +254,25 @@ QEvdevTouchScreenHandler::QEvdevTouchScreenHandler(const QString &specification,
input_absinfo absInfo;
memset(&absInfo, 0, sizeof(input_absinfo));
- if (ioctl(m_fd, EVIOCGABS(d->m_singleTouch ? ABS_X : ABS_MT_POSITION_X), &absInfo) >= 0) {
+ bool has_x_range = false, has_y_range = false;
+
+ if (ioctl(m_fd, EVIOCGABS((d->m_singleTouch ? ABS_X : ABS_MT_POSITION_X)), &absInfo) >= 0) {
qDebug("min X: %d max X: %d", absInfo.minimum, absInfo.maximum);
d->hw_range_x_min = absInfo.minimum;
d->hw_range_x_max = absInfo.maximum;
+ has_x_range = true;
}
- if (ioctl(m_fd, EVIOCGABS(d->m_singleTouch ? ABS_Y : ABS_MT_POSITION_Y), &absInfo) >= 0) {
+
+ if (ioctl(m_fd, EVIOCGABS((d->m_singleTouch ? ABS_Y : ABS_MT_POSITION_Y)), &absInfo) >= 0) {
qDebug("min Y: %d max Y: %d", absInfo.minimum, absInfo.maximum);
d->hw_range_y_min = absInfo.minimum;
d->hw_range_y_max = absInfo.maximum;
+ has_y_range = true;
}
+
+ if (!has_x_range || !has_y_range)
+ qWarning("evdevtouch: Invalid ABS limits, behavior unspecified");
+
if (ioctl(m_fd, EVIOCGABS(ABS_PRESSURE), &absInfo) >= 0) {
qDebug("min pressure: %d max pressure: %d", absInfo.minimum, absInfo.maximum);
if (absInfo.maximum > absInfo.minimum) {