SDL icon indicating copy to clipboard operation
SDL copied to clipboard

Add gyro and trigger rumble support for Flydigi controllers

Open RondoRevolution opened this issue 6 months ago • 9 comments

SDL recently added support for Flydigi controllers and Steam Beta also just added support for Flydigi controllers paddle buttons and C/Z buttons on D-Input mode. Currently you can use gyro by pressing the Circle/FN button, but it maps to mouse only and doesn't reset position. According to this GitHub page, D-Input correctly reports gyro and it provides HID info and test pages for that.

Trigger rumble doesn't seem to work in D-Input mode. I don't know if it is actually possible to activate it, but would help with bringing it on par with X-Input mode features.

RondoRevolution avatar Jun 11 '25 20:06 RondoRevolution

The Vader 4 Pro controller is already supported, and I imagine the Vader 3 Pro is similar, but I don't have one for testing so I didn't enable it.

What controller are you testing with?

slouken avatar Jun 11 '25 22:06 slouken

I have a Vader 3 Pro. I just took a look into this thread on r/controllers and from the comments, gyro works on the Vader 4, but not on the Vader 3 Pro.

RondoRevolution avatar Jun 11 '25 22:06 RondoRevolution

Cool, does this patch work for you?

diff --git a/src/joystick/hidapi/SDL_hidapi_flydigi.c b/src/joystick/hidapi/SDL_hidapi_flydigi.c
index fb3fa93b7..29929f80c 100644
--- a/src/joystick/hidapi/SDL_hidapi_flydigi.c
+++ b/src/joystick/hidapi/SDL_hidapi_flydigi.c
@@ -195,6 +195,8 @@ static void UpdateDeviceIdentity(SDL_HIDAPI_Device *device)
     case 81:
         HIDAPI_SetDeviceName(device, "Flydigi Vader 3 Pro");
         ctx->has_cz = true;
+        ctx->sensors_supported = true;
+        ctx->accelScale = SDL_STANDARD_GRAVITY / 256.0f;
         break;
     case 85:
         HIDAPI_SetDeviceName(device, "Flydigi Vader 4 Pro");

slouken avatar Jun 11 '25 22:06 slouken

Thank you for the patch. I have tested it with sdl3-git from AUR, and it seems that the gyro reading works in AntiMicroX, there is now a separate section for gyro.

Image

I assume this also needs to be implemented by Valve themselves in Steam so that SteamInput can read gyro from the controller?

Also regarding the trigger rumble, what I've read on reports and reviews in the controller thread, in dongle/wired x-input mode, Flydigi just 'emulate' the main gamepad's rumble signal to the trigger's rumble motor if the trigger is pressed. Only in bluetooth x-input mode, the gamepad's triggers actually act like Microsoft's ImpulseTrigger (bypassing Flydigi's emulation altogether, assuming the games being played supported this feature). Though the latter I haven't really tested that successfully in Linux.

Is it possible if we could implement something like the former one (just 'copy' the main gamepad's rumble signal to the trigger's rumble) through d-input?

zer0exia avatar Jun 12 '25 08:06 zer0exia

Okay, I've applied that patch and the next Steam beta will have support for the gyro on the Vader 3 Pro.

Regarding trigger rumble, I don't know how to activate that in DirectInput mode. If you find the correct report to send to the controller, please let me know!

slouken avatar Jun 12 '25 16:06 slouken

Yep, gyro works fine on Steam, all the sensitivity and calibration can be set on the controller setting page.

On the rumble however, I found out that the main rumble motors didn't work when connecting the gamepad through wired d-input. They work if the gamepad is connected through dongle, so I wonder if there are differences in dongle vs wired in this case. Could you test it on your side with Vader 4 Pro (I assume that's the one you have for testing) if similar issue occurs?

zer0exia avatar Jun 13 '25 09:06 zer0exia

Hey just tried it on the latest Steam Beta, and it works! I tested it with a config for Risk of Rain 2 and it worked really well.

I did find a few issues on the Vader 3 Pro tho:

  • Calibration doesn't work, the second bar keeps flashing all the way to the red area and never completes the calibration, even if I click the calibration button. I also tried to manually calibrate it by holding UP + SELECT + START, but even after that, auto calibration on Steam still doesn't work.
  • Disconnecting and reconnecting the controller, by turning it off and back on makes gyro not be detected anymore, if I do it by connecting the cable, neither gyro nor vibrations work or are detected. If I close Steam and reopen it, it works fine with or without the cable.
  • When turning the controller on in D-Input mode with Steam already opened, the controller sends some press randomly. Usually it presses the Home button automatically so I end up entering Steam Big Picture. One time it activated KDE's Overview effect.
  • Also, from this comment on r/controllers, it looks like gyro in D-Input for the Vader series might be using a lower polling rate for gyro.

RondoRevolution avatar Jun 13 '25 16:06 RondoRevolution

@RondoRevolution I finally had time to re-test the gamepad and can confirm your problems

  • because calibration doesn't work, in games the camera (especially mapping gyro to mouse) will be inconsistent. Sometimes it will jump around erratically , especially when moving the gamepad diagonally.
  • Did you try connecting through cable only (disconnect the dongle before connecting with cable)? Because in my case the rumble didn't work that way. If the dongle is still connected, I think the gamepad still use it even if you connect the cable.
  • The third problem I can confirm, but specific to the "Desktop Layout" SteamInput if it's enabled. When I'm already in Big Picture mode, turning on the controller in d-input mode doesn't send random key presses. Workaround for now is to disable the SteamInput for Desktop Layout if you don't use it.

zer0exia avatar Jun 14 '25 04:06 zer0exia

@zer0exia I just tried wired only, dongle disconnected, and I can confirm that vibration doesn't work, even if the button is still there in the controller page.

Other than that, I have found that without the dongle, the issue I reported where turning the controller off and on again would mess with it's capabilities being reported to Steam doesn't happen, and the additional random press also doesn't happen, so it seems it's some issue related to the dongle in D-Input with SDL.

RondoRevolution avatar Jun 14 '25 14:06 RondoRevolution

A year ago I thought I'd have to write my own driver or something, so coming back to this and seeing that SDL can simply do it is great!

Unfortunately even with the latest sdl3-git, neither antimicrox-git nor Steam beta seem to see the gyro on my Vader 3 Pro (except in switch mode of course). What should I do first to debug this?

Of note, on my device usbhid seems to expose 4 HIDs under /dev: 1 Gamepad, 1 Mouse, and 2 (vendor-defined) "Device". The Gamepad device contains no gyro data but does have everything else (plus a weird bug where RT doesn't work while in circle gyromouse mode), whereas one of the Device devices actually has everything. I presume the intended method here is to have SDL parse the hidraw stream (with vendor-defined format) from the Device? Is it possible AntimicroX and Steam are only seeing the Gamepad instead?

imyxh avatar Aug 19 '25 08:08 imyxh

In fact, I am pretty sure only the Gamepad HID is being used, because of the thing where RT isn't detected in Flydigi gyromouse mode, which isn't an issue in the raw stream from the vendor-specific HID.

imyxh avatar Aug 20 '25 00:08 imyxh

lol my bad, forgot to give my user hidraw read perms. anyone else with this issue try e.g. SDL_LOGGING="verbose" antimicrox to debug, and if necessary add a udev rule to fix

imyxh avatar Aug 24 '25 06:08 imyxh

wait, rumble is still broken—should we open a new issue?

imyxh avatar Aug 27 '25 00:08 imyxh

Yes please, go ahead and report specific issues that you're seeing. Also check the code to make sure it's expected to work: https://github.com/libsdl-org/SDL/blob/main/src/joystick/hidapi/SDL_hidapi_flydigi.c

slouken avatar Aug 27 '25 01:08 slouken