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:
- Install the
xboxdrvpackage. 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/syslogfile (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 —
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 -38
The rest of the steps won’t work and they’ll be somewhat silent in their failure. I was using
3.13.0-30-genericon Ubuntu 14.04 (Trusty) when Andrew pointed out this problem in the comments. It is a known problem and I imagine it will get addressed
in 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 that
3.13.11-03131104-genericworks, 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 of
--detach-kernel-driverabove. If you get a
LIBUSB_ERROR_ACCESSerror, you’ll have to use “sudo.” If you get a
LIBUSB_ERROR_BUSYerror, you can try the
--led 2option 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
- Play a game! I usually compile the Humble Bundle games and Metacritic scores into convenient lists; take a look! Might be useful.
- 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