How to connect Dualshock 3 controller (PS3 Sixaxis Gamepad) on Ubuntu 16.04?

Since the last officially supported version is "vivid"(Ubuntu 15.04) from QtSixA PPA and don't work for Ubuntu Xenial (16.04).


Solution 1:

On Ubuntu 16.04 - Xenial (maybe work on above)

Note: Don't work for PS3 Gasia / Shanwan game controllers (China/fake PS3 controllers) -- I tested only with a Shanwan controller!

Install from source

Since the last officially supported version is "vivid"(Ubuntu 15.04) from QtSixA PPA and don't work for Xenial (16.04). So we need compile from the only repo that works (and has updated) and allow to connect two controllers at the same time was the fork of RetroPie:

sudo apt-get install dialog build-essential pyqt4-dev-tools libusb-dev libbluetooth-dev python-dbus -y
wget https://github.com/RetroPie/sixad/archive/master.zip -O sixad-master.zip
unzip sixad-master.zip
cd sixad-master
make
sudo make install

Configuring

1.) First make sure you have Bluetooth on your computer.

2.) Plug in the controller via USB first to do the initial pairing. Run the sixpair command:

sudo sixpair

Sample of output when successful pair:

Current Bluetooth master: XX:XX:XX:XX:XX:XX
Setting master bd_addr to XX:XX:XX:XX:XX:XX

XX:XX:XX:XX:XX:XX is the MAC of your Bluetooth device.

3.) Unplug the controller and run:

sudo sixad -s

This starts the sixad daemon which waits for incoming PS3 controller connections. sixad will completely take over the Bluetooth adapter (exclusive control, so no other Bluetooth devices other than PS3 controllers will work after you start sixad).

4.) Press the ps3 button on your PS3 controller and wait for 2-3 seconds. You'll feel the controller vibrate when it successfully connects.

Sample of output when successful connected:

[ ok ] Starting bluetooth (via systemctl): bluetooth.service.
sixad-bin[23052]: started
sixad-bin[23052]: sixad started, press the PS button now
Watching... (5s)
sixad-sixaxis[23069]: started
sixad-sixaxis[23069]: Connected 'PLAYSTATION(R)3 Controller (**XX:XX:XX:XX:XX:XX**)' [Battery 05]

To turn off sixad and disable control: Just press CTRL+C

Test the functionality [Optional]

You can test the functionality of your controller through Jstest-gtk (install: sudo apt-get install jstest-gtk)

Disable sixad service [Optional]

Warning: sixad will completely take over the Bluetooth adapter (exclusive control, so no other Bluetooth devices other than PS3 controllers will work after you start sixad).

sudo update-rc.d sixad disable
sudo service sixad stop

References:

https://askubuntu.com/a/834907/139248
https://retropie.org.uk/forum/topic/2913/guide-use-qtsixa-on-ubuntu-16-04-and-derivatives