-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Add Flydigi VADER 4 Pro support #12874
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
base: main
Are you sure you want to change the base?
Conversation
Mappings fixed |
@@ -67,6 +68,7 @@ | |||
#define USB_PRODUCT_GOOGLE_STADIA_CONTROLLER 0x9400 | |||
#define USB_PRODUCT_EVORETRO_GAMECUBE_ADAPTER1 0x1843 | |||
#define USB_PRODUCT_EVORETRO_GAMECUBE_ADAPTER2 0x1846 | |||
#define USB_PRODUCT_FLYDIGI_VADER4_PRO 0x2412 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI, this product ID is used by every FlyDigi controller, but they all have different report structures. We need a way to positively identify that this is the Vader 4 Pro controller.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting. I tried this out with the Vader 2, and it has a 32-byte report and rumble works, but gyro data doesn't come through.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, the gyro data is in bytes 4-6 of the packet, for the Vader 2. It looks like it doesn't have an accelerometer sensor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This driver also works for the Apex 3. If the report format is stable across all FlyDigi controllers, then we can accept this patch, thanks!
What work do you have left before merging? Don't worry about the macOS build failure, I can fix that once this is merged.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are two paths for parsing the payload in the Space Station software: for "K1" models and the rest, from what I see it should be just for Apex 3.
There are some operations with "masks" I did not closely look into yet that are different for the two paths, will check later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW, I see two ways of detecting the gamepad model in Space Station: from response to a "get config" report and simply from the device name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm guessing the get config report will contain the gyro and accelerometer calibration data. That might give us a single path to get the accelerometer scale that works with all controllers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These configs look more like profiles with remappings, stick curves etc, the only motion-related stuff there is whether to emulate mouse or right stick and corresponding sensitivity.
Dualsense emulation seems to be based on vigem, maybe it has some hardcoded calibration data?
SDL_GAMEPAD_NUM_FLYDIGI_BUTTONS, | ||
}; | ||
|
||
#define FLYDIGI_ACCEL_SCALE 256.f |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#define FLYDIGI_ACCEL_SCALE 256.f | |
#define FLYDIGI_ACCEL_SCALE 5120.f |
This seems like the correct scale for the Apex 3 controller. The accelerometer axes seem correct. I can double check the gyro once this is merged.
Are the internal sensors updated at 125 Hz?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No idea, I just tuned the value to get 9.8 while my vader4 is laying flat. With 5120, I get 0.5 on the same axis.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tried to do the same with gyro comparing with the values from dualsense, but my confidence is much lower there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like the Vader 4 and Apex 3 use different sensor values. Any chance we can differentiate them?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Device name should be enough
Though looks like what is different are buttons bitmasks, are buttons detected correctly on apex 3?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, buttons are working correctly, though there's no C/Z button. We probably should dynamically set the number of available buttons based on the button bitmask.
Figured out that the only difference is that in the non-"K1" models circle button status is reported in a different bit. |
The M1-M4 buttons worked correctly here on the Apex 3 with your original PR. |
Hm, maybe it's an ID for an older firmware? |
I tested the Apex 3, Apex 4, Vader 2, and Vader 4 Pro, and in all cases the report is 32 bytes and the first three bytes are 0x04, 0xfe, 0x66. On my Vader 4 Pro, the accelerometer Z axis isn't quite right. When resting the Z axis seems to auto-calibrate to 0, but when pointed up the axis is -11, and pointing down it's 8.5. |
We shouldn't report the circle button. That's used on all the controllers I have here to toggle gyro mouse mode. |
Here is some more information on the Flydigi protocol: |
Yeah, that seems to be the case on mine too. Is that critical? And if so, what could be done about it, add a different multiplier depending on whether it's positive or negative? And in Switch mode, i see Z values from -4.5 to 4, X is from -11 to 11 |
Maybe just change it in a mapping to something like misc4 so it wouldn't be confused with xbox share button? I personally might just find a method to disable the mouse input device in OS and use it as a screenshot button. |
Normally controllers have calibration data that is either used to adjust the values reported by the controller, or used by the driver to adjust the values reported to the application. The Nintendo Switch reports this calibration data and we use it in that driver, so if the controller isn't working in Switch mode then I'm not sure what we can do about it. We can't just hardcode values, since they may change from controller production run to production run, or even between units in the same run. I think we just pass on what the controller is reporting and be done with it, unless we get more information from FlyDigi about how we can handle this. Also, did you verify that the report rate is 125 Hz? I think that code was pulled from the 8BitDo driver and may not be correct for these controllers. |
Maybe. Let's leave it out for now (or commented out) and we can revisit that once a way to effectively use it becomes available. The other side effect is that it enables and disables gyro data in the output report on the Apex controllers, so I don't think we want to encourage users to press it. |
Add a new controller support
Description
The controller outputs custom HID reports for PS5 controller emulation through vendor software, which also contain motion data unlike the normal HID endpoint.
All inputs checked using
testcontroller
, still not sure how to properly test gyro data and generate mappings for other platforms