11/04/2014 at 08:00 #82408
This is the simplest way to get it working, and it is also very stable, anyway this is the version 1.00 of this tutorial, it will be improved over time.
First things first, you will need this, but it’s kinda obvious 😛
– RetroPie v2.3 clean image
– An USB bluetooth dongle
– A DualShock4 controller
– An active internet connection
1.- Update the repositories:
sudo apt-get update
2.- Install the following packages to prepare the Raspberry to handle bluetooth and to meet the required ds4drv dependencies:
sudo apt-get install --no-install-recommends joystick checkinstall bluez-utils bluez-compat bluez-hcidump libusb-dev libbluetooth-dev
sudo apt-get install python-dev python-setuptools
3.- We will be using the development version of ds4drv, that was the one that work the best for me:
git clone https://github.com/chrippa/ds4drv.git
sudo python setup.py install
4.- Now we need to allow a normal user to create a new joystick:
sudo mv 50-ds4drv.rules /etc/udev/rules.d/
sudo udevadm control --reload-rules
sudo udevadm trigger
5.- At this point we can test the ds4drv connection with the DS4 controller:
ds4drv --led 000008
You will see something like this:
pi@raspberrypi ~/ds4drv $ ds4drv --led 000008 [info][controller 1] Created devices /dev/input/js0 (joystick) /dev/input/event0 (evdev) [info][bluetooth] Scanning for devices
Now you have to press and hold the share and PS buttons on the DualShock 4 at the same time until the light bar starts blinking. It will connect, and the led will turn on in soft blue.
Now press Ctrl + C to stop the test.
6.- Now we need to add the ds4drv to the programs at boot, so:
sudo nano /etc/rc.local
And just after “# By default this script does nothing.” we add:
/usr/local/bin/ds4drv --led 000008 &
To get something like this:
# By default this script does nothing. /usr/local/bin/ds4drv --led 000008 & # Print the IP address _IP=$(hostname -I) || true if [ "$_IP" ]; then printf "My IP address is %s\n" "$_IP"
Save the file with “Ctrl + X”.
7.- That’s it, you can now restart the Raspberry, in the “Emulation Station Loading…” screen or in the “Welcome” screen, we have to press and hold the share and PS buttons on the DualShock 4. It should connect with the led bar turned on in soft blue. Press and hold any button and you will see this:
– I have to see if running ds4drv in daemon mode is the best option.
– More tests.
Step 6: Changed /etc/init.d to /etc/rc.local. (Thanks @exonerated)11/05/2014 at 05:51 #82437
I am definitely going to try this! Someone I spoke with tried this a while ago with older drivers and said it was so laggy it was unusable. I will give this a shot and report back.11/05/2014 at 07:26 #82439
Just tested it out and ran into two issues.
The DS4 was found and the mac address displayed. After that it never goes to a soft blue it just keeps blinking. I then ended the command. If I don’t end the command and let it continue, I get this message:
[bluetooth] Unable to connect to detected device: Failed to set operation al mode: [Errno 107] Transport endpoint is not connected
Also, what file are you editing in the /etc/init.d directory? rc.local?11/05/2014 at 19:55 #82447
Hi exonerated, you are completely right, the correct file to edit is /etc/rc.local, it is already changed in the tutorial.
About the problem of connection, (and sorry for my English): There is a solution for that. The problem seems to happen when the controller is paired to the BT dongle in the Raspberry, disconnected, paired on another device, and then paired again to the Raspberry. I think it happens because Bluez has some kind of bug.
Anyway, to fix that you need to delete the controller pair data, you need python-gobject, so:
sudo apt-get install python-gobject
bluez-simple-agent hciX XX:XX:XX:XX:XX:XX remove
Where X in hciX is the number of your BT device, usually 0 (hci0), check it with:
And XX:XX:XX:XX:XX:XX is the DS4 MAC, that you can get with:
Once you do the bluez-simple-agent command, you can try ds4drv again, it should connect:
pi@raspberrypi ~ $ ds4drv –led 000008
[info][controller 1] Created devices /dev/input/js0 (joystick) /dev/input/event0 (evdev)
[info][bluetooth] Scanning for devices
[info][bluetooth] Found device A4:15:66:4E:CA:53
[info][controller 1] Connected to Bluetooth Controller (A4:15:66:4E:CA:53)
[info][bluetooth] Scanning for devices
[info][controller 1] Battery: 75%
[warning][controller 1] Signal strength is low (48 reports/s)11/06/2014 at 06:49 #82454
Hmmm. I previously had a PS3 controller synced with bluetooth. I try to remove that because it is the only bluetooth device displayed in hciconfig. Could this be the problem? Having a PS3 controller synced before? I try to remove it and get hit with this:
pi@raspberrypi ~ $ bluez-simple-agent hci0 00:02:72:D6:9E:96 remove ERROR:dbus.proxies:Introspect error on :1.1:/: dbus.exceptions.DBusException: org.freedesktop.DBus.Error.AccessDenied: Rejected send message, 2 matched rules; type="method_call", sender=":1.10" (uid=1000 pid=5609 comm="/usr/bin/python /usr/bin/bluez-simple-agent hci0 0") interface="org.freedesktop.DBus.Introspectable" member="Introspect" error name="(unset)" requested_reply="0" destination=":1.1" (uid=0 pid=2270 comm="python /usr/sbin/sixad-dbus-blocker ") Traceback (most recent call last): File "/usr/bin/bluez-simple-agent", line 102, in <module> path = manager.FindAdapter(args) File "/usr/lib/python2.7/dist-packages/dbus/proxies.py", line 70, in __call__ return self._proxy_method(*args, **keywords) File "/usr/lib/python2.7/dist-packages/dbus/proxies.py", line 145, in __call__ **keywords) File "/usr/lib/python2.7/dist-packages/dbus/connection.py", line 651, in call_blocking message, timeout) dbus.exceptions.DBusException: org.freedesktop.DBus.Error.AccessDenied: Rejected send message, 2 matched rules; type="method_call", sender=":1.10" (uid=1000 pid=5609 comm="/usr/bin/python /usr/bin/bluez-simple-agent hci0 0") interface="org.bluez.Manager" member="FindAdapter" error name="(unset)" requested_reply="0" destination=":1.1" (uid=0 pid=2270 comm="python /usr/sbin/sixad-dbus-blocker ")
I can’t remove the PS3 connection. Anyway to remove it completely and do a clean install of the DS4?
Here is what hciconfig outputs (This is my PS3 controller MAC which I no longer have, not my DS4 MAC):
pi@raspberrypi ~ $ hciconfig hci0: Type: BR/EDR Bus: USB BD Address: 00:02:72:D6:9E:96 ACL MTU: 1021:8 SCO MTU: 64:1 UP RUNNING PSCAN RX bytes:2363 acl:0 sco:0 events:88 errors:0 TX bytes:1403 acl:0 sco:0 commands:78 errors:0
Edit: Your English is more than good!11/06/2014 at 16:43 #82464
Hi exonerated, I will not have access to my Raspberry until Monday, so it will be difficult to me to do some tests. Anyway I will try to help. I don’t know if having a PS3 controller synced should be a problem, but it can be.
What I can see from your commands is that the BT MAC that you are using to delete the PS3 controller is the BT USB dongle MAC, not the controller MAC, that must be the problem. When you run hciconfig you can see the proprieties of the BT USB interface, it is needed to know only the number of the device, in your case it is “hci0”, the MAC that is displayed there is the dongle MAC, not the PS3 controller MAC that you may need to remove.
If you have your PS3 controller with you, you can get its MAC doing the “hcitools scan” command and by put the controller in paring mode. That’s the MAC you have use in the bluez-simple-agent command.
If that doesn’t work, it could be better if you try on a clean RetroPie to avoid any sort of problems. 😉12/08/2014 at 22:14 #83432
Hi guys, I got it working with a Dualshock 4 (thanks for the great and easy to read/follow tutorial), but it causes my raspberry pi model b to slow down enough to become unusable in games (tried it in super mario brothers 1 and 3 for the NES). Are either of you seeing the kind of lag I’m seeing, has there been any updates? Thanks.02/14/2015 at 18:48 #87465
Hey, nice tutorial but no matter how often i try or how meticulous i follow this guide i keep getting the very same error over and over;
[error][bluetooth] Unable to connect to detected device: Failed to set operational mode: [Errno 107] Transport endpoint is not connected
I have tried with different bluetooth dongles (Broadcom and Cambridge Silicon Radio in HCI mode… both dongles install and scan without issue), ive tried putting both dongles directly in the Pi as opposed to the hub, ive paired and unpaired the DS4 to different devices without issue, ive tried to remove the pair data but there is nothing to delete…
Any idea what i could try to make this work?07/12/2015 at 23:03 #101950
Old post, but try making sure that the sixad-bin tool is *NOT* running. Once I killed all of these, it worked fine:
2420 ? S 0:00 /bin/bash /usr/bin/sixad –start
2496 ? S 0:00 /usr/bin/sudo /usr/sbin/sixad-dbus-blocker
2497 ? S 0:00 /usr/bin/sudo /usr/sbin/sixad-bin 0 0 0
2503 ? S 0:00 /usr/sbin/sixad-bin 0 0 0
2504 ? S 0:00 python /usr/sbin/sixad-dbus-blocker10/16/2015 at 14:54 #107921
Can confirm that the tutorial works great on RetroPie 3.1. Thank you so much for posting this, it has made playing Playstation games on the RPi2 super fun!12/14/2015 at 18:58 #111817
Just ran through this. Great tutorial, thank you!
I ran into a hiccup at step 5:
ImportError: No module named six
I just had to install the “six” python module to fix it:
sudo easy_install six
After that, I could continue with step 5. Just posting this in case anyone else sees the same issue.
Forums are currently read only - please visit the new RetroPie forums at https://retropie.org.uk/forums/