-
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
[SDL2] Adding input and FFB support for Logitech G29(PS3) on hidapi #11591
base: SDL2
Are you sure you want to change the base?
Conversation
Current implementation does not include SDL_Haptic integration for force feedback Supported devices: G29, G27, G25, DFGT, DFP Features: Joystick button, hat and axis input 5 level rev light control on SDL_JoystickSetLED raw hid command sending on SDL_JoystickSendEffect all command sending are based on https://github.com/berarma/new-lg4ff tested on G29 in various compat modes shifter input is not tested because I don't have one
effect rendering is ported from https://github.com/berarma/new-lg4ff
If a SDL_Joystick internal lookup manages to define a joystick type that is not game controller, it should stay as a joystick
Can you retarget this PR for SDL3? |
|
I don't know whether or not this will be accepted into SDL2 branch, but One issue is SDL_hidapihaptic_lg4ff.c does libc function calls sprintf, |
@sezero Thank you so much for the patch, can I ask for a version with As for whether this will be accepted or not, I'm unsure, and there seems to be a sentiment to use |
There you go: 0001.patch.txt Note that the abs() and llabs() issue is still there. (SDL_abs() is the worst thing added to SDL api...) |
Implementing a hardware driver inside SDL is something I would never expect. I'd say it's a bad idea but who knows, maybe I'm old fashioned. I would have thought porting the driver would be a better idea but maybe it's not possible. |
- add new files to Makefile.os2 and Makefile.w32 - fix negative return check from SDL_hid_read() - fix SDL_HIDAPI_HapticDestroyEffect() as it returns void - fix C89 build issues - change an sprintf() call to SDL_snprintf() - fix a -Wuninitialized warning - add casts Sint32 and float casts to avoid warnings - add missing newlines to new files
Hey @berarma , thanks for looking at and commenting on this! Please also see #11598 (comment) , as the author of new-lg4ff, you can decide whether code ported from your driver can be part of SDL or not
On open platforms like FreeBSD, I'd agree, someone well versed in FreeBSD development should be able to develop/port drivers to FreeBSD evdev, yielding a better performing driver, even when a userspace driver might be "good enough" On other platforms however, it's not always possible On Android, how the kernel is compiled is up to device manufacturers (and they orphan their kernels way way too often), the Paddleboat API does not have any feedback support beyond vibration motors, there's sure no HAL implemented for more complicated evdev FFB; However it is possible to get raw usb access On Apple operating systems, they introduced SDL's various hidapi controller implementations can be used in these situations |
Yeah, we'll need official permission from @berarma to relicense code based on their work under the Zlib license for SDL. |
My work is based on the Linux lg4ff module. I added code to implement more effects other than the constant effect and some tweaking features. I'm not sure I'm in a position to decide this. |
Then I believe yet another person to ping would be @mungewell, going by the header of hid-lg4ff.c |
Description
These changes enable the Logitech G29 wheel to run on hidapi with both SDL_Joystick and SDL_Haptic interfaces.
While it is already possible to use the wheel on Linux in WINE + SDL2 thanks to the in-tree evdev driver as well as new-lg4ff, these set of changes allow the G29 to be used with WINE under MacOS and FreeBSD
These wheels should also be supported, but I can only test them from G29's compat modes: G27, G25, DFGT, DFP, DFEX
Haptic and led support are ported from https://github.com/berarma/new-lg4ff so giving @berarma a ping here
Companion test program for testing SDL_Joystick input events, changing wheel compat mode and testing SDL_Haptic calls
https://github.com/Kethen/sdl_lg4ff_util/
Help wanted for this pull request
Help wanted for future pull requests
Existing Issue(s)
#6540