[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'
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 »
Hi Ryan,
thank you for adding this piece of valuable information. Can you provide the output of ‘hcidump -x’ for your controller? Might be useful for other users.
Thanks,
Martin
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
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=
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=
Hi Brian,
a MAC address of AA:AA:AA:AA:AA:AA indicates firmware issues for your BT dongle. As described in the post, 1.) make sure that kernel-/ bluez-firmware packages are installed and 2.) in the right path. You may have to create a symbolic link to your firmware directory because its location depends on your Linux distribution.
Cheers,
Martin
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….
Thanks for your feedback. It may help other users. Seems that the order of events matters here. When I started non-patched bluez
first, then sixad, pairing of the controller worked. However, my keyboard went into power saving state, lost its connection and
did not pair again. Did you get any timeouts? I’d rather prefer to use solely bluez for pairing of PS3 and other BT devices.
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).
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 »
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
Hi Daniele,
‘sudo hciconfig hci0 up piscan’ should do the trick. I have modified the instructions above accordingly. And yes, you should be able to use the internal Pi3’s BT
device. I successfully paired my controllers on a Pi3 running OSMC.
Best regards, Martin.
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?
It depends what you want to achieve. Installation of patched bluez should overwrite the binaries which are pre-installed on the Raspbian distribution. However, you should be aware, that ‘sudo apt-get update && sudo apt-get upgrade’ may overwrite your patched bluez, as soon as a new .deb package is released. Thus, each time it is updated, you have to re-install the patched version. Therefore you should keep the patched bluez source code on your Raspberry. If you don’t want to re-install bluez every time, you could either remove/ purge all bluez packages prior to installation of patched bluez, or you could… Read more »
I paste the terminal output to pastebin for easier reading….
http://pastebin.com/WjbmtphX
Howdy, it seem that all of you have different kinds of problems with the setup of your controllers. Did you try the ‘trust’
command in bluetoothctl?
What is your controller type Gasia or ShanWan? Your log displays: “Sep 10 09:55:11 CF-RPi3 bluetoothd[8196]: Refusing input device
connect: No such file or direc…(2)”, but I have no clue which file it could be. What is the output when you
run sixpair and your controller is attached via USB? Please provide the output of ‘dmesg’ as well.
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.
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.
Glad to hear that it works for you now. Both blueZ version do interfere with each other. When I first tried to pair my
PS3 controller, I started blueZ first (without patches) to pair my BT keyboard and mouse. Then I started sixad,
which terminates blueZ, but allows pairing of PS3 clones. However, when I did’t keep connections alive, i.e. hitting
some keys, the connection to the keyboard was lost and it did not pair again. blueZ and sixad cannot share/ control
the BT dongle at the same time.
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 »
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.
Hi Thomas, of course it is possible to use the procedure you describe in your tutorial. This
has been possible for a while on Retropie 3.x. However, a major drawback is, that pairing with
sixad is suitable as long as you do not want to pair other BT devices, such as keyboards or mice.
sixad takes control over BT, so that it is not possible to pair other devices using blueZ.
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
Thank you for the feedback! I do not own a Gasia controller. However, according to the comment of commit 2b71496f3585dd78faf7617c7f2896cc84ac8ba9 at OpenELEC.tv patches are described with: “Add back the Shanwan and Gasia bt patches, while keeping the DS3 autotrust patch”.
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 »
Hi Nicky, there seem to be many variants of PS3 clones around. Therefore, it is quite difficult to troubleshoot your pairing problem. Not all PS3 clones are covered by bluez patches, yet. To make them work under Linux requires some reverse engineering, i.e. analysis of the communication/traffic between controller and BT dongle. So far, only few controllers were donated to the bluez developers for that purpose. Did you follow the walkthrough of my blog post? And on what distribution you are trying to pair? If you have installed the patched bluez, make sure that sixaxis/sixad is not running at the… Read more »
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 »
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.
Hej Hjalte,
sounds promising. I have heard about connection loss issues before. Could be related to
power saving of the bluetooth dongle. You can probably find some options for a bt.conf in /etc/modules/ to avoid power saving. I haven’t had such problems under Raspbian, for both Pi2 and Pi3.
Hilsen Martin