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

Expose HID PID descriptor via HIDRAW #86

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft

Expose HID PID descriptor via HIDRAW #86

wants to merge 5 commits into from

Conversation

gotzl
Copy link
Owner

@gotzl gotzl commented Jul 7, 2024

This is the driver part of fixing #67, see my comment there for details. There is also the wine part, which adds the multi TLC support (see this MR).

Multi TLC support in wine will require to access the device via HIDRAW. To get FFB working with HIDRAW, the Linux driver extends the HID descriptor that's exposed on the HIDRAW device with a HID PID descriptor. Wine understands this descriptor and sends FFB commands via HID PID packets. The linux driver has to filter out these HID PID packets and feed them to the Linux FFB code. Other HID packets are passed directly to the device.

Using HIDRAW for Fanatec devices in wine also has the benefit that the FanatecSDK can talk to the device. This means that for games that include the FanatecSDK, LEDs and displays would just work. I've tested this already with Rennsport and F1 23. F1 23 also used the 'Flag LEDs', so this PR could also be a partial fix for #38. F1 23 however lacks forces from tyres (self-alignment/traction).

Edit: Tested with ACC, which uses FanatecSDK to drive RPM LEDs, Flag LEDs (ABS, TC), and shows Speed/Gear in the display. Preliminary testing showed also an improvement on #70.
R3E drives RPM Leds, Flag LELDs (eg yellow flags) and shows Speed in the display.

@gotzl gotzl marked this pull request as draft July 7, 2024 12:09
@gotzl gotzl force-pushed the hidraw_pid branch 3 times, most recently from 7462b0e to e6d929a Compare July 14, 2024 09:15
@dinuxlt

This comment was marked as outdated.

@gotzl

This comment was marked as outdated.

@melroy89

This comment was marked as outdated.

@gotzl
Copy link
Owner Author

gotzl commented Sep 21, 2024

Thanks to @rbernon, the required changes for multi TLC have landed in wine! Now these changes only have to land in proton's wine fork as well...
For those who are willing to play around with this branch of the driver I've compiled a proton version (debug build) with the required changes. You could also compile proton yourself using this patch against proton-wine-9.0-3.
In any case, I would be very happy to hear any feedback on this. Please note:

  • This proton version only white-lists wheel-bases with PID 0x0005 and 0x0020 to use hidraw, see dlls/winebus.sys/unixlib.c:107
  • Although I don't expect anything bad to happen, please backup your proton-pfx before starting the game with this proton/driver combination.
  • Check that correct driver (from this branch) is active with modinfo hid-fanatec | grep hidraw
  • If using an existing proton-pfx and the game still crashes on startup with this proton/driver combination, you might have to execute PROTON_VERSION="proton-9.0-3-hid-fanatecff-hidraw" protontricks -c "wine reg delete 'HKLM\System\CurrentControlSet\Enum\HID' /f" <appid> once to wipe known devices from the registry.
  • F1 22/23/24: still has issues and will not work with this proton version (with Fanatec wheel-base plugged-in).
  • ACC: you may have to backup/delete Config/controls.json if it mixes up wheel-base/pedals.
  • AMS2: doesn't show any LED/display activity for me (but it will no longer crash on stratup (but may freeze on startup, I have to 'pump' one of the pedals to 'unfreeze' it))
  • rFactor2: have to put a negative FFB strength

Important note:
Be extra careful with your hands in case FFB goes rogue ....

Also, you can reach me on discord for questions etc.

@tostr7191

This comment was marked as outdated.

@gotzl

This comment was marked as outdated.

@tostr7191

This comment was marked as outdated.

@tostr7191

This comment was marked as outdated.

@gotzl
Copy link
Owner Author

gotzl commented Oct 4, 2024

As per the last commit, no change to the driver-code should be necessary anymore and the wheel should behave normal in ACC/AMS2/R3E. (It actually had nothing to do with that code, but with effects 'leaking' from one game to the other.)
Updated the above instructions on how to use this branch accordingly.

ACC works fine, I have "Manufacturer Extras" enabled, is that what you mean by "Fanatec LED Option"?

@tostr7191 See this screenshot:

image

@SynthetikzZ
Copy link

SynthetikzZ commented Oct 9, 2024

tested this branch in acc , works great sofar.

On Windows the LED's and display can be configured in fanalab. i dont know if the settings are written into memory on the wheelbase itself or if fanalab has to be open all the time, have to test. fanalab can configure led colors, ranges and display formatting even for games that uses the sdk. if i can help you with pcaps or something just ask.

quicknote: needing negative ffb values in rfactor2 isnt exclusive to this branch, happens on main branch too.

@gotzl
Copy link
Owner Author

gotzl commented Oct 19, 2024

On Windows the LED's and display can be configured in fanalab. i dont know if the settings are written into memory on the wheelbase itself or if fanalab has to be open all the time, have to test. fanalab can configure led colors, ranges and display formatting even for games that uses the sdk. if i can help you with pcaps or something just ask.

There are again two possibilities here. Either reverse engineer what fanalab is doing using pcaps, or get fanalab running ontop of wine/proton. I think the latter should be possible using this branch.
Still, somewhere in the future it would be nice to have the protocol reverse engineered so that we can write an open-source version of fanalab ;)

@mferraci
Copy link

mferraci commented Oct 21, 2024

Hi,

I don't know if I tried something stupid because it can't work for some obvious reason, but I tried this branch with my ClubSport v2.5 + F1 wheel Esport v1. With mixed results.
tldr: with this branch + patched proton, wheel is detected, leds are working, but no input are registred and no FFB.

Before testing:

  • Compiled and installed hid-fanatec from this branch
  • Checked that driver is active with modinfo hid-fanatec | grep hidraw
  • Compiled Proton with the patch (from Proton-GE-9.16) & Whitelisted PID 0x0004 in dlls/winebus.sys/unixlib.c
  • Delete prefix before each test

On master branch driver: everything is working fine on Oversteer, AC, ACC and AMS2. Leds are firing with fanatecff-tools)

On hidraw branch driver:

Oversteer: OK, FF test working and button detected

AC:

  • with proton-ge: If I activate Fanatec SDK, games crash as soon as I load a race, otherwise wheel recognize and working fine, FF working fine, but no led.
  • With proton-hidraw patch: Wheel is detected twice but no input is detected & FF not working, both in settings and in race. When I activate Fanatec SDK, leds are working (but still no input nor FF)

ACC:

  • Same as AC, but wheel is displayed only once in settings

AMS2:

  • with proton-ge: wheel recognize and working fine, FF working fine, but no led.
  • With proton-hidraw patch: nothing works, no led, no wheel input, no FF

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.

Issue with pfx'es created by proton7/8/9 I've got 6 more LEDs on my Formula 2.5X
6 participants