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
Hi.
Thanks a lot for the detailed walkthrough, i’ve followed every step. I’ve purchased a ‘golden ps3 controller’ on eBay, it shows up in dmesg as: “input: SHANWAN PS3 GamePad as /devices/pci0000:00/0000:00:1d.0/usb2/2-2/2-2:1.0/0003:054C:0268.001C/input/input44”. bluetoothctl can see the BT MAC addr, but for the life of me i can’t make it pair/connect. I rumbles constantly when plugged into USB. sixpair shows to lines: current and setting bt addr, both being written as my usb bt dongle mac. Any tips on what I could try or some output I could post here to help you help me. Thanks a lot in advance
Hej Hjalte, on what distribution did you try to pair your controller? (usually it works best on Raspbian) There can be many reasons why a controller does not pair (could be related to dongle, firmware, dongle not in scan mode, or distribution). The driver for the Shanwan clones does not support all features. It is normal that it does not stop to rumble, even when it is connected via USB. Make sure that you run all commands with root privileges. sudo ./sixpair should report two HW adresses, one is your dongle, the other one is your PS3 controller. Also make… Read more »
Hej igen! Thanks a lot for your quick reply. For testing purposes I’m on my laptop with lubuntu (16.04 LTS 4.4.0-34-generic). BT dongle is: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode). I have been testing both with sixad for Shanwan and the patched bluez you provide. I’ve had one controller (out of two) connected once with bluetoothctl by running $connect “bt addr”. After the one successfull bt connection the name changed to [NEW] Device 04:43:6D:A5:63:25 PLAYSTATION(R)3Conteroller-PANHAI (yes with a spelling mistake in controller). Sometimes when i try sixad it hangs at: sixad-bin[2943]: One event received sixad-bin[2943]: unable… Read more »
Oh, and the extra “usb_control_msg returned: 8” is just me adding a printf to sixpair.c to check the return value during pairing.
Hej Hjalte, at the moment I don’t have access to my main developer machine. As I wrote in my blog post, I did not continue using sixad, because it interferes with bluez, so that it is impossible to use ‘regular’ input devices such as mice or keyboards. Debugging options for the pairing process are limited, however it might be possible to force bluez to be more verbose: IMHO bluez can be switched into “debug mode” either in /etc/bluetooth or by using the debug flag for ./configure –enable-debug (I cannot test this at the moment, I have only a slow netbook… Read more »
Thanks a lot again, hope you had fun here in DK 🙂 bluez version did indeed check out to 5.40, thanks for the tip. I tried enabling debugging, so far dmesg give me some timeouts on Bluetooth: hci0 command 0x0408 tx timeout (also on 0x0405 and 0x0409 occasionally). Furthermore service bluetooth status gives me the following errors when trying to pair and connect: bluetoothd[1968]: sixaxis: compatible device connected: PLAYSTATION(R)3 Controller (054C:0268) bluetoothd[1968]: Can’t get HIDP connection info bluetoothd[1968]: connect error: Connection refused (111). hciconfig gives UP RUNNING PSCAN, but not the ISCAN you have in the tutorial output. Can’t do… Read more »
I would suggest to purge the lubuntu package and to reinstall the patched bluez in order to avoid version conflicts. It seems that your controller is paired, but doesn’t connect. This could be related to settings within some of the /etc/bluetooth/*.conf files. If the path was correctly set with ‘./configure –prefix=/‘, the distribution’s *.conf files are replaced with files from patched bluez.
On latest Raspbian with Retropie 4.0, the patched bluez works fine, therefore I think that it might be related to your distribution.
Thanks a lot for your work. Got my shanwan clone paired on pi3 with internal bluetooth. Now got it paired on gentoo system with usb-bt.
In both cases it did not work out of the box. sixpair was always ok, but no bt-pairing.
I only got it working after running sixad (killing bluetooth) and qtsixa.
gentoo wiki says clones not working, but they do with your bluez.
Martin,
Your guides seem to be the most thorough explanation of these issues. I’ve tried to follow your instructions to the T, including redoing a Pi3 with retropie, bluez, QtSixA. I can get SixPair to give me a good MAC address output.
But then I can’t pair. If I go into bluetoothctl it can see the controller, and will “connect” when I press the PS button such that it is on. But it won’t ever pair…. Any thoughts on this or how to debug?
Thanks
Hi Josh, what does the output of
sudo service bluetooth status
say? There might be subtle differences in the installation path of Bluez between differentLinux distributions. Make sure that the correct Bluez version (5.41) is up and running. Pairing will not succeed if your distribution’s Bluez version is still running.
Also, remember that this tutorial only works for Gasia/ Shanwan controllers. Connect your PS3 controller via USB and check the output of
dmesg
for Shanwan/Gasia.Using
sudo bluetoothctl
you could try to ‘trust’ your controller[bluetooth]# trust 00:00:00:00:00:00
(replace 00:00:00:00:00:00 with your PS3’s HW address) before running sudo ./sixpair.Hello leronardo and everyone here . could someone please guide me in this tutorial ?
I’m totally lost in this tutorial , I’m noob with RP .
I have 3 ps3 shawman controls and can not use any = (
somebody help me, please
Hi Michel,
at which step in particular you got stuck?
I stopped in step 2 , I am in doubt which part is the operating system and which part is the raspberry
OK, I see. If you don’t know how to patch the bluez package, you can try the patched Bluez from my github repo. Simply do:
git clone https://github.com/luetzel/bluez
Then, directly continue with Step 4.
thanks, it worked fine! 😉
Hi Luetzel, when I am getting stuck when I try to make the sixpair utils. When I run make, I get:
gcc -Wall -O2 hidraw-dump.c -o bins/hidraw-dump
gcc -Wall -O2 sixad-jack.c -o bins/sixad-jack -ljack -lm
gcc -Wall -O2 sixpair.c -o bins/sixpair -lusb
sixpair.c:9:17: fatal error: usb.h: No such file or directory
#include
^
compilation terminated.
Makefile:8: recipe for target ‘tools’ failed
make: *** [tools] Error 1
Any ideas how get past this?
Hi Stevo,
the gcc compiler complains about missing header files.
usb.h: No such file or directory
This is easy to fix: simply install the missing -dev package, in your case
sudo apt-get install libusb-dev
and you are good to go!If header files (ending *.h) are missing, you can always check for the name of the -dev
package by running:
sudo aptitude search libusb
If not sure about the requirements for compiling a source package, please check the README.
It usually lists the dependencies that have to be installed for compilation.
You are a champion Martin! That seems to have worked beautifully now on my Pi3 and RetroPie 3.8.1 build!
I’ve now gotten both Shanwan controllers to pair and they both seem to still work after a full shutdown. (I’ve had other experiences when they would pair – but need to be re-paired after a reboot).
Now, we just need to ensure all this good work of yours make it into the RetroPie 4.0 build.
Again…Thank you! Thank you! Thank you!
Cheers
Steve 🙂
Thank you for this tutorial but I am still having issues connecting 2 controllers at the same time, and I can’t stop the controllers vibrating when I connect them via USB to charge. Can you please help me at all?
For the second controller, try to “register” it using sixpair, but without having the first controller already paired/connected via bluetooth. Then, check with ‘sudo bluetoohctl’ whether you can see hardware addresses of both controllers. For pairing the second controller, wait until LED1 lights up on the first, only then press the PS button on your second controller. If this doesn’t work, remove both devices using bluetoothctl and start over with sixpair. About charging. It is not possible to charge these controllers without rumbling while being connected to an USB port of your Raspberry. Here I use an USB wall charger… Read more »
Also be sure that: sixad-sixaxis have appropiate permissions:
cd /usr/sbin/
chmod 755
sudo reboot
this worked for me.
sixad-sixaxis is not required for pairing using bluez. You shouldn’t need other programs of qtsixa than sixpair.
awesome stuff, thanks for the guide!
my 2 PS3 Shanwan controllers now work via BT- but the gasia doesnt.. guessing cant get both working together?
Glad to see that it works for you! I don’t know whether it is possible to mix and pair both Gasia and Shanwan at the same time. According to the description of bluez patches it should be possible.
Ha took me 10 mins to spot the typo! sudo service bluetooh restart should read “bluetooth”
Thanks for your feedback. I’ve corrected the typo!