Expose Steam Controller touchpads in Gamepad API#15378
Draft
Kuratius wants to merge 1 commit intolibsdl-org:mainfrom
Draft
Expose Steam Controller touchpads in Gamepad API#15378Kuratius wants to merge 1 commit intolibsdl-org:mainfrom
Kuratius wants to merge 1 commit intolibsdl-org:mainfrom
Conversation
Author
|
Also something I noticed when comparing this to the kernel driver: |
Author
|
I made two videos with a green pixel showing the touchpad positions to show the jitter. Kernel-Driver.mp4SDL-Driver.mp4The code I'm using to read the kernel driver is fairly simple. and then in the main loop: Note that you need avoid setting SDL_INIT_GAMEPAD, otherwise sdl blocks the /dev/input device. |
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.
Description
Adds the touchpads to the joystick object associated with the steam controller, and updates them when possible.
Existing Issue(s)
Fixes #15359
Should be checked by someone with more experience with the hardware who knows whether the pads are properly centered at (0,0) to decide whether it should be ~ or - for reporting the y-coordinate. The kernel driver does this differently from SDL, so there are two different implementations out there. Overflow is not a problem here.
The cast I added a comment to should probably be changed in the future, but that might be better as its own issue to discuss it. I do not believe it is safe to keep it as is because struct padding is platform dependent.
I copied the syntax for converting from int to sdl's float format from the steam deck code, though I'm not sure this is optimal. Probably depends on whether sdl can be used on soft-float devices. It should be reasonably trivial to keep it mostly as int or fixed point except for the last step when converting to float, even provided that you want the same rounding behavior.