https://bugs.winehq.org/show_bug.cgi?id=51922
--- Comment #14 from Ivo Ivanov logos128@gmail.com --- Created attachment 71221 --> https://bugs.winehq.org/attachment.cgi?id=71221 winebus-fixes.patch
I remember that comment in the SDL code :) I got confused by it when I was writing a Linux FFB driver for a Fanatec device and found it on the net. Maybe they mean the 90 deg difference between polar and spherical. Anyway, it is visible from the SDL code that they just rescale the source polar coords to the Linux FF range.
So your previous code was correct. I have reverted the lnxev part of the patch, and immediately the "set effect" output reports started showing the correct direction 0x2d similar to the other backends and Windows.
The FFB was still absent, though, so I looked at some captured usb traffic, and found two interesting things. The FF gain was set to 0 on the lnxev backend, and the duration field of the "set effect" report was 0x7fff on the both SDL and lnxev backends.
For the first issue appeared that FF_GAIN needed to be rescaled for the Linux FF range.
For the second issue, we pass correctly 0xffff for infinite duration, but Linux just clamps it to the max allowed value of 0x7fff, as it doesn't consider that value an infinite duration. The Linux FF uses 0 for that, while SDL uses SDL_HAPTIC_INFINITY.
So, attached patches that correct the issues. Tested thoroughly both the SDL and lnxev backends with various games - rFactor 2, Assetto Corsa Competizione, Automobilista 2, BeamNG, etc. The FFB worked properly and on par with hidraw and Windows. The only problem I could still spot is that the damper condition effect is very weak in comparison to hidraw and Windows. Assetto Corsa Competizione uses such effect when the car is stand still.
The patches are based on 3f6102080e632b9f4d8a97c0f0b1231fbd8e759b