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
Please note that I have rearranged this thread to show latest comments on top.
I still have problems pairing my gasia controllers with this guide. I did everything step by step and still no connection.
sudo bluetoothctl gives me the following:
[NEW] Controller 00:15:83:6D:34:6C retropie [default]
[NEW] Device 00:26:5C:10:53:A7 PLAYSTATION(R)3 Controller
[NEW] Device 00:26:5C:10:57:B6 PLAYSTATION(R)3 Controller
I think the controllers are being recognized, but they won’t pair.
Any idea?
Please have a look at the other user comments above! Check the output of bluetoothctl after pressing and/or hcidump -x. Since your controllers are recognized correctly (bluetoothctl displays their HW address), it might be an authentication problem. First, make sure that patched blueZ runs on your Pi (make install overwrites the deb package that is already present on your distribution). Then, you could try to ‘trust’ your controllers using bluetoothctl. If it doesn’t help try to remove the controllers using bluetoothctl and start over. Note that there are still some issues with the internal BT on Pi3. If you are… Read more »
Thanks for your reply. I am on a pi2 model b using an usb dongle already. I also tried to trust the controllers, tried to remove them and pair them again, that didn’t work. I don’t know if i’m doing something wrong, or if it’s just the controllers (maybe newer version than supported or whatever). All i can say is that this guide didn’t work for me.
OK, I see. Can you check with dmesg/ or bluetoothctl for the exact brand name of your controller and post it here?
And what is your distribution? Raspbian? It is know that devices labeled with ‘SZMY-POWER’ are unable to pair.
It would be valuable information other users having similar problems with their controllers.
Hi again, i got 2 gasia controllers, exact name as shown in dmesg is ” Gasia Co.,Ltd PS(R) Gamepad”. Strange thing is that i was able to pair 1 controller, that one now works like a charm. Still struggeling with the second one, it won’t pair no matter what i try. This is going to drive me crazy, because one controller is working. Forgot to say that I’m on raspbian.
Glad to hear that you were able to connect at least one controller. I’m sure that you will be able to pair your second controller as well. Please check before pairing the first controller that the mode is “Up Running PSCAN”, if you run “hciconfig”. After pairing the first controller the bluetooth adapter might exit the “discovery mode” and hciconfig then only reads “up running”. If you change the mode to PISCAN by running “sudo hciconfig hci0 piscan” after pairing the first controller the bluetooth stays in the discovery mode and it works as expected for the pairing of the… Read more »
Thanks for your advise, but i think i found the reason why the second one isn’t connecting. I shouldn’t have put my trust in chinese products, so i opened the faulty controller and what i saw was clear. There was a short due to a bad solder joint.
Oh, what a crap! However, I’m pretty sure that genuine controllers are also manufactured in China.
So far, I’ve been lucky with devices purchased at Aliexpress. Have you been able to fix the bad joint?
Hi, i’ve been able to fix the joint, the controller connected once but no chance to pair it again. “sudo bluetoothctl” shows the mac-adress correctly as before, but it won’t pair. I really have no idea what to try next.
Did you add “hciconfig hci0 piscan” to rc.local? I guess that your BT dongle is not in “discoverable mode” and therefore invisible
for your controller. “hcidump -x” might give a clue whats going on after pressing the PS3 button.
The dongle is working and doesn’t go into standby, i ended up buying 2 Sony DS3 Controllers, already spent too much time on this. Thanks for your kind help, but i think the controller is defective in some way.
Hi Luetzel, First of all I would like to thank you for the some much effort you put in creating this guide. I wanted to create a fresh installation from scratch on my Pi3 with Retropie and pairing my bluetooth PS3 controller to it via the onboard BT of Pi3. I have started the procedure with upgrading Retropie to the latest version. After that I have followed your step-by-step procedure which worked fine in most cases. Whoever there were some steps where I got stuck with the compilation of QtSixA. Google told me that the errors are referring to that… Read more »
Hi phody, thanks for giving your elaborate feedback. I’m sure that it’ll help other users for pairing their controllers. I’ll include
your comments at the respective steps in the tutorial.
Cheers, Martin.
Hi luetzel,
Your guide is fantastic! Thank you very-very much! 🙂
I’ve just made it to connect via BT to my Ubuntu machine.
I just have one question. I have a Shanwan controller and the mapping is really messed up in Steam. What would you suggest I use to properly remap the controller?
Hi Alex, good to see that it works for you. I used the PS3 controller mostly with RetroPie.
You probably could try to remap the buttons using ‘qjoypad’ which can be found
at http://qjoypad.sourceforge.net/ On OpenSuSe Leap 42.2 it did not compile, but I was able
to find a precompiled binary for my distribution. With qjoypad you should be able to map
keys to the PS3 controller buttons, which works fine for most keyboard-controlled games.
It is possible to configure profiles for each game. Cheers, Martin.
Thanks for the quick reply.
I figured out how to do the remapping in Steam. And probably because it’s not an original one, all games have it either not mapped at all or in a wrong way. Anyway, it’s something I can figure out.
Again, thanks a lot! Your guide is actually the only one on the Internet that is helpful. I thought I was screwed with this Shanwan gamepad. 🙂
If I do an install from scratch starting with rasbian. Do I follow your instructions and only install retropie after completing your instructions. I have a pi 2 and a Shanwan controller.
It is fine to install blueZ from scratch on a Pi2 with fresh Raspbian image. You can install RetroPie either before or after installing blueZ. The order is not important,
but be aware that future updates of Raspbian (apt-get upgrade or apt-get dist-upgrade) may overwrite patched blueZ. In this case you must re-install (sudo make install) patched
blueZ. Furthermore, avoid pairing your controllers by using the RetroPie setup script/ setup menu. This will enable the sixad daemon which might interfere with blueZ.
Instead, try to pair your controllers using ‘sixpair’ as described in the tutorial. Good luck,
Martin
If I download your patched blues source code do I still need to do steps 1-3? or can I just start with step 4?
With my patched blueZ you can start from step 4. In case that compilation fails, make sure to install missing header files‘. Cheers, Martin
using ‘apt-get install
When doing step 4 I get the message
Configure: error: libical is required.
What is libical and how do I aquire it?
Hi Duncan,
some dependencies are missing on your system. Enter: ‘sudo apt-get install libical-dev’ on the console to install missing header files.
Cheers,
Martin
I tried linking /etc/firmware but that doesn’t seem to be the problem. I still get aa:aa:aa:aa:aa:aa. Also it worked the first time its only after the restart that it fails. Since I already paired once I can see it in bluetoothctl it’s just no able to reconnect when I hit the PS button.
In my ignorance it feels like something hasn’t restarted correctly. This was a vanilla install of Rasbian (2016-11-25), on a PI 3 using the built in bluetooth. I wonder if something changed in that version.
Hi Max,
I would suggest to remove your device using sudo bluetoothctl. Within bluetoohctl shell, the ‘help’ command reveals some useful programs to trust devices permanently
and to set your dongle discoverable. In case that you have LXDE running, the Bluetooth app might interfere with your pairing attempts. You should try it only from the console.
If this doesn’t help, remove the device and try to run sixpair again. Also check hciconfig, if the dongle is up. (PSCAN/ ICSAN). In case that it still fails, contact me
at webmaster_at_raspberryblog.de for further troubleshooting.
Cheers,
/luetzel
Thanks for the excellent work. The instructions worked and I was able to set up two controllers on a fresh install of raspbian. However after reboot the controllers failed to reconnect.
After reboot hciconfig is not showing ISCAN, my two controllers are shown as paired in bluetoothctl and the service is running your patched bluez (I have tried repeating make install just to be sure). Here is the formatted output of a few commands. At the end if I try hcidump -x and press try to pair from the controllers I see no pairing attempt made.
http://pastebin.com/5m2N1xCE
Hi Max,
thanks for your feedback. The line
BD Address: AA:AA:AA:AA:AA:AA ACL MTU: 1021:8 SCO MTU: 64:1"
Indicates that something might be wrongwith your bluez firmware. Please check – as described in Step 6 – whether your firmware is present at the proper location.
Cheers,
/luetzel
Hi all,
i use an old netbook, toshiba NB505 2GB/Ram and Intel Atom N455,
i use Lakka for retrogaming, i have a P3 shanwan that i wold like to use through bluetooth, is it possible to apply this pach in that system?
I haven’t tried Lakka, yet, but you probably don’t have to apply these patches yourself. According to the github repo, they are already present. Thus there is a good chance, that your Shanwan controller will work out of the box. Simply follow the tutorial from Step 4, make sure that bluetoothd is up and running (and disable sixad, if present). In case that sixad is already installed, skip Step 6 and try to pair your controller using ./sixpair while its being connected via USB. And please report the outcome – it might be helpful for other users.