Fix the usage of udev and dbus with SDL joystick input driver#108373
Merged
Repiteo merged 1 commit intogodotengine:masterfrom Aug 3, 2025
Merged
Fix the usage of udev and dbus with SDL joystick input driver#108373Repiteo merged 1 commit intogodotengine:masterfrom
Repiteo merged 1 commit intogodotengine:masterfrom
Conversation
6312500 to
64b1a96
Compare
d73623e to
eae10d9
Compare
2bc8a19 to
28975ab
Compare
Previously, libudev was ignored if SOWRAP_ENABLED was defined (it is defined by default) because otherwise it would crash CI builds due to a missing header, and dbus was always linked dynamically. This commit should fix this issue and make libudev usable again
28975ab to
0e19ad5
Compare
Calinou
approved these changes
Jul 31, 2025
20 tasks
bruvzg
approved these changes
Aug 1, 2025
Contributor
Author
|
Thank you for your reviews, Calinou and bruvzg! |
Contributor
|
Thanks! |
Contributor
Author
|
Thank you so much! :D |
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In the SDL joystick input PR I decided to not compile it with libudev because it was a bit too late to make new changes.
Yesterday I found out that SDL actually uses dynamic loading of libudev and uses the <libudev.h> only for structs, typedefs, etc. in the thirdparty/sdl/core/linux/SDL_udev.c file, so I decided to fix the compilation of libudev to use the header file that was already bundled with Godot's source code (thirdparty/linuxbsd_headers/udev/libudev.h) and in another file (thirdparty/sdl/hidapi/linux/hid.c) where SDL actually does use functions from said header, I redirect the calls to the struct where they're loaded dynamically (the one in SDL_udev.c). And I removed the usage of SOWRAP_ENABLED in the detect.py file where UDEV_ENABLED is defined, because SDL loads the library dynamically anyway and we probably can't/shouldn't change the way it works.
I tested the PR with WSL and it didn't seem to crash or break the controller support (my Dualshock 4 and a cheap Sega Mega Drive-like controller work fine just like before), so I assume it works 😅 (EDIT: need testing again)
EDIT: also made dbus load "statically" too (i.e. pull its functions from Godot binaries just like udev without SDL_UDEV_DYNAMIC)
TODO: