summaryrefslogtreecommitdiffhomepage
path: root/ftnoir_tracker_libevdev
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2014-11-01 09:42:05 +0100
committerStanislaw Halik <sthalik@misaki.pl>2014-11-01 09:42:05 +0100
commit46916ed93ba34558099590f33a5ed5ba6094353e (patch)
treea89f12c44259b164bb4b9a2bf6cd41ef3bf240eb /ftnoir_tracker_libevdev
parent3c915f8337b4ec9cc3beeec16c85fe0a364cb9f6 (diff)
evdev: avoid division by zero
Diffstat (limited to 'ftnoir_tracker_libevdev')
-rw-r--r--ftnoir_tracker_libevdev/ftnoir_tracker_libevdev.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/ftnoir_tracker_libevdev/ftnoir_tracker_libevdev.cpp b/ftnoir_tracker_libevdev/ftnoir_tracker_libevdev.cpp
index 6557eada..3e63e07d 100644
--- a/ftnoir_tracker_libevdev/ftnoir_tracker_libevdev.cpp
+++ b/ftnoir_tracker_libevdev/ftnoir_tracker_libevdev.cpp
@@ -57,6 +57,10 @@ void FTNoIR_Tracker::start_tracker(QFrame*)
// no error checking here, errors result in SIGFPE
a_min[i] = libevdev_get_abs_minimum(node, ot_libevdev_joystick_axes[i]);
a_max[i] = libevdev_get_abs_maximum(node, ot_libevdev_joystick_axes[i]);
+
+ if (a_min[i] == a_max[i])
+ a_max[i]++;
+
qDebug() << "axis limits" << i << a_min[i] << "->" << a_max[i];
}