Gamepads, Joysticks on Fedora 17

I realize that you most likely ended up here via a Google search or similar due to programs and games not recognizing your gamepad or joystick. So, I will spare you the details of my painful, countless hour adventure as to figuring out why my PS3 and Xbox 360 controllers weren't being recognized by my favorite games.

The Problem

As of Fedora 17, the default kernel no longer includes the joydev kernel module. As a result, when you plug in your gamepad or joystick, the device's associated /dev/input/jsX device path is not created and thus applications and games do not see the device.

The Solution

Luckily, when Fedora developers ripped out the joydev kernel module from the default Fedora 17 kernel, they put it into an easily installable package in the core repository used by yum. The following commands will allow you to install the 'kernel-modules-extra' package that contains the needed joydev kernel module, and install the 'joystick' package which allows you to test your gamepad and joystick to verify your system is able to read all button presses and movements:

$ sudo yum install kernel-modules-extra
$ sudo yum install joystick

After installing these packages and plugging in your gamepad or joystick, you should see the device's associated device path show up as jsX in the /dev/input directory. You can test your gamepad or joystick using the 'jstest' command-line program that comes with the joystick package. To test the device, run the following command:

$ jstest --event /dev/input/jsX

If you are prompted with a permissions error, execute:

$ sudo chmod 666 /dev/input/jsX

Installing Qjoypad (optional)

If, like me, you are new to using gamepads and joysticks in Linux, you will want to learn about and install qjoypad. Qjoypad allows you to easily map button presses and other actions with your gamepad or joystick with simulated keyboard key presses or mouse movements. This comes in handy when a game you are trying to play doesn't support your controller, or doesn't offer the ability for you to customize the controls. There are a couple of alternatives to qjoypad, however I found qjoypad to be the most intuitive to use at the time of writing this article. If you want to install qjoypad to your system, you will want to do so by following these steps:

  1. Install dependent Qt packages (version 4+):
    $ sudo yum install qt qt-devel
  2. Download the latest version of qjoypad
  3. Un-tar the package:
    $ tar xvfz qjoypad-VERSION.tar.gz
  4. Get into the src/ directory of the un-tarred package
  5. Comment out lines 14 through 17 in the 'config' file -- this is an unneeded check that doesn't work properly if 'qt-devel' installs 'qmake' with a differnent name e.g. 'qmake-qt4' -- e.g.:
    #if ( ! qmake ); then
    #    echo "Error: you need qmake!";
    #    exit 1;
  6. Execute the 'config' file to generate the 'Makefile' file:
    $ ./config
  7. Add '-lX11' without quotes to the end of line 19 in the newly-generated 'Makefile' file and be sure to include a space between the new flag and '-lpthread' -- e.g.:
    LIBS = $(SUBLIBS)  -L/usr/lib64 -lXtst -lQtGui -lQtCore -lpthread -lX11
  8. Build the package and install it to your system:
    $ sudo make install
  9. Run qjoypad!
    $ qjoypad

Qjoypad should now be running and an icon should have been added to your system tray. You can double click the icon to begin mapping your gamepad or joystick's button presses/actions with simulated keyboard keys and mouse movements.

Hopefully your gamepad or joystick is now working as expected. Although the solution to this problem was quite simple, the problem was very difficult to troubleshoot for a self-proclaimed Linux-gaming-novice like myself as there were virtually no search results hinting at solutions to this issue. Hopefully this post and discussions I participated in on reddit and make their way to the top of future search results to help others. I hope this helped you out and feel free to ask questions in the comments section below if you ran into any problems.