Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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.

share|improve this question
add comment

2 Answers 2

up vote 3 down vote accepted

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.

share|improve this answer
    
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
    
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
    
Thanks! That worked great! –  Symba Aug 16 '12 at 16:59
    
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
add comment

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.

share|improve this answer
    
@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
    
Awesome -- thanks. –  belacqua Jul 5 '12 at 18:20
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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