summaryrefslogtreecommitdiffhomepage
path: root/ftnoir_tracker_libevdev
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2014-10-19 13:48:14 +0200
committerStanislaw Halik <sthalik@misaki.pl>2014-10-19 13:48:14 +0200
commit7c962f41834366aa0e539a392ca9aa1d4b303ebe (patch)
treeded75b219ad3443a43fe37c5972011123075f37b /ftnoir_tracker_libevdev
parenta8ffbb76f3e3bbca547fccf5135323e06cae9d2a (diff)
assume EV_MSC as absolute axis
Should fix EDTracker. Issue: #75
Diffstat (limited to 'ftnoir_tracker_libevdev')
-rw-r--r--ftnoir_tracker_libevdev/ftnoir_tracker_libevdev.cpp33
1 files 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;
}
}
}