From 7c962f41834366aa0e539a392ca9aa1d4b303ebe Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 19 Oct 2014 13:48:14 +0200 Subject: assume EV_MSC as absolute axis Should fix EDTracker. Issue: #75 --- .../ftnoir_tracker_libevdev.cpp | 33 +++++----------------- 1 file changed, 7 insertions(+), 26 deletions(-) diff --git a/ftnoir_tracker_libevdev/ftnoir_tracker_libevdev.cpp b/ftnoir_tracker_libevdev/ftnoir_tracker_libevdev.cpp index 13669cf9..8be6a589 100644 --- a/ftnoir_tracker_libevdev/ftnoir_tracker_libevdev.cpp +++ b/ftnoir_tracker_libevdev/ftnoir_tracker_libevdev.cpp @@ -67,41 +67,22 @@ void FTNoIR_Tracker::start_tracker(QFrame*) void FTNoIR_Tracker::run() { - bool absp = libevdev_has_event_code(node, EV_ABS, ABS_X) && - !libevdev_has_event_code(node, EV_REL, ABS_X); while (!should_quit) { struct input_event ev; int status = libevdev_next_event(node, LIBEVDEV_READ_FLAG_NORMAL, &ev); if (status != LIBEVDEV_READ_STATUS_SUCCESS) continue; - if (absp) + if (ev.type == EV_ABS || ev.type == EV_MSC) { - if (ev.type == EV_ABS) + const int code = ev.code; + for (int i = 0; i < 6; i++) { - const int code = ev.code; - for (int i = 0; i < 6; i++) + if (ot_libevdev_joystick_axes[i] == code) { - if (ot_libevdev_joystick_axes[i] == code) - { - QMutexLocker l(&mtx); - values[i] = ev.value; - break; - } - } - } - } else { - if (ev.type == EV_REL) - { - const int code = ev.code; - for (int i = 0; i < 6; i++) - { - if (ot_libevdev_joystick_axes[i] == code) - { - QMutexLocker l(&mtx); - values[i] += ev.value; - break; - } + QMutexLocker l(&mtx); + values[i] = ev.value; + break; } } } -- cgit v1.2.3