Setting up PS3 controllers on Retropie (Gasia/ Shanwan clones)

Then, check whether your bluetooth.service  is up and running. Also check the bluetooth daemon version (5.44), that should now match the blueZ release which you have downloaded  and compiled:

 Loaded: loaded (/lib/systemd/system/bluetooth.service; enabled)
 Active: active (running) since Sun 2017-03-05 19:18:36 CET; 2 days ago
 Docs: man:bluetoothd(8)
 Main PID: 481 (bluetoothd)
 Status: "Running"
 CGroup: /system.slice/bluetooth.service
 └─481 /usr/libexec/bluetooth/bluetoothd

Mar 05 19:18:36 raspi5 bluetoothd[481]: Bluetooth daemon 5.44
Mar 05 19:18:36 raspi5 systemd[1]: Started Bluetooth service.
Mar 05 19:18:36 raspi5 bluetoothd[481]: Starting SDP server
Mar 05 19:18:37 raspi5 bluetoothd[481]: Bluetooth management interface 1.10 initialized

In case that it shows version 5.23, reboot the system and check it again. If it still shows the wrong version, you must change your

--prefix=/usr

./configure option to the installation path of your distribution’s bluez package.

It is important to check, whether your bluetooth dongle or build-in bluetooth (Pi3)  is visible and pair-able for other BT devices. ‘hciconfig’ should result in ‘UP RUNNING PSCAN ISCAN’ as shown below:

sudo hciconfig
hci0: Type: Primary Bus: USB
 BD Address: 00:1B:10:00:2A:EC ACL MTU: 1017:8 SCO MTU: 64:1
 UP RUNNING PSCAN ISCAN
 RX bytes:591 acl:0 sco:0 events:36 errors:0
 TX bytes:2795 acl:0 sco:0 commands:36 errors:0

In case that your bluetooth dongle is DOWN or powered OFF, enable it using the command:

sudo hciconfig hci0 up piscan

Step 5:

Download and compile QtSixA.

[Update: 2017-01-07]

Meanwhile, I received some user feedback concerning errors occurring during the compilation of QtSixA-1.5.1 (comments by phody: see discussion below).  For successful compilation from source, make sure to have the following packages installed:

sudo apt-get install pyqt4-dev-tools qt4-designer libjack-dev

Then, download, extract, change into the QtSixA-1.5.1 folder, patch and compile qtsixa:

wget http://downloads.sourceforge.net/project/qtsixa/QtSixA{c7f7cb1468c0d02af358b3ce02b96b7aadc0ce32ccb53258bc8958c0e25c05c4}201.5.1/QtSixA-1.5.1-src.tar.gz
tar xvfz QtSixA-1.5.1-src.tar.gz
cd QtSixA-1.5.1
wget https://launchpadlibrarian.net/112709848/compilation_sid.patch
patch -p1 < compilation_sid.patch
make

Note that you’ll only need the ‘sixpair’ program, which is located in the ‘QtSixA-1.5.1/utils/bins’ folder. If you want to make it available for all users, ‘chmod 755 sixpair’ and move it to the /usr/local/bin directory.

Step 6:
In order to pair the controller, connect it to your Pi using an USB cable. Wait for a few seconds until it is recognized as an input device (check with “dmesg”). You should be able to see something like this:

[11658.272017] usb 4-1: new full-speed USB device number 3 using uhci_hcd
[11658.454057] usb 4-1: New USB device found, idVendor=054c, idProduct=0268
[11658.454061] usb 4-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[11658.454064] usb 4-1: Product: PS(R) Ga`epad
[11658.454066] usb 4-1: Manufacturer: ShanWan
[11662.009025] input: ShanWan PS(R) Ga`epad as /devices/pci0000:00/0000:00:1d.1/usb4/4-1/4-1:1.0/0003:054C:0268.0005/input/input23
[11662.009613] sony 0003:054C:0268.0005: input,hiddev0,hidraw2: USB HID v1.10 Joystick [ShanWan PS(R) Ga`epad] on usb-0000:00:1d.1-1/input0

Subscribe
Notify of
117 Comments
Inline Feedbacks
View all comments
ryan groth
7 years ago

For the sake of google searchers everywhere. I picked up a “FiveStar” PS3 clone controller pair for $20 on Amazon. They recognize as gaisa controllers on an RP3. I could not get the native bluetooth stack to recognize the controller OR the retropie default sixaxis driver to recognize the controller. A combination of luetzel’s bluetooth build and supertypo’s qtsixa github repo were the trick. A couple of notes though– I removed bluez native which removes bluetooth-pi3, you have to install THIS bluez package from “make install”, then reinstall package bluetooth-pi3. Remove any old sixaxis and install sypertypo’s version sixaxis and… Read more »

Daniele
7 years ago

Hi Martin,
Thank you really much, at the end I finally got my ps3 controller paired with internal RPI 3 bluetooth!
After the installation of sixpair I always got:
pi@retropie:~/QtSixA-1.5.1/utils/bins $ sudo ./sixpair
Current Bluetooth master: aa:aa:aa:aa:aa:aa
Setting master bd_addr to aa:aa:aa:aa:aa:aa

Rebooting rpi everything worked at the first try!
Thank you again
Daniele

7 years ago
Reply to  Daniele

Would you kindly explain how you managed to overcome the invalid MAC issue?

With Jessie running fresh on an Rpi3, I installed RetroPie and Kodi, dropped to a shell, pulled the patched BlueZ and QtSixA sources, and compiled. My Gasia controller paired just fine and passed a jstest with flying colors, but my integrated Bluetooth started spitting out a MAC of AA:AA:AA:AA:AA:AA following a reboot D=

7 years ago
Reply to  Daniele

Would you kindly explain how you managed to overcome the invalid MAC issue?

With Jessie running fresh on an Rpi3, I installed RetroPie and Kodi, dropped to a shell, pulled the patched BlueZ and QtSixA sources, and compiled. My Gasia controller paired just fine and passed a jstest with flying colors, but my integrated Bluetooth started spitting out a MAC of AA:AA:AA:AA:AA:AA following a reboot and won’t snap out of it D=

Crescendo
7 years ago

I refine my approach.
Using Luetzels’ patched Bluez, the sixad can share control with Bluez (tested using bt mouse while PS3 Shanwan connected, in Raspbian desktop).

No more need of sixad –boot-no or –stop after using retropie, just install this patched Bluez, then Shanwan sixad, reboot, then its working like a boss..

Yes, without this patched Bluez, it can’t share control with sixad.

Thanks so much Luetzels….

Crescendo
7 years ago
Reply to  luetzel

You’re welcome…
If you use non-patched bluez, the bluetooth adapter is not even recognizable by bluetoothctl if you got sixad installed (you can’t even type anything into bluetoothctl prompt).

However, if you install patched bluez (overwriting default raspbian bluez – do not uninstall it first, just overwrite), then sixad. All is normal, no timeout, no problem whatsoever. It just like there’s no sixad installed but controller now can pair normally (patched bluez without sixad won’t do).

daniele
7 years ago

Thank you very much for your great job! I’m following your steps on raspberry pi3 with a fresh RetroPie 4 and shanwan ps3 controllers. I get stuck in step 4: after compile and installation of bluez from your repo, when I try to restart bluetooth service I get the messagge: pi@retropie:~ $ sudo service bluetooth restart Failed to restart bluetooth.service: Unit bluetooth.service is masked. To be sure I’ve reboot my raspberry. Going on with your step, whit hciconfig I don’t get any result (internal rpi3 bluetooth is not showed). So I disable the internal rpi3 bluetooth (adding the line “dtoverlay=pi3-disable-bt”… Read more »

daniele
7 years ago
Reply to  daniele

just noticied:
pi@retropie:~ $ sudo hciconfig hci0 up pscan iscan
pi@retropie:~ $ hciconfig
hci0: Type: Primary Bus: USB
BD Address: 00:02:72:CF:9E:29 ACL MTU: 1022:8 SCO MTU: 121:3
UP RUNNING ISCAN
RX bytes:1052 acl:0 sco:0 events:51 errors:0
TX bytes:698 acl:0 sco:0 commands:51 errors:0

but I’m still missing pscan…

Thank you
Daniele

Daniele
7 years ago
Reply to  luetzel

Hi Martin,

thank you very much for your answer, I will try this evening!
Just another question for you about “It is highly recommended to purge/uninstall your distributions bluez package prior to the installation of patched bluez in order to avoid version conflicts.”
I did “sudo apt-get remove bluez”, but this commands also remove bluetooth and pi-bluetooth package (they depend on bluez). Is it ok to remove also bluetooth and pi-bluetooth?

Crescendo
7 years ago

I paste the terminal output to pastebin for easier reading….

http://pastebin.com/WjbmtphX

Crescendo
7 years ago
Reply to  luetzel

Hi, yes I already trust it in bluetoothctl.

I use Shanwan controller & your Bluez.

I’ll post the dmesg tomorrow morning as I’m trying with clean RetroPie image now.

Thank you so much for helping.

Crescendo
7 years ago
Reply to  Crescendo

I tried something different that completely solved the issue.
1. Did all your steps above.
2. Install sixad for shanwan via retropie-setup.
3. Disable sidxad on boot using cmd: sixad –boot-no.
4. Create script: sixad –start; emulationstation; sixad –stop;.
5. That solved the issue, bluetooth still OK in Raspbian desktop coz its only activated when using RetroPie.

Strangely, if I didn’t use your patched bluez, the installation of sixad disables the bluez even though its stopped.

Crescendo
7 years ago

After doing everything exactly described in this post, I still can’t make the controller to connect to RPi3, not even on clean Raspbian install (latest + rpi-update). Could you please shed some light to my problem? This is the terminal output of mine: pi@CF-RPi3:~ $ sudo bluetoothctl [NEW] Controller B8:27:EB:E3:D4:48 CF-RPi3 [default] [NEW] Device 03:81:98:A1:63:25 PLAYSTATION(R)3 Controller [NEW] Device 03:8C:85:9D:63:25 PLAYSTATION(R)3 Controller [bluetooth]# agent on Agent registered [bluetooth]# default-agent Default agent request successful [bluetooth]# pairable on Changing pairable on succeeded [bluetooth]# discoverable on Changing discoverable on succeeded [CHG] Device 03:81:98:A1:63:25 Connected: yes [CHG] Device 03:81:98:A1:63:25 Connected: no [bluetooth]# exit Agent… Read more »

Thomas Messmer
7 years ago

I had also a lot of problems to get Gasia and Shanwan Controllers to work.
No solution I found worked. But now I found a realy simple way to get them working.

Have a look at this page where I described the very simple solution which was the only one which worked for me!!
http://thomas-messmer.com/index.php/howtos/67-retropie-controller-pairing-problems

Hopefully It will work for others too.

subs
7 years ago

Hey just to say on a fresh 4.0.2 retropie, i had to :

sudo apt-get install libreadline-gplv2-dev libical-dev libjack-dev libusb-dev

+ it ain’t working for my GAsia controller. No wonder, the sixaxis plugin patches just handle shanwans

Nicky
7 years ago

Hi Martin, I can’t seem to get my controller connected. Connected to USB it says “SHANWAN”, connected over bluetooth it says “PLAYSTATION(R)3Conteroller-PANHAI” It seems like the bluetooth authentication process is not being handled correctly. I’m not familiar enough with bluetooth to know, but could the misspelled name do any wrong? Or could it be something with the “PANHAI’ type bluetooth controller is sending bytes in a different order than expected (cfr : https://github.com/nefarius/ScpToolkit/issues/241) When I try to pair the device with my PS3, it seems to work fine. Log of trying to connect : pi@retropie:~/qtsixa-1.5.0/utils/bins $ sudo bluetoothctl [NEW] Controller… Read more »

Nicky
7 years ago
Reply to  luetzel

Hi Martin, Thanks for the quick reply. I’m using the Retropie 4.0 (Raspbian Jessie). I thought I disabled Sixad, but apparently it was still starting as a service and taking over control over the bluetooth ( I think even if the Sixad is setup to not startup at boot, I think Retropie is starting it when it was installed with the Retropie setup script) Anyhow the first times I tried to connect, I had Sixad disabled for sure (stopped the service manually) and checked the bluetooth status like described in your guide. Maybe it was because I didn’t do a… Read more »

Hjalte
7 years ago

Hi again, purged bluez* and had a rerun with the 5.41 version – successfully connected to both controllers simultaneously in the first try, mapped beautifully to /dev/input/js0 & js1. However, after a short while the connection is lost, and I think bluetoothctl is getting confused as to what is connected and what is not, and I can’t reconnect. (btw had to force ISCAN with $hciconfig hci0 piscan). Will give it a go on the raspberry as soon as possible.