https://bugs.winehq.org/show_bug.cgi?id=51922
--- Comment #19 from Ivo Ivanov logos128@gmail.com --- Created attachment 71247 --> https://bugs.winehq.org/attachment.cgi?id=71247 0001-dinput-Add-condition-parameters-for-all-declared-axi.patch
(In reply to RĂ©mi Bernon from comment #18)
Thanks, as far as I could see in the hid-pidff Linux driver, they always send the two condition reports, regardless of their value.
Yes, it seems the hid-pidff driver is causing this. They don't check the number of the declared axes in the set effect report. Just always send two condition reports, which the device interprets as two consequential reports, without ever checking the block offset field. And since the second report is always with null values, it just turns off the effect.
From the DInput MSDN documentation, it is mentioned that when only one condition is set, it's supposed to be used for all axes (with supposedly the direction applied to modulate the effect, but I didn't find any clue that it's true).
According to the HID PID specification if Direction Enable is used in the Set Effect report, the Axes Enable flags are ignored and only one Condition report is defined with the Direction (from Set Effect) applied as a polar direction. I think there is an example in MSDN, about the polar direction used in this case, and maybe also some additional info in the specification.
Maybe what we need to do for the SDL and evdev backends is to copy the first condition onto the second one when there's only one, so that the underlying drivers never send empty conditions.
You are absolutely right! I have found some old usb captures from proton's joystick_sdl, and they seem to fill exactly the same values for the second one as the first. This results in two identical condition reports with consequential parameter offset fields from the driver. I have tested this technique, and indeed the condition effects function properly.
Attached a patch for this, although didn't test it too much. Captured the usb traffic and noted that the pairs sometimes have different coefficient fields. Maybe since I implemented it in dinput/joystick_hid and a better place to implement it would be in the backends (probably more difficult, though).