Merge pull request #57612 from maiself/improve-gamepad-detection

This commit is contained in:
Rémi Verschelde 2022-02-08 15:22:31 +01:00 committed by GitHub
commit 2a39a1c221
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -333,8 +333,9 @@ void JoypadLinux::open_joypad(const char *p_path) {
}
// Check if the device supports basic gamepad events
if (!(test_bit(EV_KEY, evbit) && test_bit(EV_ABS, evbit) &&
test_bit(ABS_X, absbit) && test_bit(ABS_Y, absbit))) {
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))) {
close(fd);
return;
}