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.
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.
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:
- Install dependent Qt packages (version 4+):
$ sudo yum install qt qt-devel
- Download the latest version of qjoypad
- Un-tar the package:
$ tar xvfz qjoypad-VERSION.tar.gz
- Get into the src/ directory of the un-tarred package
- 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; #fi;
- Execute the 'config' file to generate the 'Makefile' file:
- 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
- Build the package and install it to your system:
$ sudo make install
- Run 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 gaming.stackoverflow.com 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.
Post a Comment
Field names followed by an * are required fields.
I had JoyPad PACITECH 006 on Fedora 17. I cant get /dev/input/js0
here is response from ls /dev/input/by-id > usb-Technology_Innovation_International_Co.__Ltd._USB_GAME_CONTROLLER-event-joystick
when I try this: cat /dev/input/event12
I got response: random asci in terminal, on every joypad button click !
how can I get /dev/input/js0 ?
any idea ?
sorry - my fault. GRUB keep selection on OLD kernel. so - have to reset once again , and select NEW kernel, after install kernel-modules-extra. maybe it is worth to put as hint in your blog text ?
dude, you are THE BOMB!!!!!! - fantastish! - thanks for all your hard work!!!!!
thank you so much! I love linux and I love emulators!
the linux community is always the most helpful.
It will not allow me to install kernel-modules-extra; it attempts multiple mirrors and then stops with errno 256. Any suggestions? I want to play final fantasy on my couch looking at the big screen lol; but i cant connect my 360controller :\
Blake Rohde on
Unfortunately this sounds like a yum issue you are running into. Have you verified you are running Fedora 17? I believe prior versions of Fedora did not have a kernel-modules-extra, so if you are not running F17 then that package will not be available. I gave google a quick search for "errno 256" and I found this forum post that could give you an avenue for troubleshooting: http://forums.fedoraforum.org/showthread.php?t=81927.
I hope that helps,
I've unsuccessfully tried to install qjoypad before, and now it is working like a charm, thanks to your post.
I've put -lX11 at the end of line 19 in Makefile but still get this error message:
[pete@dell src]$ sudo make install
g++ -c -pipe -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -O2 -Wall -W -D_REENTRANT -DDEVDIR=\"/dev/input\" -DICON24=\"/usr/local/share/pixmaps/qjoypad/icon24.png\" -DICON64=\"/usr/local/share/pixmaps/qjoypad/icon64.png\" -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/lib64/qt4/mkspecs/linux-g++ -I. -I/usr/include/QtCore -I/usr/include/QtGui -I/usr/include -I. -I. -o axis.o axis.cpp
make: g++: Command not found
make: *** [axis.o] Error 127
Thank you! That's very helpful.
gustavo araújo on
when i try run qjoypad it start fine but when i try configure my joystick my terminal says:
Client failed to connect to the D-BUS daemon: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.
and qjoypad says that no joysticks devices are avaliable !!!
please help me ;(
what i need to do here ?
Great little guide, worked fine.
Just one issue though, the controller does not stop flashing. It connects fine, and works perfectly, but it continues to flash as if it isn't connected. I've tried connecting it to the Xbox, and it stops and behaves normally. I've also connected it to the same receiver using Windows and it works normally.
Just wondered if anybody else has had any similar issues?
Blake Rohde on
Did you try executing "sudo chmod 666 /dev/input/jsX"? Beyond that I can't say I've seen that message before.
The LEDs on both my Xbox 360 and PS3 controller continuously blink as well when connected to my Fedora-based PC. The continuous blinking has to do with the fact that the controllers are not fully initialized properly with the generic/minimal drivers we are using.
You should try the following:
$ sudo yum install gcc-c++
And then try compiling the makefile.
thanks so much for this post. I got the PS3 controller recognized by PCSXR emulator, it's right there in Controller options panel. Somehow any ISO I play can't see the controller, only the keyboard. Any ideas?
You are a life saver! I was installing this, and it took an hour of looking before i found your post, which is the only one with the correct answer to this problem! Thank you! :)
Is there a Linux version of Super Meat Boy?
Blake Rohde on
The Linux binaries and Steam activation keys for Super Meat Boy were available in Hunble Indie Bundles 4 and 5 (http://en.wikipedia.org/wiki/Humble_Bundle#List_of_games_offered), however Steam does not currently offer a Linux install for the game.
Still struggling with this on Fedora 18.
Tried to install joystick, but instead Fedora installs linuxconsoletools with the following message: Package joystick-1.2.15-28.fc18.i686 is obsoleted by linuxconsoletools-1.4.4-7.fc18.i686 which is already installed
'ls /dev/input/by-id' shows only my keyboard and mouse, and there is no jsX in the /dev/input directory.
Controller just keeps blinking...taunting me...
Blake Rohde on
Can you list out the steps you are taking to try and get it working? I just re-ran through this tutorial within Fedora 18 and my (USB-connected) PS3 controller is working just fine. It seems the only difference for F18 versus F17 is that the 'joystick' package has been replaced with 'linuxconsoletools' (i.e. instead of 'sudo yum install joystick' run 'sudo yum install linuxconsoletools').
1. 'sudo yum install kernel-modules-extra' (installed no problem)
2. 'sudo yum install linuxconsoletools' (installed no problem)
3. 'jstest --event /dev/input/jsX' (result: 'jstest: No such file or directory')
jstest is installed and working, as evidenced when I simply execute jstest. It seems it's referring to the file or directory /dev/input/jsX. There is no jsX in the /dev/input directory. I successfully followed the rest of your guide and compiled qjoypad with no issues. However, neither my computer nor qjoypad see my PC USB Xbox 360 controller.
UGH, I'm an idiot. I forgot I'm running a PAE kernel. So...kernel-PAE-modules-extras needed to be installed. Working like a charm now! Thanks for your excellent guide!
Blake Rohde on
When typing out the command 'jstest --event /dev/input/jsX' the 'X' should be replaced with a positive integer. If you only have one controller plugged in and it is recognized, then this number should be a zero. I suggest using tab complete before typing in the 'X'. You can also use the command-line program 'ls' to see the contents of the '/dev/input' directory.
I hope this helps.
Your guide has been very helpful, but I am running into an error early on. when I try to run the config file to create the makefile, I get an error that I need the libxtst library, but Fedora says that it is already installed. what is wrong?
Blake Rohde on
What version of Fedora are you using? What does YUM tell you when you run '$ sudo yum install libXtst'?
Mike: I had the same issue, you need to: sudo yum install libXtst-devel