Using Joysticks on Linux

This topic was published by and viewed 2754 times since "". The last page revision was "".

Viewing 1 post (of 1 total)
  • Author

  • DevynCJohnson
    • Topics - 437
    • @devyncjohnson

    Linux systems support a wide variety of games and emulators. Obviously, many Linux gamers will want to use joystick controllers or other game controllers for gaming instead of a keyboard. Thankfully, Linux supports many game controllers. The Linux kernel contains drivers for several joysticks and controllers, so many Linux gamers can plugin their game controller and begin playing. However, the Linux kernel does not support all joysticks and controllers. Adding support for these controllers and making them work is easy to do.

    First, here are some random facts that may be helpful to know about Linux and game controllers. The xf86-input-joystick module is not a driver for gaming. Instead, it allows users to move the cursor with a joystick rather than the mouse. The xserver-xorg-input-joystick driver acts the same way. So, on Linux gaming systems, uninstall xserver-xorg-input-joystick and xf86-input-joystick if they are on the system. Otherwise, the joysticks will only control the cursor and not a game. It is also helpful to know that on Linux, the device path for the first game controller to be plugged in is /dev/input/js0, the second would be /dev/input/js1, and so on.

    If the Linux system does not recognize the game controller, then the gamer has one of two issues. One, the game itself may not allow controllers. For instance, the video game Supertux v0.1.3 does not support controllers but Supertux v0.3.3 does support controllers. The second possible problem may be the lack of support for the game controller. To fix this issue, install "joystick" by installing it through the system's package manager or by typing sudo apt-get install joystick in a terminal with root privileges. This is a joystick driver that adds support for more controller types. Users may also want to install the joystick configuration utility "jstest-gtk" by typing "apt-get install jstest-gtk" in a terminal with root privileges. This tool (discussed later) can help make a controller work by calibrating the device.

    If the controller is still not recognized by the system, then check /dev/input/js0. If the file /dev/input/js0 is missing (if the controller in question is js0), then check the connection ports and cables associated with the game device. Also, make sure that the controller is not broken. If the controller has a light that turns on when plugged into a computer, then the gamer will know that the connection and power is fine between the Linux system and the controller. If the controller requires batteries, then try putting in new batteries. To make sure that Linux is recognizing the device, type "cat /dev/input/js0" in the command-line. Now, when a button is pressed or a joystick is moved, odd symbols will appear on the screen. When finished with this last test, press "Ctrl-c". If all of these tips fail, then perhaps one of the suggestions further on in the article will help.


    The joystick configuration utility "jstest-gtk" allows gamers to calibrate their controller and test the controller's functionality. With the controller(s) plugged in, click a controller to configure the settings. Under the buttons heading on the controller configuration window, are several white boxes with a number inside. For every button pressed on the controller, one of those boxes turn black. This allows users to make sure that each button is recognized by the system. If two buttons make the same box dark, then the system is acting as if those two buttons are the same. This would mean the user needs a different driver. After checking the buttons, try moving the joystick(s). The "+" in one of the circular graphs should move. This calibrator shows three graphs, so if the controller only has one joystick, do not worry, the controller was not detect incorrectly. If a joystick is moved to the upper-left corner and two or three of the bars below show -32767, then the joystick is detected. Moving the joystick up should show -32767 and moving down should display 32767 (not negative). Moving the controller left should make one or two bars show -32767 and moving right will display 32767. When testing all of the joystick's directional movements, move the joystick all of the way to each direction. If a number other than positive or negative 32767 is shown and/or the numbers are not zero at the joystick's default position, then calibration is needed. On many controllers, testing the arrow keys uses the graph and number bars like the joysticks. Testing and calibration is the same.

    NOTE: If a joystick(s) or arrow keys are not recognized or the test results show numbers other than +/-32767, the controller may have an "Analog" button that changes the controller's behavior. Pressing this button may make a joystick and/or arrows work correctly.

    NOTE: For calibration and testing, the controller must be turned on (if it has an on/off switch or button) and powered properly.

    NOTE ON WIRELESS DEVICES: If the controller is wireless, make sure that the bluetooth, radio, infrared, etc. settings are correctly configured and installed. Often times, users assume that the wireless controller's connection is fine. Also, interference from other devices may play a part in the controller's odd behavior.

    Some hardware manufacturers supply Linux drivers. A Linux gamer could still use an unsupported controller if the manufacturer supports a Linux driver. If not, then the gamer should look for a driver by searching websites like,, and Google Code. The user may also try searching their package manager for a driver. For instance, a user may have a Wii controller that they wish to use on their Linux system. To make this device usable on the system, they may search their package manager or the Internet and find the xwiimote driver. This is a driver specifically for the Wii remote.

    NOTE: To install the xwiimote via command-line, type "apt-get install xwiimote" in a terminal with root privileges. Alternately, search for the driver in the system's package manager.

    NOTE: When installing drivers, it is best to restart the computer. Although Linux does not seem to require this most of the time, it is a better practice to restart the system when adding drivers or changing the kernel. Other than that, the user does not need to perform other tasks for the driver. The kernel will handle the rest.

    Some games may need to be configured for controllers. To do this, look through the options, setting, and/or preferences of the game in question. Under the settings for game controls, change each keyboard button to a key on the controller. Depending on the game, this can be done by selecting a particular command (like jump) and press a button on the controller that should be "jump".

    Once a gamer has tried all of these tasks, their game controller should work. If not, try setting up an account here, and report that the kernel does not support the controller. However, before reporting to the kernel developers, make sure that the system is up-to-date, especially the kernel. Also, be absolutely sure that the device itself is fine and that the game supports controllers. When the report is filed, be thorough about describing the device. This means including the model number, manufacturer, date made, connection type (it may be an issue with the port driver - unlikely), and one or more easy ways to obtain a controller of that type. Informing the kernel developers on how to obtain the device is not required, but it will help the kernel developers and make their task easier. They can then obtain the controller and use it to test and develop drivers.

Viewing 1 post (of 1 total)