With Steam recently coming to Linux, and all the great humble bundles, it’s becoming more and more important to have a good gamepad to use on your Linux PC. If you’re a console gamer, you probably already have an XBox 360 or a PS3 controller. In fact, plug in your controller via USB and it probably already works. Unfortunately, many games (Hotline Miami, Super Meat Boy, Bastion, etc.) assume you have a 360 controller and the button mappings of a PS3 dualshock controller will be horribly skewed (the PS3 select button is 360’s A button). In some games, like Cave Story+, this is not a problem because they allow custom key mappings within the program. Some correctly detect the PS3 controller. However, many games just assume a 360 controller, so it simplifies things if you make the dualshock pretend to be a 360 controller. Luckily, there’s a program that does just this: xboxdrv
.
Setup
- Install the
xboxdrv
package. Or get it from the source.
sudo apt-get install xboxdrv
- Plug in your PS3 DualShock controller via USB. The LEDs will flash. You should see relevant lines in your
/var/log/syslog
file (or equivalent, depending on your distribution – I’m using Ubuntu 13.04).
usb 4-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
usb 4-2: Product: PLAYSTATION(R)3 Controller
usb 4-2: Manufacturer: Sony
sony 0003:054C:0268.0008: Fixing up Sony Sixaxis report descriptor
input: Sony PLAYSTATION(R)3 Controller as /devices/pci0000:00/0000:00:13.2/usb4/4-2/4-2:1.0/input/input18
sony 0003:054C:0268.0008: input,hiddev0,hidraw0: USB HID v1.11 Joystick [Sony PLAYSTATION(R)3 Controller] on usb-0000:00:13.2-2/input0
UPDATE 2014-06-23 Start —
Run ‘dmesg | grep sony
‘ in a console and read the latest messages. If you see messages like the following, there’s likely an issue with your kernel:
sony 0003:054C:0268.0003: can't set operational mode
sony: probe of 0003:054C:0268.0003 failed with error -38The rest of the steps won’t work and they’ll be somewhat silent in their failure. I was using
3.13.0-30-generic
on Ubuntu 14.04 (Trusty) when Andrew pointed out this problem in the comments. It is a known problem and I imagine it will get addressedin the next kernel updatesoon-ish. If you’re impatient, you may be able to roll back to an earlier version (but I’m not sure how far you’d have to go). You may even be able to choose a working earlier version from your boot menu. You could also upgrade to a newer version before it’s officially supported and distributed, if you’re comfortable doing that. I can confirm that3.13.11-03131104-generic
works, as mentioned in the Launchpad bug report.
UPDATE 2014-06-23 End — - Press the PlayStation button to enable it. The LEDs will continue to flash, but input will now register.
- Run xboxdrv.
sudo xboxdrv --detach-kernel-driver --led 2
You may require one or both ofsudo
and--detach-kernel-driver
above. If you get aLIBUSB_ERROR_ACCESS
error, you’ll have to use “sudo.” If you get aLIBUSB_ERROR_BUSY
error, you can try the--detach-kernel-driver
option. The--led 2
option sets the #1 LED to a solid light. Once you’re sure it’s working, and you don’t need all the inputs spamming the console, just add the--silent
option. - Play a game! I usually compile the Humble Bundle games and Metacritic scores into convenient lists; take a look! Might be useful. 🙂
Other Resources
- jscal can be used to remap buttons, but it’s a little unwieldy.
- jstest-gtk is an app you can use to test that the controller is working.
- xboxdrv home page
I’ve been unsuccessfully messing around with jscal to try to get this working, but your method works perfectly – thanks!!
For Fedora 18 or 19, just replace step 1 with:
yum install kernel-modules-extra (this gets you the required joydev kernel module)
yum –enablerepo=updates-testing install xboxdrv (currently in the Fedora 18 and 19 testing repos, but should be in main soon)
Reboot to use the new kernel module
Link the the Fedora package listing: https://admin.fedoraproject.org/updates/xboxdrv
Glad it was useful! I went down a similar path as you and wondered why I didn’t encounter this solution before… hence this article. 🙂
Thanks for the extra info!
thank you! works great. took me forever to find this to make it work.
Pingback: LinuxGameCast Weekly EP66 — Right Is Left | Linux Game Cast
I’m pretty new to linux, but I was doing good until the beggining of step 4, how do you run xboxdrv?
Hi Damian,
Just type the following in the terminal:
sudo xboxdrv --detach-kernel-driver
, and press Enter. Modified the step a little to make that more clear. 🙂ok i have a rather bizzare problem
I’ve followed all the steps with no problem and now the computer sees the controller normally (i use xubuntu 14.04). However even when the jstest sees both the axis and buttons, when i press them it nothing happens, it dosen’t repond. In other words I can see the controller but i can’t use it.
Hi brb521, I think you’ll have to provide more details on each of the commands and the output for anyone to be able to help you.
Here is more of the same issue on Stackoverflow. I have the same thing as brb521. Do you know anything about this?
Solidworks,
Check the comment below, and see if you get similar messages in your syslog. It could be a kernel issue, that can be resolved if you upgrade it or roll it back. I haven’t added any description of this in the main post yet. Will do later.
Nice. This has been far easier to work with than `sixaxis` and `jstest-gtk` was exactly what I was looking for. Perfect.
perfect… soooo easy
Perfect. It works fine for me under opensuse.
I can’t seem to get this running in steamOS…
I get “xboxdrv has no instalation candidate”
Then when i try to install the PPA i get “add-apt-repository: command not found”
Then when i try to install “python-software-propertoes” i get “E: Invalid operation python-software-properties. please help
Hi Michael,
If it said invalid operation, maybe you forgot the “install” before the package name?
I’m not running SteamOS, but it looks like it’s based on Debian Wheezy (stable 7.1), so that might help when looking for information. It looks like you first have to add Debian’s repository to your apt sources. Take a look here for more information, and let me know how it goes.
thanks!!
I just bought a ps3 controller the other day, and, well, it won’t hurt to also have it working under linux….
Hey man, love the emulator but my problem is, when I upgraded to 14.04 I keep getting this message when I start the emulator and the controller is pretty much useless then. The message goes xboxdrv 0.8.5 – http://pingus.seul.org/~grumbel/xboxdrv/
Copyright © 2008-2011 Ingo Ruhnke
Licensed under GNU GPL version 3 or later
This program comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it under certain
conditions; see the file COPYING for details.
Controller: PLAYSTATION(R)3 Controller
Vendor/Product: 054c:0268
USB Path: 003:006
Controller Type: Playstation 3 USB
Your Xbox/Xbox360 controller should now be available as:
/dev/input/js1
/dev/input/event10
Press Ctrl-c to quit, use ‘–silent’ to suppress the event output
I have tried restarting my computer to see if this works and nothing works. Help would be nice, thank you in advance
Hi Andrew,
In fact, I have the same problem, but haven’t used a controller since upgrading to 14.04. The output from syslog that indicates a problem:
[ 9422.173493] sony 0003:054C:0268.0003: can't set operational mode
[ 9422.188797] sony: probe of 0003:054C:0268.0003 failed with error -38
Looks like it’s a problem with the present version of the linux kernel (3.13.0-30-generic) included in 14.04. You can either wait for the next automatically distributed version, try an older version from you boot menu, or upgrade.
Hey Steven, to help our problem and for people who know nothing bout installing kernels on Linux, I have found the kernels we need to get the controllers working again, on top of that this video shows a tutorial on how to install it, if the problem ever arises again, I’ll keep a eye out to see what can fix it https://www.youtube.com/watch?v=rXC2C6FGeL0
Thanks for providing the helpful link, Andrew. 🙂
Hi there.
First off, thanks for posting this. When I had a Xubuntu operating system, this worked nearly flawlessly for me (the controller would for some reason occasionally turn off though).
My question now, however, concerns using this on Bodhi. I installed jstest and followed the instructions on here to install xboxdrv. The issue I’m having doesn’t revolve around either of them recognizing the PS3 or 360 controller. Both programs actually did recognize them.
The issue I’m having is that xboxdrv is treating it as if I’m holding down one of the buttons the entire time. For ZSNES this didn’t seem to be an issue, and it registered just fine. For Visualboy Advance, however, every time I pressed a button to assign to a spot, it’d appear in another, and then the next I’d press would be assigned to another, and so on. At first I thought it was an issue with just the 360 controller…but then I switched controllers and had an identical problem with the PS3 controller.
Looking at the teminal, I noticed this particular bit kept going on endlessly for both controllers:
X1:129 Y1:127 X2:130 Y2:129 du: 0 dd: 0 dl: 0 dr: 0 select:0 ps:0 start:0 L3:0 R3:0 /\:0 O:0 X: 0 [ ]: 0 L1: 0 R1: 0 L2: 0 R2: 0
Obviously I’m guessing those are the axises going nonstop or something of the like. Any tips on how I can fix this and get both controllers to function normally?
Hi Maxwell,
This is actually the expected behaviour, so it doesn’t appear as anything is wrong. The analog sticks have possible values of 0-255 for both X and Y axes, the center is a dead zone around 128. And in fact, on the Dual Shock 3 controller, almost all of the buttons are analog; try applying different pressures to a button and watch the values change. (Very few games ever used this.)
Pingback: Humble Indie Bundle 12 | Game Imps
Hey there,
I was wondering if you could help me, I’ve been struggling to get any controller to work properly (due to either drivers or controllers continually drifting to the left).
When I run ‘sudo xboxdrv –detach-kernel-driver’ it comes up with;
— [ ERROR ] ——————————————————
Error couldn’t claim the USB interface: LIBUSB_ERROR_NOT_FOUND
Try to run ‘rmmod xpad’ and then xboxdrv again or start xboxdrv with the option –detach-kernel-driver.
I have already unloaded and disabled xpad and I am running it with the –detach-kernel-driver option.
If I run with out the –detach-kernel-driver option I get;
— [ ERROR ] ——————————————————
Error couldn’t claim the USB interface: LIBUSB_ERROR_BUSY
Try to run ‘rmmod xpad’ and then xboxdrv again or start xboxdrv with the option –detach-kernel-driver.
Would steam be putting its own driver in the way maybe?
Thank you for your help so far!
Nevermind I figured it out when I said F it and went to remove all xbox related programs and it should both ubuntu-xboxdrv and xboxdrv installed.
I removed ubuntu-xboxdrv and it worked instantly!
Awesome! Your experience might help others. Thanks. 🙂
Im using a third party ps3 controller but it works fine on windows 7 with the normal methods of getting a standard dualshock 3 controller to work. But when I launch xboxdrv I get this message:
(precise)mracus@localhost:~$ sudo xboxdrv –detach-kernel-driver
[sudo] password for mracus:
xboxdrv 0.8.2 – http://pingus.seul.org/~grumbel/xboxdrv/
Copyright © 2008-2011 Ingo Ruhnke
Licensed under GNU GPL version 3 or later
This program comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it under certain
conditions; see the file COPYING for details.
Controller: PLAYSTATION(R)3 Controller
Vendor/Product: 054c:0268
USB Path: 001:007
Controller Type: Playstation 3 USB
libusb:warning [libusb_close] internal signalling read failed, closing anyway
libusb:error [do_close] Device handle closed while transfer was still being processed, but the device is still connected as far as we know
libusb:warning [do_close] A cancellation for an in-flight transfer hasn’t completed but closing the device handle
This methd works on 14.04 and 14.10 ubuntu 😀
need some help with this, I’m on linux mint 13.
So after the command : sudo xboxdrv –detach-kernel-driver
it just lists each axis and it changes when i press anything.
i go into the snes emulator zsnes and it doesn’t work, also the light on the ps3 is right as it is on controller one.
to add to the above i wasn’t very clear. Firsly when i run it with just the sudo i get the following:
Error couldn’t claim the USB interface: LIBUSB_ERROR_BUSY
Try to run ‘rmmod xpad’ and then xboxdrv again or start xboxdrv with the option –detach-kernel-driver.
Secondly, when I run rmmod xpad I get
rmmod: ERROR: Module xpad is not currently loaded
I’m giving up hope :@
yea this has happened to me everything seems top work fine but no game i have reads that the control is even existant
Hmm.. if it lists the axis and responds to change, it’s working. I’ve never used zsnes. But I have a feeling you don’t even need to use xboxdrv to use zsnes, just remap the buttons within it.
Try another program, as well. Maybe something on Steam, or another game. You could try jstest-gtk to test it, as well.
Can anyone help me get this working on puppy Linux? I have looked for days now and cannot get it to add repositories or recognize the controller at all. Any help is appreciated, even just a link to a “how to” page. I am pretty new to linux and am still getting my feet under me.
Hi Bob, different linux distributions have different package management systems. Looks like Puppy uses “.pet” files? There is always a way, (you can always compile from source) but I’d suggest either going to Puppy community forums or trying a more feature-full and common distribution as the easier routes. 🙂
Thanks, but the reason I am using puppy is that the hardware is over a decade old and won’t support a full featured distro. I tried lubuntu, but is would hang and freeze at random intervals.
Hi all,
I am trying to connect my ps3 controller Dualsock on my laptop. I am using a usb key bootable with linux mint 17.1. So when I run “sudo xboxdrv –detach-kernel-driver”, it’s detects my ps3 controller and indicate where it’s available. But when I run jstest-gtk it doesn’t work with my ps3 controller.
Please could you help me!
Did you press the PlayStation button? You have to do that with the PS3 controller before any input is registered.
Yes, I press the button but the LED doesn’t stop flashing. Do you know why?
Yes, they continue to flash. But the controller should work. To see LED options with xboxdrv, run
xboxdrv --help-led
. An example would besudo xboxdrv --detach-kernel-driver --led 2
to just light the #1 LED.First, Thank you Steven.
I run sudo xboxdrv –detach-kernel-driver –led 2 and the led continue to flash. If I run jstest-gtk it doesn’t see my controller.
Do you have any idea?
I would need a couple more details before I can begin to guess. What are the relevant lines in your /var/log/syslog when you plug in your ps3 controller, and which linux kernel are you using?
I found something and it’s work! Thanks for your help!
Pingback: Using a Gamepad on Linux | Game Imps
With kernel 3.17 the controller workes out of the box :), simply plug and play.
The first time I ran: dmesg | grep sony, I got something like
[ 1744.592459] sony 0003:054C:0268.000A: input,hiddev0,hidraw0: USB HID v1.11 Joystick [Sony PLAYSTATION(R)3 Controller] on usb-0000:00:06.0-1/input0
The hidraw here is Hidraw0 and my system has input from the controller and the game I played had input too. The other hidraw, hidraw1 was occupied with USB tablet(virtualbox).
Ever since I Shut down my system and rebooted, the hidraw changed to hidraw1 when i plugged in my controller
[ 1316.913893] sony 0003:054C:0268.0007: input,hiddev0,hidraw1: USB HID v1.11 Joystick [Sony PLAYSTATION(R)3 Controller] on usb-0000:00:06.0-2/input0
My system gets the controller input but the game doesn’t. The input comes from USB tablet(virtualbox) which when i checked is now on hidraw0.
I’ve searched a long time but didn’t find an answer to the question: can I force my controller on hidraw0? (Because i think that fixes it)
Game: Xwing vs Tie Fighter
System: Linux Ubuntu MATE running in Virtualbox(yes is got the game running, even played with the controller)
Yo! Thanks for this article! I was wondering how to use my PS3 controller in Linux, as Motioninjoy didn’t work so well for me. Lots of kudos to you, man!
So, yeah, 2016 outdoor and I don’t have any kind of hope that someone is there to actually help!
I use a Fake DS3 controller. Pain in arse to set up on Windows, tho did it much quicker here on Ubuntu 16.04 LTS.
The issue was with the axis maps: LS is perfect, HorRS was mounted to VerRS, VerRS was mounted to the RT, RT was mounted to LT and LT was just not there (I believe value got stuck somewhere under the comprehensive limit for game).
To solve this problem, I, of course, used jscal and successfully configured everything to its place.
The problem is that somehow RT is stuck to the HorRS and their values are being added to each other. RT itself (as axis) isn’t alive.
Ideas?
actually even PlayStation compatible wheel works with xboxdriver out of box..long time from 2014..up to now..on Ubuntu (that is not important part) important part is that driver is generic and many devices,many brands can work with it,being represent as that!
not only game-pads,also wheel,and just to say even force feedback works..
before(years) i was in need to use jostick-gtk but after this i do not need to.. and still working under ubuntu 16.04 LTS,and steam games..
uname -r
4.8.0-30-generic
dmesg | grep sony
[236454.758203] sony 0003:054C:0268.0003: input,hiddev0,hidraw2: USB HID v1.10 Joystick [GASIA CORP. PLAYSTATION(R)3 Controller] on usb-0000:00:16.0-1/input0
note that this wheel is not from sony! or from microsoft!,neither from Gasia! its just with driver represented to be,so can work..trick what many “makers” ,and “brands” use for comp-ability..
and gamepads ,even cheapest one can works same as that are microsoft xbox usb orginal…(lol) ,as time pass thing start to work out of box,as more and more drivers are in linux kernel,but still some we can add when we need them to use..
bottom line ,u do not need to upgrade to newest ubuntu(LTS) release to use newest kernel! even u do not need to upgrade neither update if you add it manually.. so choose for yourself what route you will go! …and if you want that somebody do it for you there is paid annual subscription for tuned kernels (not generic) with inside exactly what you need for starting price of two beers(annual 1:1 support).. so no excuse that something not work…well i still not use it..but good to know it exist.
Using this on openSUSE Leap 42.2., the configuration of the DS3 is now correct when it ws completely fucked before, however games still confuse Select and Quadrat.
Hi there, I followed all your steps, and I have the controller responding in Linux itself, but as soon as I go into a game (minecraft) there is no response from the controller.
I’m on Mint 18.
man, minecraft by deafult don’t using gamepad XD
I cant get this to work. It just says ‘No Xbox or Xbox360 controller found’ but everything else seems fine.
HI,
I am using Mageia 6 which uses RPM packages and the commands posted here do not work. Can this even be installed on a Mageia system?
Hi anyone else have their desktop flip upside-down after pressing the PS button? Any ideas on how to fix this
Thanks!
Just bought Super Meat Boy on Steam and my borrowed PS3 controller works perfectly. XUbuntu 18.04. Holy Cow, what a game that is.
I’ve got to play some more. 🙂
Thanks. It works perfectly on Xubuntu-amd64
How can I make this work on Fedora 32?