-
-
Notifications
You must be signed in to change notification settings - Fork 21.9k
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
Fix trackpads and graphics tablets being recognized as controllers on Linux/*BSD #93352
Fix trackpads and graphics tablets being recognized as controllers on Linux/*BSD #93352
Conversation
Thanks for the PR and the ping @Calinou ! for (const String &word : name.to_lower().split(" ")) { Whereas the GDScript codes consider more characters as word separators. static func is_ascii_non_letter(c: String) -> bool:
return c.unicode_at(0) < 128 and not (c >= 'a' and c <= 'z' or c >= 'A' and c <= 'Z')
static var pattern := RegEx.create_from_string('\\b(?i:(?:touch|track|click)pad|mouse|pen)\\b') I'm not saying this method is better, I'm just pointing out the difference, since some cases would be handled differently. I don't have an opinion on whether it's safer to consider what is a "word" more strictly or more broadly, because this is only theoretical, I didn't encounter these cases in practice; and also didn't do any sort of test or research on device names (though I consider this list and this repo's files to be good sources if anyone wants some sort of reference). While on one hand these other word separators should be pretty safe assumptions, on the other, from #59412 (comment):
Still, even with fewer separators, maybe it's worth adding at least |
I've never seen a controller name contain |
Yeah, I though so too after I took a look at the lists of names I linked. Though these only list actual controllers, not other devices like mouse, etc. it's probably safe to use just space. |
298b136
to
724cdff
Compare
I've added
Note that analog keyboards (such as the Wooting two HE I have) are smart enough about this; none of them should have |
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.
Let's give it a spin. I checked cat core/input/gamecontrollerdb.txt | cut -d',' -f2
for occurrences of these words and none of them seems included, so that should be fine.
I'm slightly concerned some controllers out there might have names like "PlayStation controller with touchpad" because in theory touchpad support is part of the SDL mapping, but since there's none in the list so far I guess it's fine.
Thanks! |
On my setup, my DualSense is finally at controller ID 0 as the ASRock LED Controller is no longer registered and takes up ID 0 as a result. The DualSense's trackpad is also no longer seen as a separate (non-functional) controller.
Tested both with
udev=yes
andudev=no
, including hotplugging. Thanks to @geekley for providing the list of banned words (to which I addedled
) 🙂Testing project: https://github.com/godotengine/godot-demo-projects/tree/master/misc/joypads