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
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