-
-
Notifications
You must be signed in to change notification settings - Fork 21.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[3.x] Improve validation of gamepads on Linux #67414
base: 3.x
Are you sure you want to change the base?
Conversation
Check if device has key: should filter out motion-control input from controller like recent playstation or nintendo. Check if device has direction input: joystick or dpad. Check if device has no touch-like input: should filter out touchscreen and fingerprint reader.
Ok, I went back and made a entirely new commit, without cherry-picking anything, with my solution. |
WDYT about this solution @madmiraal? I'm a bit unsure about trying yet another approach which would differ from the one now used in 4.0 - but the code has diverged so it's possible that the 4.0 code isn't applicable here as is. The added booleans here are also nice for readability of what this is checking exactly. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This solution is problematic. It requires a device to have keys to be treated as a gamepad, which is the opposite of the current behaviour, which requires a device not to have keys to be treated as a gamepad.
More importantly, this PR should be made against master not 3.x. As identified in the OP, the code on master has diverged from 3.x, because #40591 and #57612 haven't been backported to 3.x. This is not a reason to start making changes to 3.x without first making them on master.
Accurately detecting gamepads is hard. #40591 made our detection of gamepads the same as SDL's detection of gamepads. However, SDL's detection of gamepads (and devices in general) has since moved on: Clearly, getting this right is going to take a more effort than just #40591, #57612, #59412 and #67414. |
!(test_bit(EV_ABS, evbit) && | ||
test_bit(ABS_X, absbit) && test_bit(ABS_Y, absbit) && | ||
test_bit(ABS_RX, absbit) && test_bit(ABS_RY, absbit))) { | ||
// Check if the device supports basic gamepad events and not non-joystick events |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Check if the device supports basic gamepad events and not non-joystick events | |
// Check if the device supports basic gamepad events and not non-joystick events. |
Per the comment style.
EDIT: Changed idea and provide new fix after discussion
Bugsquad edit:
old message:
cherry pick those commits from master :
8fe2ecf
b966ca6