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.


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.

  • I'd like to try the export SDL_JOYSTICK_DEVICE=/dev/input/js0 command, but if it doesn't work, how do I set it back? – Symba Jul 4 '12 at 16:06
  • 1
    Shell environment variables aren't stored, so if you set it, it won't get saved and it will automatically get reset when you close the shell or just open another shell. It will also only work for the currently active shell, so you have to start your game in the same shell where you entered the command. To make it permanent you have to manually add it to your ~/.bashrc. – Grumbel Jul 14 '12 at 0:50
  • Although, when I use xboxdrv to configure it, I have to use sudo. Otherwise I get this error: USBController::USBController(): libusb_open() failed: LIBUSB_ERROR_ACCESS. Any way to avoid this? – Symba Aug 17 '12 at 0:20
  • I tried adding my user to the root group. The above error went away, but now I'm getting others. libusb:error [do_close] . . . – Symba Aug 17 '12 at 16:08

In Xonotic's advanced settings, there are two variables: joy_axispitch and joy_axisyaw which must be changed. Unfortunately, Xonotic resets them to default when you close the game. What I did to fix this was in the directory /home/username/.xonotic/data I added a file which I called "config-mods.cfg". In this file are two lines:
"joy_axispitch" "4"
"joy_axisyaw" "3"

Finally I made a simple shell script with these two lines of code:
cat /home/username/.xonotic/data/config-mods.cfg >> /home/username/.xonotic/data/config.cfg

/home/username/Applications/Xonotic/xonotic-linux64-sdl -basedir  /home/username/Applications/Xonotic/`

I run this script instead of running the game directly, and it adds the two lines I need for joystick support.

  • @belacqua: I've edited my answer to explain the process. Let me know if you have any further questions. – Symba Jul 4 '12 at 16:08

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.