https://bugs.winehq.org/show_bug.cgi?id=51822
--- Comment #7 from Ivo Ivanov logos128@gmail.com --- (In reply to RĂ©mi Bernon from comment #6)
Thanks! I will be happy to have a look, even before I finish sending the patches, maybe there's some fixes that could be worth including early.
OK, I can file separate bug reports for each patch, since they address different commits, but this would be slower. Don't know if I'll be able to post all of the bug reports today. Or I can attach them here or send them by email. This would be much faster, as they are already rebased to the latest master, and are pretty much self explanatory. The most important one which benefits also controllers with single reports, fixes (I hope:)) the input lag and skipping/jumping that some users experience. It's severe with the Simucube 2 and probably the Fanatec ClubSport Pedals, while using such apps with raw HID access.
I couldn't test the PID code very extensively, as I don't have any device actually supporting such kind of reports. Thanks to the HID test driver we can confirm the behavior on Windows even without one, but maybe it's supposed to differ a bit depending on the devices.
For instance, I can see that your device is using the "new effect block" / "load block" / "free block" reports, which I initially intended to implement too, but the tests showed that even when these reports are declared Windows dinput only seems to be using the "set effect block" with its own effect indexes.
I'll have to look the PID documentation, but in my opinion these are more important for custom FFB forces in Driver Managed mode, which to my knowledge aren't used by any modern game these days. The sims use mostly "constant" or "periodic" effects, which are streamed to the device in the range of 60Hz iRacing to ~600Hz Automobilista 2 or even higher BeamNG. At least this is what can be measured through the hid-pidff driver in Linux (> 450Hz is really possible only with futex2 in Wine). Anyway, you could look the Linux PID driver in the usbhid module. I can confirm that Simucube 2 works very well with this driver. Literally can't sense any difference between Windows and Linux (with Wine) with SC2 while playing various sims. The Linux driver supports only Device Managed mode.
So I just implemented the same behavior, and hopefully it'll work here. If it doesn't then we'll have to implement these reports, it's a bit more verbose and I still do not completely understand how they are supposed to work though.
Same goes with the "set condition" report, with the weird "type specific block offset" and "type specific parameter offset", which seems to be simply ignored on Windows, although required. The PID documentation is also pretty cryptic about them...
The Linux driver has all of them fully implemented - Set Effect Report, Set Envelope Report, Set Condition Report, Set Periodic Report, Set Constant Force Report, etc. IMO it's a pretty good reference for PID implementation. You can find it in linux/drivers/hid/usbhid/hid-pidff.c. In the past I have written few patches for it mostly to be able to run the SC2 on Linux. For example they require the "Start Delay" (0xa7) parameter, while the SC2 doesn't advertise it in its descriptor, so it needed to be made optional. There are few more parameters in the Condition report, that are lacking from the SC2 descriptor, etc.