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
🤖 Repo Assist investigation complete.
Root cause identified: the
do_axis()function inui/uijoystick.c(the libjsw joystick backend) has no deadzone threshold. It checksposition == 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()inui/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-deadzonesetting would let users tune this.Files involved:
ui/uijoystick.c—do_axis()at line ~242 (needs deadzone)ui/sdl/sdljoystick.c— reference implementation with deadzoneui/sdl2/sdl2_joystick_internal.c— reference implementation with deadzoneProposed 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.
Thanks, sounds very sensible. I'll drop libjsw for the next release unless someone beats me to it.
Now done. Please let me know if any configuration is broken. [5dad7a]
Related
Commit: [5dad7a]
Last edit: Fredrick Meunier 1 day ago
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.