Thanks to all the Indie games, Steam and Humble Bundle recently the market of games for Linux has become most active than ever and so I’ve bought some arcade/action/platform games.
Perhaps it’s just me but I don’t like too much to manage around 10 different keys on the keyboard and remember all the combo that I’ve to do with them, a joypad it’s a much simpler way to play that kind of games, and what’s the best joypad around ?
In my opinion Playstation joypads are some of the best you can find around, probably Xbox are good too, but I’ve an unused playstation 2 and so I’ve choose to go in that direction.
And I must say that with a great surprise everything worked fine without too much problems !!
Please note I’ve tested this on my Linux Mint 14, that uses the same Kernel (3.5.x) and software of an Ubuntu 12.10.
Playstation 2 to USB adapter
As first thing you have to buy an adapter from the Playstation 2 joypad to a standard USB port.
I’ve bought the following model from Ebay for 3€, I’ve choose this for 2 reasons:
- It’s really cheap
- It can be used to plug in 2 joypads
Once plugged in your linux box run from a terminal the command
lsusb, you should see an output like this one:
mint-desktop tmp # lsusb Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 001 Device 003: ID 0951:1643 Kingston Technology DataTraveler G3 4GB Bus 001 Device 004: ID 058f:6364 Alcor Micro Corp. AU6477 Card Reader Controller Bus 002 Device 003: ID 0424:2524 Standard Microsystems Corp. USB MultiSwitch Hub Bus 002 Device 004: ID 2001:3c19 D-Link Corp. DWA-125 Wireless N 150 Adapter(rev.A3) [Ralink RT5370] <strong>Bus 002 Device 009: ID 0810:0001 Personal Communication Systems, Inc. Dual PSX Adaptor </strong>Bus 002 Device 006: ID 050d:3201 Belkin Components F1DF102U/F1DG102U Flip KVM Bus 002 Device 008: ID 046d:c01d Logitech, Inc. MX510 Optical Mouse Bus 002 Device 007: ID 046d:c315 Logitech, Inc. Classic New Touch Keyboard
This means that so far is all good.
Test the Joypad within Linux
Connect the joipad of your Playstation 2 to the adapter, now how you can test it ?
A software that does this work is
jstest, so install the package that contains it with the command:
sudo apt-get install joystick
Or equivalent if you are not using a .deb Linux distribution.
Now you can run the following command from a terminal:
#jstest /dev/input/js0 Driver version is 2.1.0. Joystick (Twin USB Joystick) has 6 axes (X, Y, Z, Rz, Hat0X, Hat0Y) and 12 buttons (Trigger, ThumbBtn, ThumbBtn2, TopBtn, TopBtn2, PinkieBtn, BaseBtn, BaseBtn2, BaseBtn3, BaseBtn4, BaseBtn5, BaseBtn6). Testing ... (interrupt to exit) Axes: 0: 0 1: 0 2: 0 3: 0 4: 0 5: 0 Buttons: 0:off 1:off 2:off 3:off 4:off 5:off 6:off 7:off 8:off 9:off 10:off 11:off
Now if you push the direction buttons or some other buttons you should see some changes:
#jstest /dev/input/js0 Driver version is 2.1.0. Joystick (Twin USB Joystick) has 6 axes (X, Y, Z, Rz, Hat0X, Hat0Y) and 12 buttons (Trigger, ThumbBtn, ThumbBtn2, TopBtn, TopBtn2, PinkieBtn, BaseBtn, BaseBtn2, BaseBtn3, BaseBtn4, BaseBtn5, BaseBtn6). Testing ... (interrupt to exit) Axes: 0:<strong>-32767</strong> 1: <strong>32767</strong> 2: 0 3: 0 4: 0 5: 0 Buttons: 0:off 1:<strong>on</strong> 2:<strong>on</strong> 3:off 4:off 5:off 6:off 7:off 8:off 9:off 10:off 11:off
If while pushing the buttons you see some number changing from off to on you’re done, that’s how the different buttons are mapped in Linux.
Note: At first this was not working for me, I switched the connection of the Joypad in the adapter and everything started to works, so apparently there is in the adapter a port 1 and a port 2 and you have to use port 1.
How to map the joypad buttons on keys
The most simple thing to do to use the joypad is to map every button with a keyboard key, in this way you’ll be able to use it with all games that don’t have a native support for joypad, a good software that can do this is QjoyPad.
QJoyPad takes input from a gamepad or joystick and translates it into key strokes or mouse actions, letting you control any XWindows program with your game controller.
Its main features are
- Move and click the mouse with your joystick
- Auto-detects how many joysticks you have and how many buttons and axes each supports
- Support for devices with more than two axes
- Save as many layouts as you want and switch between them quickly
- Swap layouts on the fly from the command line or from a script
- Set or reset all the keys at once in a flash
- Adjust the sensitivity of every axis independently
- Quietly hides in your system tray, running in the background without taking up space
- For window managers without a system tray, QJoyPad can run without the tray icon.
- Make an axis “Gradient” so that a light push does a little and a harder push does more – now with customizable curves!
- Make a button “Sticky” if you don’t feel like holding it down all the time
- Turn on Rapid Fire so you don’t wear out your gamepad!
- Native tray icon code making putting it in your start up entry simple
- To install it on Debian, Ubuntu and Mint open a terminal and run the command
sudo apt-get install qjoypad
Now you should find the qjoypad icon on the game menu, or you can start it from a terminal with the command
qjoypad, in both way you should see a new joypad icon on your system tray.
If you left click on it the main window of qjoypad will open:
From this window you can configure the keys for axis1 (Horizontal) and axis2 (vertical) and all the buttons, and save them in a layout.
Once done save and … start your favorite game.
To be honest I was very skeptical about this solution, but in really few time I’ve been able to configure the joypad and use it with Shank 2 a game unplayable with just the keyboard (at least for me).
To me this demonstrate once more that the Gnu/Linux system is mature and setting up peripherals is now not harder than some years ago.
- In this SteamOS era where do the Linux gaming stand?
- Introduction to gnome maps
- How to manage processes with cgroup on Systemd