games – Gamepad Setup Ignored by Games

gamepadgames

I recently got a wired (USB) XBox 360 gamepad. It was nearly plug-and-play on my laptop running Ubuntu 12.04. However, some control axes were mixed up. I used jstest-gtk to reconfigure the mapping and jscal-store to (supposedly) save the new configuration. However, when I run Xonotic or Nexuiz (First Person Shooters), they still uses the original mixed-up mapping. How do I make these games recognize the new configuration? BTW, I'm more concerned about Xonotic working, I really couldn't care less about Nexuiz.
Please no rants about why I should stick with a mouse and keyboard for gaming. [:-)
Thanks in advance.

Best Answer

The problem is that jstest-gtk only changes the mapping of the joystick device, i.e. /dev/input/js0. Most modern games that use SDL however do no longer use the joystick device, but use the raw evdev instead, i.e. /dev/input/eventX and that doesn't allow any remapping.

The quickest workaround is setting an environment variable:

export SDL_JOYSTICK_DEVICE=/dev/input/js0

This will force SDL based applications to use the old joystick device and thus respect the mapping. It won't help with non-SDL applications.

Another alternative is xboxdrv, it's a userspace Xbox360 driver that allows a wide variety of configuration options at the driver level (including keyboard andd mouse emulation). This will work for all games.