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

[update]

Meanwhile I have validated these instructions on a different machine, testing it on a desktop PC running openSuSE 42.2.  Everything worked as expected and I was able to remap the keys of my PS3 controller with QJoyPad in order to ‘translate’ the PS3 input to keyboard commands.

The instructions above also worked on Raspbian/Pi2 with an updated version of Retropie (3.7 -> 3.8, as well as 3.8 -> 4.1 ). Many users reported problems with the internal Pi3 bluetooth device. It appears to be fixed on Raspbian, but other distributions may still fail. In any case you have to make sure that your system is up-to-date (sudo apt-get update && apt-get upgrade).

In case that you follow the discussion thread on the RetroPie forum, you probably have read, that there are some issues with other brands of PS3 controllers. The instructions above do not work for SZMY-POWER PS3 clones. However, these controllers seem to work with the sixaxis-sixad daemon.

[Troubleshooting]

I receive a lot of messages from users, telling me that the instructions above do not work and their PS3 controllers do not pair. As I’ve been in touch with many users (see discussion below), most problems are related to previous pairing attempts using the RetroPie configuration script.

Therefore, I strongly recommend to start from scratch, i.e. to work on a freshly installed Raspbian image. Follow the guide above to install blueZ, then install Retropie using the RetroPie setup script. However, do not use the setup script to pair your PS3 controller! Retropie makes use of the sixaxis-sixad daemon. Be aware that sixad and blueZ cannot not run at the same time!

Please include console output of the step you got stuck with, otherwise troubleshooting will be difficult.

[Debugging]

For debugging you should collect as much information as possible about your controller. Run ‘hcidump -x’ and press the PS3 button on your controller. With a Shanwan controller, I can see the following output (when pairing was successful):

HCI sniffer - Bluetooth packet analyzer ver 5.41
device: hci0 snap_len: 1500 filter: 0xffffffff
> HCI Event: Connect Request (0x04) plen 10
 bdaddr 01:B6:52:85:63:25 class 0x000540 type ACL
> HCI Event: Command Status (0x0f) plen 4
 Accept Connection Request (0x01|0x0009) status 0x00 ncmd 1
> HCI Event: Connect Complete (0x03) plen 11
 status 0x00 handle 11 bdaddr 01:B6:52:85:63:25 type ACL encrypt 0x00
> HCI Event: Command Status (0x0f) plen 4
 Read Remote Supported Features (0x01|0x001b) status 0x00 ncmd 1
> HCI Event: Read Remote Supported Features (0x0b) plen 11
 status 0x00 handle 11
 Features: 0xff 0xff 0x8d 0x7a 0x98 0x1f 0x78 0x83
> HCI Event: Command Status (0x0f) plen 4
 Read Remote Extended Features (0x01|0x001c) status 0x00 ncmd 1
> HCI Event: Read Remote Extended Features (0x23) plen 13
 status 0x00 handle 11 page 1 max 1
 Features: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
> HCI Event: Command Status (0x0f) plen 4
 Remote Name Request (0x01|0x0019) status 0x00 ncmd 1
> HCI Event: Remote Name Req Complete (0x07) plen 255
 status 0x00 bdaddr 01:B6:52:85:63:25 name 'PLAYSTATION(R)3Conteroller-PANHAI'
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.