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)

Add comment

Please register in our forum first to comment.

Comments

By: David Hollinger

This article is horribly outdated as the XPAD kernel driver is now a far superior gamepad driver to xboxdrv. If you're running any recent version of Ubuntu, then it should be plug-n-play for the Logitech F310, F710, XB360, XBOne, and Steam Controllers.

By: Bill Toulas

Allow me to disagree. Especially in the wireless Xbox controller that I used for this article, the xpad driver was causing random led flashes as I mentioned in the post. I also mentioned that it is plug n play, but that doesn't mean it's better. Please read the post first before you characterise it "horribly outdated". Thank you :)

By: private

The way this article is written is very bad. It blindly assumes that the only gamepads in the world are Xbox controllers.

What about PS4 or Wii/WiiU controllers?

By: Bill Toulas

Hello and thanks for commenting. I have actually mentioned in the post that xpad is working for most controllers, and I have specifically mentioned that xboxdriv has support for other gamepads besides the xbox one. That said, I can't see how this article can lead someone to believe that the only gamepads in the world are Xbox controlelrs.

By: jeff

thank you and also my brother has that xbox romote that is in your background

By: Ramez

many thanks bill, works great for me 

By: Zyrac Xavier

Interesting article, your article popped up in a search for info on linux gamepads. It has given me some insight and a direction to go in the driver department. Thanks Bill.

I dont use the ubuntu or any debian based linux, my laptop runs OpenSuse, and my desktop is an Arch. Will xpad run in these or have you a suggestion for a driver that will.

By: FanFan

and how do you do it with a gamecube controller?

By: Andrea

Hi, thanks for sharing this.Is possible to configure two gamepads as well?

Excellent! Working perfect on Ubuntu 18.04

I had only to install the "ubuntu-xboxdrv" for my Logitech F310.

It's time to let some "Steam" off!  :)

By: Drem

I followed the diretions in this article assuming it would work, and now my controller does not work at all. Fully borked, and I am too new of a user to know how to retrograde to the old driver.And now I find my steam does not work either. I don't recommend following this.

By: Samuel

When was this article written? Is it still relevant? I can't find a date anywhere, not even on the comments.

How valid is the problems described for other gamepads ?

By: Kyle Vukelix

Very Good. Had a cause to want a gamepad, knew I had an old Xbox pad somewhere. had used one on windows XP, just lop off the plug and put on a male USB, install a driver, n she went just fine. no wukkas.

tried it in 2020, nowhere near as neat. win10 very hackish install, out of the box ubuntu (Ubuntu 20.04 LTS) did detect, but very messed up bindings.

as an Xbox Gamepad Driver, perfect. all the stars. cant comment on 360, one, gamecube (?), switch, yadda yadda. but for the OG Xbox, just works.

Thank you all involved in its crafting.

 

Now, Get my Game On.

 

By: Mark Williams

Do not try this at home.   It just destorys "working" js0 and creates junk xbox. 

By: eos lover

ElementaryOS is best distro ever... unfortunatly only for strong hardware

By: DC

I've been having a problem for months trying to get my F710 to work with 20.04. It was working, then suddenly stopped after some OS update. JSTEST-GTK detected the gamepad on js0, but no input.

I tried enabling xboxdrv per the instructions here. When I run the command line, the gamepad is detected with JSTEST-GTK, but still no input. Different driver, same problem. How might I fix this? And/or how can I get back the XPAD driver that came pre-installed with the OS?