How to configure your gamepad on Ubuntu

Linux is maybe the least popular platform for gamers, however the interest to set up and configure gamepads on it has sparked, especially since Valve's decision to make multiple game titles available for Linux on Steam. The situation on the hardware support is nothing like it used to be, as most popular gamepads are supported out of the box since Linux kernel 3.19 and things are only getting better. However, and while the kernel's xpad module works well in most situations, it is proved to be buggy with some controllers and doesn't allow for many configuration options. Testing my Xbox 360 wireless gamepad with xpad for example caused its LEDs to cyclically lighten without stop and this is of course a very annoying bug. In this quick guide, I will showcase how to disable xpad, how to replace it with more capable drivers, and how to calibrate and configure your gamepad on Linux.

Using an alternative driver

First we need to download and install a suitable driver for our gamepad. Do this by opening a terminal and typing the following command:

sudo apt-get install xboxdrv

If you want to use the latest version of the driver that boasts support for even more gamepad devices (besides Xbox controllers), you may download it from xboxdrv website.

After the installation is completed, you can run the driver by typing:

sudo xboxdrv –detach-kernel-driver

The added parameter is needed because you can't have two drivers running for the gamepad, so we need to disable the xpad module.

Install xboxdrv

Alternatively, you may also run:

sudo rmmod xpad

and then give:

sudo xboxdrv

You will know that the new driver is up and running as the terminal will start outputting values related to button presses and axes positions.

Run xboxdrv.

If you want to avoid the outputting of this information which isn't of much use through the terminal anyway, you may do so by typing:

sudo xboxdrv –silent

Another driver that you can use instead of the xboxdrv is the “ubuntu-xboxdrv” which is based on xboxdrv but is supposedly not plagued by common faults and bugs. In the case that the standard xboxdrv doesn't work for your device, you may install ubuntu-xboxdrv by opening a terminal and typing the following commands (adding a repository at your own risk):

sudo apt-add-repository -y ppa:rael-gc/ubuntu-xboxdrv
sudo apt-get update
sudo apt-get install ubuntu-xboxdrv

Calibrating the gamepad

Next step is done using the “jstest-gtk” utility which you can install by typing:

sudo apt-get install jstest-gtk

on a terminal. Open the tool, select your device and press the “Properties” button. This will open up a new window which contains positioning indicators for your device's buttons and knobs.

Calibrate Gamepad on Ubuntu.

This screen can be used to figure out whether everything is working properly, and if your gamepad needs calibration because of “inherent” offset. Press the “Calibration” button located on the lower right and then press the “Start Calibration” on the newly opened window. Then follow the instructions and your gamepad axes will get calibrated.

Calibrating Gamepad - Step 2.

If you press the “Mapping” button, you will be given the capacity to change the order of the buttons of your device. Any changes done through here are applied widely in all your games and applications.

Setting and changing between different configurations

If you want to relate gamepad button presses with keyboard or mouse buttons, you can do so through qjoypad. Install qjoypad by typing the following on a terminal:

sudo apt-get install qjoypad

Then run the tool by typing:

qjoypad –notray

Set Gamepad configuration - Part 1.

You may add individual layout settings by pressing the “Add” button on the top left of the application and naming them. Here, I have assigned the letter “H” when the left thumb axis goes left, and the letter “O” when it goes right.

Set Gamepad configuration - Part 2.

If you don't know what button corresponds to what name, you should click on the “Quick Set” button on the lower right that will first prompt you to press a gamepad button, and then assign a keyboard button.

After finishing the various configurations, you may quit the tool and start it from the menu. This will take qjoypad to the tray, allowing you to change between the different configurations.

Set Gamepad configuration - Part 3.

Share this page:

16 Comment(s)