Hi,
I've seen there isn't a complete HOWTO about gamepad, here it is. I think it would be nice to make this threat STICKY under Gaming and Leisure....
This HOWTO will learn you how to use a gamepad under Ubuntu. It should work for Dapper, Edgy, and all other following version of Ubuntu
What you need
* You need to have activate the « Universe » depository in your /etc/apt/sources.list or from Synaptic
* A gamepad for gameport or USB.
* A SoundBlaster card or compatible (gameport only).
* Knowing how to use a terminal
Introduction
Ok, let's begin. First, plug your gamepad. In 50% of case, the gamepad is auto-detected (If it's a gameport gamepad, you need to reboot, cause it's not plug'n'play). Just test this, if it don't works, see what's next.
You need to know one important thing under Linux. Most of Linux application use it own algorithm to detect gamepad. It's not like M$ Windows, where there is one tool that centerise all data (and the game use these data). That means that if your gamepad works with "jscalibrator" or other, it may not work with your game. You may need to check configuration of your program (joy_sensitivity for Zsnes for example).
-------Calibration - Test
We gonna show different method to calibrate (but especially test) your gamepad.
---With "jscalibrator" (unapproved, see below)
Install the package :
Code:
sudo apt-get install jscalibrator
Then calibrate with the command :
Clic on "calibrate".
Use all your axes in all direction, so the program could save the minimal/maximal values of your gamepad.
Re-clic on the « Calibrate » button so your data could be saved.
/!\ Important /!\ : Once save, the informations of calibration are stocked in the file ".joystick" in your /home/user.
---By the configuration centre of KDE
In the KDE menu, select « Configuration centre of KDE ».
Clic on the section « Périphériques », then « Gamepad ».
Clic on « Calibrer », then proceed to the calibration and follow instructions.
---By console
The ultimate method !
If you see waird signs, that mean it should work !
Code:
sudo apt-get install joystick
Joystick is a program to calibrate the gamepad in console. Use these command :
Code:
jscal /dev/input/js0
jstest /dev/input/js0
-------Manual method
Your gamepad isn't detected ? You just pluged your gamepad and you do not want to reboot ? OK !
1°/ Créate gameport on Linux
In terminal :
You need to place in the correct folder
Create the gameport with command :
2°/ Loading modules
You will need "Drivers". Under ubuntu, these are modules that you will need to load with your linux kernel.
In fist, we gonna do it manually. If all works, we gonna edit some files, so everything could be done at boot.
A/ Test the solution before edit the files
In a terminal, load in memory the modules required according to your gamepad.
For example, for a Sidewinder GamePad (/!\ Check under to know the good modules !!! /!\) :
Code:
sudo modprobe joydev
sudo modprobe ns558
sudo modprobe sidewinder
At all moment you can see the modules loaded with the command :
Code:
lsmod
lsmod | grep gameport ## to display only lignes containing "Gameport"
Now test your gamepad.
If you success in calibrating your gamepad, it's good, you choose the good modules. Get to the following section.
If you get an error message and don't suceed to calibrate your gamepad, you need to look under to know the good modules.
Reminder : To unload a module, you need to use the command modprobe -r (remove) :
Code:
sudo modprobe -r sidewinder
B/ Load the modules automaticaly at start
For this, we gonna edit the configuration file "/etc/modules". In a Terminal, enter the following command :
Code:
sudo gedit /etc/modules (Ubuntu)
sudo kate /etc/modules (Kubuntu)
sudo mousepad /etc/modules (Xubuntu)
Take car of casse sensitive. This file « modules » regroups a part of the driver to load with your Linux kernel.
In the end of the file, add this text :
Code:
## Pilotes de manette de jeu (joystick)
joydev ## Module for gamepads
ns558 ## Module for gameport
sidewinder ## Module for MS-SideWinder pads
This will give you a file /etc/modules that should look like this :
Code:
# /etc/modules: kernel modules to load at boot time.
#
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with "#" are ignored.
lp
## Pilotes de souris
psmouse
mousedev
## Pilotes de carte de son ALSA Ensoniq ES1371 AudioPCI-97
alias snd-card-0 snd-ens1371
below snd-es1371
snd-seq-device ## Optionnal (this is about MIDI)
snd-seq-midi ## Optionnal (this is about MIDI)
## Pilotes de manette de jeu (joystick)
joydev ## Module for gamepads
ns558 ## Module for gameport
sidewinder ## Module for MS-SideWinder pads
In addition of this, you need to create/edit the file /etc/modules.conf, to add lines
Code:
sudo gedit /etc/modules.conf (Ubuntu)
sudo kate /etc/modules.conf (Kubuntu)
sudo mousepad /etc/modules.conf (Xubuntu)
In the end of the file, copy the following lines :
Code:
alias js0 input
above input joydev ns558 sidewinder
Save, and reboot.
------- MODULES LIST
For a sound card with ens1371 chipset
If you get a sound card with ens1371 (Ex : Sounblaster 64 and 128), you will need to do a small thing before.
First, verify the model of your sound card : in a terminal, type
Code:
lsmod | grep snd_ens1371
If you got something, that's good, continue, if not, you got an other soundcard (But maybe you can continue by replacing what's next « joystick_port=1 » by « joystick=1 » or « joystick » and adapting with your soundcard.)
Edit the file /etc/modprobe.d/options :
Code:
sudo gedit /etc/modprobe.d/options
And add the line :
Code:
options snd_ens1371 joystick_port=1
Reboot, and restart the HOWTO from beginning.
(Thanks PierreR)
For an Aztech soundcard
Here too, seems you need to activate the gameport.
So in /etc/modules.conf, add :
Code:
above snd-trident snd-pcm-oss
alias sound-slot-0 trident
alias js0 input
above input joydev pcigame analog adi
For a MS Sidewinder gamepad
Code:
sudo modprobe joydev
sudo modprobe ns558
sudo modprobe sidewinder
sudo modprobe analog ## This one work only for analog pad, like joysticks
For a Logitech WingMan digital gamepad
Code:
sudo modprobe joydev
sudo modprobe ns558
sudo modprobe adi ## Specific driver for Logitech gamepads
For a Logitech WingMan gamepad (analog)
Code:
sudo modprobe joydev
sudo modprobe ns558
sudo modprobe analog ## Module for analog gamepads
sudo modprobe pcigame ## Module for PCI card (??)
sudo modprobe adi ## Module for Logitech pads
For a MS SideWinder ForceFeedBack Pro
Code:
sudo modprobe joydev
sudo modprobe ns558
sudo modprobe analog
sudo modprobe sidewinder
sudo modprobe iforce ## Force Feedback driver
sudo modprobe evdev ## driver for ???
For a Guillemot dual analog gamepad (gameport, non-USB)
Code:
sudo modprobe joydev
sudo modprobe ns558
sudo modprobe guillemot
sudo modprobe analog ## to check
sudo modprobe iforce ## to check
Think about the button that activate/desativate the joystick of this pad.
For a USB gamepad
(From http://www.linux-usb.org/USB-guide/x194.html )
If auto-detect don't works (Very rare case !!)...
Code:
sudo modprobe usbhid
sudo modprobe joydev
Now, plugin your gamepad (If havn't do it before) and test.
You just need to add usbhid and joydev in /etc/modules like showing before.
Other gamepads
To obtain a complete list of modules, you can type "modprobe -l"
I suggest you to install the "modconf" package :
Code:
sudo apt-get install modconf
Then launch modconf in sudo (It's better to run it with a maximized window) :
You will then land on a COMPLETE list of all modules loadable. Get in the folder "joystick", and you will see all joystick driver available !
About multiples gamepads
Multiple gamepads works fine. There is just a few bug with "jscalibrator" : /dev/input/js1 points to /dev/input/js0... I gonna report this to launchpad
EDIT : reported directly to author.
Links
Kernel doc here: http://www.freelink.cx/joystick.html.
Complete page about gamepads : http://www.charmed.com/txt/joystick.txt
Credits :
HOWTO by me and other french contributers.
Thanks to all french user that are workings such hard to maintain the french wiki
If you have any suggestion/question, post here.
You are free to copy, redistribute, correct, improve this document, even if you don't quote me in credits.
Bookmarks