Skip to content
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

[SDL3] Adding input and FFB support for Logitech G29(PS3) on hidapi #11598

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

Kethen
Copy link

@Kethen Kethen commented Dec 6, 2024

#11591 for SDL3

companion test program for SDL3 https://github.com/Kethen/sdl_lg4ff_util/tree/SDL3_lg4ff

WINE has not moved onto SDL3 so it cannot be tried on WINE at the moment

@slouken
Copy link
Collaborator

slouken commented Dec 6, 2024

This is an impressive PR. How does this interact with other drivers, like new-lg4ff? Is there any reason we'd want this active when those are available?

@Kethen
Copy link
Author

Kethen commented Dec 6, 2024

This is an impressive PR.

Thanks but a large portion of it was ported from https://github.com/berarma/new-lg4ff

How does this interact with other drivers, like new-lg4ff?

On Linux, it depends on how it was opened:

  • If it was opened on /dev/hidraw*, kernel drivers would stay active, and if the wheel is accessed through both drivers, it will be receiving confusing commands from two sources, tho it's generally fine if active effects are on only one side at a time
  • If it was opened on /dev/bus/usb/* using libusb, exclusive access should be obtained and kernel drivers will unprobe

Which path would happen depends on which hidapi backend SDL was built to use and device node permissions

On MacOS, if I understand correctly some games also use IOHIDManager to provide wheel support on their own. SDL3 currently does not grab exclusive access

hid_darwin_set_open_exclusive(0);

No idea if existing games grab exclusive access

On Windows, I have no idea how it would react with the Logitech driver, no idea if any exclusive access would happen when hidapi opens the device from CM_Get_Device_Interface_List fetched interface names

Is there any reason we'd want this active when those are available?

On Linux, evdev does not provide an analog to GetEffectStatus, user is expected to track that as effects are uploaded, I think https://bugzilla.kernel.org/show_bug.cgi?id=219189; otherwise I'd expect the kernel drivers to have better latency profiles

As for availability, unless udev rules were supplied (usb) (hidraw), the evdev backend would be used on SDL

On Windows, once again I have no idea

@Kethen
Copy link
Author

Kethen commented Dec 6, 2024

Added build fixes for platforms with hidapi disabled, without M_PI, and Android

Still need help with MSVC project files

Kethen and others added 8 commits December 7, 2024 08:44
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
If a SDL_Joystick internal lookup manages to define a joystick
type that is not gamepad, it should stay as a joystick
@Kethen Kethen force-pushed the SDL3_lg4ff branch 3 times, most recently from 1c281d9 to f3c2dcc Compare December 7, 2024 08:42
@Kethen
Copy link
Author

Kethen commented Dec 7, 2024

rebased and fixed windows building

@slime73
Copy link
Contributor

slime73 commented Dec 7, 2024

a large portion of it was ported from https://github.com/berarma/new-lg4ff

If code was taken from there, is there permission to relicense it from GPL to zlib?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants