-
Notifications
You must be signed in to change notification settings - Fork 1.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
Try SDL_UDEV_deviceclass to detect joysticks even if in a container #8645
Conversation
For further details, see @smcv's commit 13e7d1a. It explains the container udev/netlink/api issues
As I mentioned, the udev device lookup code doesn't use netlink. Instead it pokes around it /sys and then goes and checks the device database in /run/udev/data/<device>. While a kernel change could break the /sys part, or a udev change could break the /run/udev/data/<device>, the code still falls back to the heuristics if the lookup fails (or succeeds and doesn't return anything useful), so worst case it should be no worse than what we currently have. On the question of the likelyhood of /run/udev/data/<device> breaking, it is worth noting that these are just plain text type:key=value files, so there isn't really too much to break. For the CH PRO PEDALS, for example,
|
@smcv, is this a good change for SDL? |
Thanks for taking a look! I compiled up new SDL2 packages for the steam runtimes and asked people to check them out on some of the "does not recognize my device correctly" bug reports. I am currently using them as well. Hoping that will provide some testing and feedback. |
Right now the most definitive answer I can give is "maybe". I'll try to dig into the finer details at some point. |
In case it's not obvious, this falls into the category of unsupported/unsupportable changes to the Steam Runtime; while it's great as a way to prototype and evaluate changes, please make it obvious to users of these builds that Valve cannot provide support for a runtime that has been modified in this way. |
The The issue here is
They are plain text key/value files today. The concern is that tomorrow, the udev/systemd maintainers could replace them with JSON or XML or some binary format, and if we complained that this caused SDL to regress, the response would be "you shouldn't have been parsing those, they're private". More realistically, and more concerningly (because it would be harder for SDL to detect), they could keep the format intact but make incompatible changes to the semantics. The question, then, is how likely this is to really happen in practice. In the Steam Runtime containers (Steam Linux Runtime), the position we've taken in the past is to say "it seems unlikely", and share However, in Flatpak, the position that has been taken is to say " I think on balance, this PR is probably a positive change: while This means that we should be adding known mis-detected joysticks like yours to a hard-coded (or possibly environment-variable-overridable) table of known joysticks in SDL, as well as trying to use libudev to bypass the mis-detection. |
Since you have Steam installed, the easiest way to collect fairly complete information about this device is #7801 (comment). Please do that if you can - that way, we can put information about your device in the automated tests, and it will be available to any SDL contributor, even those of us who don't have an example of it physically available. |
Thank you for the very detailed review. I will make those corrections and make sure to make it clean to people that neither myself nor the patched packages are in any way associated with Valve, and that they should net not report an issues to Valve while running under them. I'll get you that dump on the CH Pro Pedals too. 👍 |
I have update the README.txt file to be very clear that the test packages are not affiliated or support by Valve, and no problems should be reported while running them. |
Here is the json blob returned for the CH Pro Pedals. |
e0f21fe
to
809dc9a
Compare
Note that I haven't yet had a chance to test it. I will let you know when I have. |
I tested it, and it still works as I previously reported (i.e., |
The udev container issue is mostly to do with device notifications and netlink. The device classification stuff just pokes file in /sys and /run/udev. Doesn't hurt to try it first for classifying joysticks and then fall to the guess heuristics if it fails.
809dc9a
to
cb8122b
Compare
Thanks! |
Can you make a PR for main? |
Description
The udev container issue is mostly to do with device notifications and netlink. The device classification stuff just pokes file in /sys and /run/udev. Doesn't hurt to try it first for classifying joysticks and then fall to the guess heuristics if it fails.
Here is an example of the the sdl-jtest program compiled against the current SDL2 HEAD
and here it is inside the steam pressure vessel container
The issue being the the heuristics fail because the CH PRO PEDALS are three axis with no buttons, which is the same as an accelerometer. It works outside the container because the udev hwdb has an entry for this device.
Now with it build against SDL with these changes (and the
-DDEBUG_INPUT_EVENTS
andDDEBUG_JOYSTICK
turned on for some more clarity)and inside the container
Existing Issue(s)
This should close #7500.
Other
This cherry picks reasonably well onto the master SDL3 branch as well. If you find it acceptable, I will do another pull request for SDL3 too.