Menu

#46 Deadzone in Joystick Axes in Linux

open
nobody
None
5
2020-12-30
2020-08-26
Joe Doe
No

When using a joystick in Linux, even after disabling deadzones using jstest-gtk, there is still a rather large deadzone, about 15% of the total range of motion, in crrcsim. Obviously it doesn't make for good simulation to have an enormous dead zone on the control sticks when IRL there is no dead zone at all.

In trying to track down the problem, I noticed that plib also has a joystick API and it allows you to set the deadzone parameters. So for a moment I thought all I would have to do is add code to zero the deadzone, but crrcsim doesn't use plib's joystick interface. However, this does reveal that switching to plib's joystick interface may be a possible solution.

The actual culprit is the SDL library being used for joystick input. I created a patch to remove the offending code from SDL, which I'll attach. However, as crrcsim uses the system library rather than providing its own, this doesn't really help at all. I'm just including it so that anyone who finds this bug report and wants a temporary solution can use it.

SDL2 has the same issue, though I added a comment to an already-existing bug report about it suggesting that they remove it. https://bugzilla.libsdl.org/show_bug.cgi?id=5241 So potentially in the future, switching to SLD2 might be a solution, but it isn't for now.

1 Attachments

Discussion

  • Joe Doe

    Joe Doe - 2020-08-27

    Here's a better patch, which ensures that the endpoints of each axis become -32767 and +32767.

    Even though SDL already had code to do that, it wasn't doing it correctly, even before my previous patch. Rather, it was over-shooting those endpoints and then clipping the result. So not only were there dead zones in the middle of each axis, but there were dead zones at each end as well.

     
  • Joe Doe

    Joe Doe - 2020-12-30

    I've been working with the people on the SDL bug tracker and it looks like this fix will be put into both SDL1 and SDL2. So, after their release schedule and Linux distribution release schedules and people update their installations, this will be fixed.

     

Log in to post a comment.