Menu

#21 Cannot calibrate joystick

NextRelease
closed
nobody
5
1 day ago
2004-06-07
Anonymous
No

I've calibrated joystick using jscalibrator utility
from libjsw (it's USB Logitech WingmanAttack 2, seen
properly in /dev/js0), unfortunately when I start any
game that has joystick option, player goes left and no
other moves are possible (on Jet Set Willy player can
jump when I press the button)

Paul

Discussion

  • Fredrick Meunier

    🤖 Repo Assist investigation complete.

    Root cause identified: the do_axis() function in ui/uijoystick.c (the libjsw joystick backend) has no deadzone threshold. It checks position == 0.0 — any non-zero axis value, even tiny hardware drift, is treated as a directional input. This causes constant "left" movement and blocks all other directional inputs.

    The SDL1 (ui/sdl/sdljoystick.c) and SDL2 (ui/sdl2/sdl2_joystick_internal.c) backends correctly implement a ±16384 deadzone, which explains why building with SDL instead of libjsw works around the issue.

    Proposed fix: add a configurable deadzone threshold to do_axis() in ui/uijoystick.c, similar to the SDL backends. A default of ~0.25 (on libjsw's normalised [-1.0, 1.0] range) would be analogous to the SDL ±16384 threshold. A --joystick-deadzone setting would let users tune this.

    Files involved:

    • ui/uijoystick.cdo_axis() at line ~242 (needs deadzone)
    • ui/sdl/sdljoystick.c — reference implementation with deadzone
    • ui/sdl2/sdl2_joystick_internal.c — reference implementation with deadzone
     
  • Sergio Baldoví

    Sergio Baldoví - 3 days ago

    Proposed fix sounds good, but libjsw is unmaintained and no longer distributed in linux distributions (except Gentoo IIRC).

    I suggest dropping libjsw support and use SDL to handle joysticks.

     
    • Fredrick Meunier

      Thanks, sounds very sensible. I'll drop libjsw for the next release unless someone beats me to it.

       
  • Fredrick Meunier

    • Group: --> NextRelease
     
  • Fredrick Meunier

    • status: open --> closed
     
  • Fredrick Meunier

    Now done. Please let me know if any configuration is broken. [5dad7a]

     

    Related

    Commit: [5dad7a]


    Last edit: Fredrick Meunier 1 day ago
  • Paul Osmialowski

    Thanks for finalizing this. I'm surprised that this has been handled after so many decades. Meanwhile, I got myself an USB adapter for Atari-compatible DB9 joysticks, it's recognized by SDL as a hat device, and the hat devices don't need any calibration. Fuse works with it just fine.

     

Log in to post a comment.

MongoDB Logo MongoDB