Difference between revisions of "Linux Joysticks and Gamepads"

From Elite Wiki
(Updating BB links)
 
(18 intermediate revisions by 5 users not shown)
Line 1: Line 1:
== Setting up a Joystick or Gamepad in Oolite under Linux ==
+
[[File:PS3 Controller.jpeg|right|320px]]
[ EDIT: The author of xboxdrv has updated it to also work with non-XBox controllers and to directly accept an INI configuration file. It should be possible to alter oolite.cfg to this INI format. If anyone does this before I get round to it, please post on the [[http://www.aegidian.org/bb/viewforum.php?f=3 Forums]]. ]
+
== Setting up a Joystick or Gamepad in Oolite ==
 +
<br>
 +
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 [[http://pingus.seul.org/~grumbel/xboxdrv/ 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.<br><br>
  
Linux distributions such as Ubuntu Lucid have the xpad kernel driver built in. While this works out of the box, this offers limited configurability. Here I will outline a better alternative which works irrespective of whether your Linux distribution includes xpad support.<br><br>
+
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.<br>
 +
''(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.)''<br><br>
  
 
1. Install [[http://pingus.seul.org/~grumbel/xboxdrv/ XBoxDrv]] - for Ubuntu there is a binary package. Installation instructions are [[http://github.com/Grumbel/xboxdrv/blob/master/README here]].<br><br>
 
1. Install [[http://pingus.seul.org/~grumbel/xboxdrv/ XBoxDrv]] - for Ubuntu there is a binary package. Installation instructions are [[http://github.com/Grumbel/xboxdrv/blob/master/README here]].<br><br>
 
2. Don't worry about all the stuff about sudo modprobe uinput and changing permissions on /dev/uinput etc.<br><br>
 
2. Don't worry about all the stuff about sudo modprobe uinput and changing permissions on /dev/uinput etc.<br><br>
3. Download [[http://www.box.net/shared/koxvusxtap runxboxdrv]] a wrapper I wrote to make using xboxdrv very simple. Hopefully, this will be included in a future release of XBoxDrv.<br><br>
+
3. Download [[http://www.box.com/shared/koxvusxtap runxboxdrv]], a wrapper I wrote to make using xboxdrv very simple. Hopefully, this will be included in a future release of XBoxDrv.<br><br>
4. Also in the download are an Oolite configuration for xboxdrv: oolite.cfg and a key configuration for Oolite to go with it: keyconfig.plist<br><br>
+
4. Also in the download are an Oolite configuration for xboxdrv: oolite.ini and a key configuration for Oolite to go with it: [[Oolite_Keyboard_Controls|keyconfig.plist]]<br><br>
 
5. Extract them to your home folder and move keyconfig.plist to ~/.Oolite/Addons<br><br>
 
5. Extract them to your home folder and move keyconfig.plist to ~/.Oolite/Addons<br><br>
6. Make runxboxdrv executable eg. chmod +x ~/runxboxdrv<br><br>
+
6. Make runxboxdrv executable:
7. Run from a menu icon or shell using: ~/runxboxdrv --cfg ~/oolite.cfg /usr/bin/oolite<br><br>
+
$ chmod +x ~/runxboxdrv
 +
<br>
 +
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
 +
<br>
 
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.<br><br>
 
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.<br><br>
9. Open oolite.cfg in a text editor to see the mappings of everything else. The option names correspond to those at [[http://pingus.seul.org/~grumbel/xboxdrv/xboxdrv.html xboxdrv manpage]] but without the "--"<br><br>
+
9. Open oolite.ini in a text editor to see the mappings of everything else. Descriptions of the option names can be found at [[http://pingus.seul.org/~grumbel/xboxdrv/xboxdrv.html xboxdrv manpage]]<br><br>
 
10. The left shoulder button acts like a shift key and effectively almost doubles the number of buttons.<br><br>
 
10. The left shoulder button acts like a shift key and effectively almost doubles the number of buttons.<br><br>
  
If you have any problems, post on the [[http://www.aegidian.org/bb/viewforum.php?f=3 Forums]].
+
If you have any problems, post on the [[https://bb.oolite.space/viewforum.php?f=9 Oolite Linux Forum]].
  
[[Category:Oolite]]
+
== Links ==
 +
*[https://bb.oolite.space/viewtopic.php?p=218983#p218983 Original discussion]
 +
*[[Joystick problems (Linux)]]
 +
*[[Joysticks and Gamepads]]
 +
*[[Joysticks: Guide to Setting Up]]
 +
*[[Keyboard Issues]]
 +
 
 +
[[Category:Oolite]][[Category:Help pages]]

Latest revision as of 02:04, 29 February 2024

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