Getting Saitek X52 Joystick Working Within Linux
Now that Steam is available for Linux (How to install article coming soon) I have once again made the switch to 100% Linux. How that I have Steam installed I wanted to start playing Egosoft’s X3 series again, but for best performance this really needs a joystick. This is how I went about installing and using my Saitek X52 joystick in Fedora 18.
The problem is as of Fedora 17 the joydev kernel module was removed by default. The result is when a new joystick is plugged in the require paths in /dev/input/jsX are not being created, so your software and games can not find the device. So we need to reinstall the joydev module.
After installing the kernel joydev module the joystick and all its buttons are detected by the latest kernel (which as of writing is)
[~]$ uname -a Linux taichi 3.9.4-200.fc18.x86_64
The Install Instructions for a fresh install
- Even though joydev was stripped from the default kernel it has been bundled into an easy to install package available in the yum repository
[~]$ sudo yum install kernel-modules-extra joystick-support joystick
* kernel-modules-extra - Contains the actual kernel modules required * joystick-support - Added these new modules to the loaded kernel * joystick - Provides a testing suite so you can make sure your stick is recognised
- Now the kernel software is installed we need to load it. You can ether take a moment and reboot your PC, the modules will get loaded at boot time, or you can load them your self with modprobe
[~]$ sudo modprobe joydev [~]$ sudo modprobe analog
- After the new modules have been loaded you can plug your joystick in and you should see the new paths being created under /dev/input it will be something like /dev/input/js0. You can not test to make sure your joystick is being detected correctly using ‘jstest’
[~]$ jstest --event /dev/input/js0
Installing Qjoypad Optional, mapping buttons to the keyboard
The Saitek X52 has over 30 buttons on it so the easiest way to set these up would be mapping them to keyboard shortcuts. Luckly, with a little Googling, I found a fantastic tool for this. Qjoypad is a Qt based program that will just sit in your tray and map any button presses to the associated keyboard shortcut.
There are no binary packages, that I could find, but installing from source is fairly painless. There are alternatives out there, but I haven’t spent any time with them. I found Qjoypad first, and for my purposes, it was perfect. If you find something you think is better please let me know in the comments!
- Install Qt dependency packages
[~]$ sudo yum install qt qt-devel
- Download the latest version of Qjoypad, as of writing that was 4.1.0
- Extract downloaded file
[~]$ tar -zxvf qjoypad-4.1.0.tar.gz
- Change directory into main source folder
[~]$ cd ./qjoypad-4.1.0/src
- The distributed config file makes a check for qmake, unfortunately this will fail in Fedora as the qt-devel package installed qmake as qmake-qt4 so we can just comment out the check in line 14-17
[~/qjoypad-4.1.0/src]$ nano -w ./config #if ( ! qmake ); then # echo "Error: you need qmake!"; # exit 1; #fi;
- Now run config to generate the Makefile
- Edit the new Makefile and append -lX11 to the end of line 19. I’m not ‘up-to-scratch’ with Makefiles and compiling, so I’m not able to give a good reason for this, I just now without it ‘make’ will fail to compile. If someone can explain it better than I leave a comment and I’ll happily update the article
[~/qjoypad-4.1.0/src]$ nano -w Makefile LIBS=$(SUBLIBS) -L/usr/lib64 -lXtst -lQtGui -lQtCore -lpthread -lX11
- Now as root run the install
[~/qjoypad-4.1.0/src]$ sudo make install
- Run QJoypad
[~/qjoypad-4.1.0/src]$ cd ~ [~]$ qjoypad
Qjoypad will run in your system tray and can be opened by double clicking. From there you can setup your profiles and key bindings. There is support for multiple profiles as well so you are able to set different bindings for each of your games and load them as required.
I hope this has been of help to you, I know I’ll be referring to it after my next install. Please leave me a comment below if this was of help, or you’ve found any problems.
As always, if you have been, thanks for reading