1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
From bc17abceea50eafee49824b8d93fbc2a94facc26 Mon Sep 17 00:00:00 2001 From: Marcel Admiraal <[email protected]> Date: Tue, 22 Mar 2022 11:20:17 +0000 Subject: [PATCH] Improve detection of gamepads on Linux Requires gamepads to have a right x and y axis. --- platform/linuxbsd/joypad_linux.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/platform/linuxbsd/joypad_linux.cpp b/platform/linuxbsd/joypad_linux.cpp index 65d53b266f7d..475107293f31 100644 --- a/platform/linuxbsd/joypad_linux.cpp +++ b/platform/linuxbsd/joypad_linux.cpp @@ -333,9 +333,8 @@ void JoypadLinux::open_joypad(const char *p_path) { } // Check if the device supports basic gamepad events - bool has_abs_left = (test_bit(ABS_X, absbit) && test_bit(ABS_Y, absbit)); - bool has_abs_right = (test_bit(ABS_RX, absbit) && test_bit(ABS_RY, absbit)); - if (!(test_bit(EV_KEY, evbit) && test_bit(EV_ABS, evbit) && (has_abs_left || has_abs_right))) { + if (!(test_bit(EV_KEY, evbit) && test_bit(EV_ABS, evbit) && + test_bit(ABS_RX, absbit) && test_bit(ABS_RY, absbit))) { close(fd); return; }