summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2016-06-20 11:09:52 +0200
committerGitHub <noreply@github.com>2016-06-20 11:09:52 +0200
commita1a57bc369de01cbb2295b403d84ec5fac210020 (patch)
tree0365d28314ca230c283f5d630f8e5584c29dcfa2
parentd4359b2d09625695a972a40ce76faf90b38f4e59 (diff)
parent5d950728795cdc9cc6ea3c40e29b38d3dc43b709 (diff)
Merge pull request #5309 from nounoursheureux/master
Fix the joystick vibration on Linux
-rw-r--r--main/input_default.cpp2
-rw-r--r--platform/x11/joystick_linux.cpp8
2 files changed, 4 insertions, 6 deletions
diff --git a/main/input_default.cpp b/main/input_default.cpp
index a70b66838a..4fcb450bce 100644
--- a/main/input_default.cpp
+++ b/main/input_default.cpp
@@ -365,7 +365,7 @@ void InputDefault::stop_joy_vibration(int p_device) {
vibration.weak_magnitude = 0;
vibration.strong_magnitude = 0;
vibration.duration = 0;
- vibration.timestamp = OS::get_singleton()->get_unix_time();
+ vibration.timestamp = OS::get_singleton()->get_ticks_usec();
joy_vibration[p_device] = vibration;
}
diff --git a/platform/x11/joystick_linux.cpp b/platform/x11/joystick_linux.cpp
index 5ce0219df7..82f79c2640 100644
--- a/platform/x11/joystick_linux.cpp
+++ b/platform/x11/joystick_linux.cpp
@@ -439,11 +439,9 @@ void joystick_linux::joystick_vibration_stop(int p_id, uint64_t p_timestamp)
return;
}
- struct input_event stop;
- stop.type = EV_FF;
- stop.code = joy.ff_effect_id;
- stop.value = 0;
- write(joy.fd, (const void*)&stop, sizeof(stop));
+ if (ioctl(joy.fd, EVIOCRMFF, joy.ff_effect_id) < 0) {
+ return;
+ }
joy.ff_effect_id = -1;
joy.ff_effect_timestamp = p_timestamp;