| Summary: | Axis 0 (left stick x) always returns 0. testjoystick patch | ||
|---|---|---|---|
| Product: | SDL | Reporter: | jordirovira <jordi> |
| Component: | joystick | Assignee: | Ryan C. Gordon <icculus> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P1 | CC: | icculus, jordi, manuel.montezelo |
| Version: | 2.0.0 | Keywords: | target-2.0.0 |
| Hardware: | x86_64 | ||
| OS: | Linux | ||
| Attachments: |
Fix to update the joystick test to 2.0
fix_joystick_misc_axes.diff |
||
I think i have located the problem: The joystick system is constantly receiving events of the type ABS_MT_WIDTH_MAJOR (related to multitouch?) for the PS3 pad. This events get incorrectly mapped to axis 0 events in a switch at SDL_sysjoystick.c.
The problem is in the default branch of the switch at line 1133, which is executed for all events but ABS_HATxx.
Not beeing a joystick expert, i have solved it for now, by adding some extra case filtering like this:
//jordi
// default:
case ABS_X:
case ABS_Y:
case ABS_Z:
case ABS_RX:
case ABS_RY:
case ABS_RZ:
case ABS_THROTTLE:
case ABS_RUDDER:
case ABS_WHEEL:
case ABS_GAS:
case ABS_BRAKE:
events[i].value =
EV_AxisCorrect(joystick, code, events[i].value);
#ifndef NO_LOGICAL_JOYSTICKS
if (!LogicalJoystickAxis(joystick,
joystick->hwdata->abs_map[code],
events[i].value))
#endif
SDL_PrivateJoystickAxis(joystick,
joystick->
hwdata->abs_map[code],
events[i].value);
break;
default:
break;
I am not really sure if the gas, rudder, wheel, etc should be axis though.
We are going to apply this patch in Debian, created by one of the maintainers of the package, to try to fix it: http://anonscm.debian.org/gitweb/?p=pkg-sdl/packages/libsdl1.2.git;a=blob;f=debian/patches/fix_joystick_misc_axes.diff;h=75e3755c93c83965a76c9f0541205855b3b8a27b;hb=856a810b8cd61fb371163a480a96c7f6c3e461a4 Cheers. Created attachment 875 [details]
fix_joystick_misc_axes.diff
I think we fixed this awhile ago, separate from this patch. I'll confirm. --ryan. (Sorry if you get a lot of copies of this email, we're touching dozens of bug reports right now.) Tagging a bunch of bugs as target-2.0.0, Priority 1. This means we're in the final stretch for an official SDL 2.0.0 release! These are the bugs we really want to fix before shipping if humanly possible. That being said, we don't promise to fix them because of this tag, we just want to make sure we don't forget to deal with them before we bless a final 2.0.0 release, and generally be organized about what we're aiming to ship. Hopefully you'll hear more about this bug soon. If you have more information (including "this got fixed at some point, nevermind"), we would love to have you come add more information to the bug report when you have a moment. Thanks! --ryan.
I think this is the change we made to deal with axis zero being overwritten incorrectly...
http://hg.libsdl.org/SDL/rev/57001e845b72
...I'm trying to understand how the Debian patch fixes this...is this mapping some extra, bogus axes to the controller? (or maybe the PS3 controller's tilt sensors are showing up as an axis now?).
--ryan.
(In reply to comment #6) > ...I'm trying to understand how the Debian patch fixes this...is this > mapping some extra, bogus axes to the controller? (or maybe the PS3 > controller's tilt sensors are showing up as an axis now?). I'm closing this as FIXED for now, because the existing code fixed this specific bug report at some point. We'll probably be revamping the joystick code a little bit going forward, since we want to deal with non-standard things better (Wiimote things, Guitar Hero things, etc), and will look at the PS3 controller tilt sensors then. --ryan. |
Created attachment 840 [details] Fix to update the joystick test to 2.0 Using linux and PS3 controller. In SDL 1.2 it used to work fine. The axis 0 corresponding to X in the left stick always returns 0. The rest of the axis seem to work fine. To reproduce, i have updated the testjoystick.c program in SDL/test to work with 2.0 (See patch). You can see that the right stick works, and the left stick works for the vertical axis only.