berarma / ffbtools

Set of tools for FFB testing and debugging on GNU/Linux
GNU General Public License v3.0
56 stars 10 forks source link

Add support for force feedback devices that take replay length into account #18

Closed Kimplul closed 4 years ago

Kimplul commented 4 years ago

Hi, I'm writing a driver for the Thrustmaster T300RS wheel, and I noticed ffbwrapper wan't working out for me. Turns out, all force feedback effect replay lengths were 0 for some reason.

This is a quick fix that I came up with, and now my wheel works smooth as butter.

berarma commented 4 years ago

ffbwrapper is a library that logs and selectively tweaks FFB API calls according to values in environment variables. This helps diagnosing issues related to FFB. The change you're suggesting changes how FFB works in a way that is not intended for this tool.

I'm puzzled by your suggested change. If your driver needs this change then it's basically broken. What are you testing and how? And why are you worried about the replay length being 0?

Kimplul commented 4 years ago

I ran ffbwrap on steam with DiRT Rally 2, and noticed that the replay length was 0. According to ffb specs, as far as I can tell, a length of 0 should essentially mean that the effect shouldn't play at all.

I've tested the Thrustmaster T300RS wheel on Winows, and found out that if replay length is zero, the effect will not play. DIRT Rally 2 works fine on Windows, and sets the replay length of every effect to something else than 0. As far as I can tell at least, I can only see what values the Windows driver outputs.

Anycase, the duration is stripped at some point, and this was my quick fix for adding in some value for the duration, thus giving me working force feedback.

Thinking about it I should maybe check if Wine/Proton is the reason the duration is zero.

Kimplul commented 4 years ago

Oh no, hold on, yeah, proton sets the length to 0 when the replay length is infinite.

I seem to have misunderstood something, but I'll fix my driver to reflect this. Sorry about this.

berarma commented 4 years ago

Oh no, hold on, yeah, proton sets the length to 0 when the replay length is infinite.

You're right now. Length zero means the effect plays until stopped by another call. The values you're getting are right but your driver has to interpret the zero length correctly. The Windows and Linux FFB APIs are similar but different.

I seem to have misunderstood something, but I'll fix my driver to reflect this. Sorry about this.

No worries. Glad to know someone is working to make other wheels work.