Before starting, let me tell you the short answer:
If the controller is listed in /dev/input/event* when you plug it in, then you can make it work. The downside? If none of the configurations below work out of the box, then you will have to work a little bit by yourself.
Now lets get back to business.
You only need xboxdrv installed. So make sure you can run "xboxdrv --help" from the command line before starting. Is it installed? Good, go ahead:
To use any joystick you need to run the following command before starting the game. Yes, it's that simple.
sudo xboxdrv -c xboxdrv.config
And xboxdrive.config is a text configuration file that depends on your specific configuration (it describes your joystick). Keep reading to find the one that works for you. This is the hardest part.
PS3 Sixaxis - USB
This is the easiest to make it work. The config file only corrects some axis. Put this in your xboxdrive.config and you are ready to play.
[axismap] -DPAD_Y=DPAD_X -DPAD_X=DPAD_Y [buttonmap] [device-name] [device-usbid] [evdev-absmap] [evdev-keymap] [modifier] [relative-axis] [ui-axismap] [ui-buttonmap] [xboxdrv] mimic-xpad = true silent = true detach-kernel-driver = true [xboxdrv-daemon]
PS3 Sixaxis - Bluetooth (wireless)
Now you need to pay attention:
- Run this: ls /dev/input/event*
- Install "qtsixa" and make sure your joystick is connected to your PC through USB to pair it
- Now make sure sixad service is correctly running. It won't work if it failed to start. Check /var/log/sixad for error messages
- Start qtsixa and configure your joystick for the first time.
- Make sure your joystick is now working with qtsixa before the next step <It will work as a regular joystick. Google for instructions on how to use qtsixa if you need help here>
- Run this AGAIN: ls /dev/input/event*
- There must be a new eventX. Put that eventX in the following configuration
- Create xboxdrv.config with this:
[axismap] -Y1=Y1 -Y2=Y2 -DPAD_Y=DPAD_X -DPAD_X=DPAD_Y [buttonmap] [device-name] [device-usbid] [evdev-absmap] [evdev-keymap] [modifier] [relative-axis] [ui-axismap] [ui-buttonmap] [evdev-absmap] ABS_X=x1 ABS_Y=y1 ABS_Z=x2 ABS_RX=y2 ABS_#12=lt ABS_#13=rt [evdev-keymap] BTN_TOP=start BTN_TOP2=start BTN_TRIGGER=y BTN_THUMB2=tr BTN_THUMB=tl BTN_BASE5=lb BTN_BASE6=rb KEY_#302=a KEY_#301=b BTN_DEAD=x KEY_#300=y BTN_TRIGGER=back BTN_A=guide BTN_TOP=start BTN_TOP2=du BTN_PINKIE=dr BTN_BASE=dd BTN_BASE2=dl [xboxdrv] evdev=/dev/input/event15 evdev-debug=false mimic-xpad=true mimic-xpad-wireless=false silent=true detach-kernel-driver=true dpad-as-button=false [calibration] RT=0:127:255 LT=0:127:255 [xboxdrv-daemon]
USB Generic PS2 chinese controller
Make sure to replace evdev with the correct input device. Disconnect your controller, run ls /dev/input/event* connect your controller, run ls /dev/input/event* again and replace the device in the following configuration:
[axismap] -Y1=Y1 -Y2=Y2 -DPAD_Y=DPAD_Y -DPAD_X=DPAD_X [buttonmap] [device-name] [device-usbid] [evdev-absmap] ABS_X=x1 ABS_Y=y1 ABS_RX=x2 ABS_RZ=y2 ABS_HAT0X=dpad_y ABS_HAT0Y=dpad_x [evdev-keymap] BTN_TOP=x BTN_TRIGGER=y BTN_THUMB2=a BTN_THUMB=b BTN_BASE3=back BTN_BASE4=start BTN_BASE=lb BTN_BASE2=rb BTN_TOP2=lt BTN_PINKIE=rt BTN_BASE5=tl BTN_BASE6=tr [modifier] [relative-axis] [ui-axismap] [ui-buttonmap] [xboxdrv] evdev = /dev/input/event15 evdev-debug = false mimic-xpad = true silent = true [xboxdrv-daemon]
Known issues:
- The chinese controller sent 20 keypresses for each time I pressed A
- Only the joystick works for moving left-right in the main start menu. Dpad only works up and down. (the game doesn't need left and right in any configuration)
Troubleshooting:
If you can't make qtsixa work, then you will have to google the problem. This troubleshooting is a quick guide to help you configure xboxdrv
To configure a different joystick, or maybe fix some configuration, your best bet is to set evdev-debug to true and press the button you need to configure while looking at the output of xboxdrv. You will see lots of messages regarding the controller position, because this is also a sensor, but ignore all the messages you don't need, and try to focus on the message that shows your key:
This is an example:
EV_KEY BTN_BASE 1 <<<----- I pressed the down button EV_ABS ABS_RY -504 EV_ABS ABS_RZ 499 EV_ABS ABS_THROTTLE 407 EV_ABS ABS_BRAKE 97 EV_ABS ABS_RY -506 EV_ABS ABS_RZ 487 EV_ABS ABS_THROTTLE 399 EV_ABS ABS_BRAKE 137 EV_ABS ABS_RY -512 EV_ABS ABS_THROTTLE 397 EV_ABS ABS_BRAKE 150 EV_ABS ABS_RZ 489 EV_ABS ABS_RZ 490 EV_ABS ABS_BRAKE 119 EV_ABS ABS_RZ 489 EV_ABS ABS_THROTTLE 395 EV_ABS ABS_BRAKE 69 EV_KEY BTN_BASE 0 <<<----- I released the down button EV_ABS ABS_THROTTLE 397 EV_ABS ABS_BRAKE 0
There are a lot of messages you have to ignore, but now you know what is the button you have to use for the down D-Pad button (it's just an example). Use the information you obtain here to complete your custom configuration.
Notes:
- Sometimes you will see some events like ABS_BRAKE that go from 0 to 512 or so and then go back to 0 when you release a key (just like the joystick). This is because the PS3 joystick reports how much you are pressing it (nice!). You can use this, or ignore it, depending on what you want to do.
- mimic-xpad-wireless and dpad-as-button options break everything. ie: 1)the dpad doesn't work, or2) the a-b-x-y buttons don't work when you enable them. But you can also use them to try to make your particular joystick work
Good luck!