Linux Joysticks and Gamepads

From Elite Wiki
(Redirected from XBox360 Controller)
PS3 Controller.jpeg

Setting up a Joystick or Gamepad in Oolite


Linux distributions, nowadays, have many joystick and gamepad drivers built in. However, even if they work out of the box, they offer limited configuration options. An alternative to the xpad kernel driver is the [XBoxDrv]. It is a user-space driver, giving a variety of configuration options for all controllers. For XBox controllers, this alternative works without the need of having a Linux distribution with XBox controller support.

The instructions below describe how to set up XBoxDrv for use with an XBox 360 controller on Ubuntu Lucid, nevertheless, the XBoxDrv author has extended it to also work with non-XBox controllers. If anyone gets it to work with a non-XBox controller, feel free to expand this wiki page with any information helpful to others trying to do the same.
(quote from xboxdrv changelog: support for reading from evdev, this allows the use of regular PC joysticks or the Playstation 3 controllers with xboxdrv, useful if you need configurability or joy2key-like functionality, but don't have a Xbox360 gamepad.)

1. Install [XBoxDrv] - for Ubuntu there is a binary package. Installation instructions are [here].

2. Don't worry about all the stuff about sudo modprobe uinput and changing permissions on /dev/uinput etc.

3. Download [runxboxdrv], a wrapper I wrote to make using xboxdrv very simple. Hopefully, this will be included in a future release of XBoxDrv.

4. Also in the download are an Oolite configuration for xboxdrv: oolite.ini and a key configuration for Oolite to go with it: keyconfig.plist

5. Extract them to your home folder and move keyconfig.plist to ~/.Oolite/Addons

6. Make runxboxdrv executable:

$ chmod +x ~/runxboxdrv


7. Execute the following to get the oolite executable path: (the oolite executable path may vary depending to your installation)

$ which oolite 
/usr/bin/oolite
$ 

and then execute: (for the sake of this tutorial we will assume the path /usr/bin/oolite.)

$ ~/runxboxdrv --config=~/oolite.ini /usr/bin/oolite


8. The only joystick setup needed in Oolite is to set up the axes. The left hand analog stick left-right should be roll. The right hand stick is up, down, left, right.

9. Open oolite.ini in a text editor to see the mappings of everything else. Descriptions of the option names can be found at [xboxdrv manpage]

10. The left shoulder button acts like a shift key and effectively almost doubles the number of buttons.

If you have any problems, post on the [Oolite Linux Forum].

Links