Lakka on Raspberry Pi 2 with Dualshock4 Wireless Controller

After my last blog post I’ve had a few people contact me about whether the Playstation 4 Dualshock controller can be used. I started to research this and found that a lot of people were using them with a USB cable but I could not find anyone using them via bluetooth in Lakka – only people using them with complicated connection methods for RetroPie.

However – after doing some research this morning I’ve managed to pair and configure a Dualshock 4 controller via bluetooth with Lakka and  a Raspberry Pi 2 – here’s how to do it:

Step 1:
SSH into the device using this command ssh root@IPADDRESS. The password you will need to connect is just root.

Step 2:
Start the program bluetoothctl

Step 3:
In bluetoothctl issue the following commands:
– discoverable on
– pairable on
– scan on

Step 4:
This is important, I had no idea of this as I don’t have a PS4 I simply borrowed the controller off a friend. To put the PS4 controller into Pair mode you need to press the Share button and the PS Home button together – the LED will then continuously flash indicating it is in pair mode

Step 5:
As with the Dualshock 3 instructions, watch the screen for device connection/announcement messages. It should say something like the message below

[NEW] Device D0:27:88:27:CB:CD D0-27-88-27-CB-CD

Once you see that, you can now use the connect command to connect and bind to the Mac address


After you issue this command, you will see a line that says Name: Wireless Controller – this name you need to write down, or screenshot/copy paste as we will need it later. See the screenshot below for what I am referring to.

Screen Shot 2016-02-13 at 8.00.55 AM

Dont forget to issue the trust MACADDRESS command after you have a successful connection.

You should now see the controller has a solid light indicating it is connected and paired.

If you are like me you probably thought, great this will be exactly like the DS3, Lakka will just figure this out and autoconfigure. Well – unforunately it doesn’t.

Fortunately… there is a way to make it work – and it really isn’t that difficult – if you’ve been able to do the commands above and have a basic understanding of linux commands you should be able to get this all to happen.

First of all…

Why does the controller not autoconfigure? This took me a little bit of reading and cycling through the directory structure of Lakka to understand – but here’s the why.

In the retroarch.cfg file (/storage/.config/retroarch/retroarch.cfg) there is a setting joypad_autoconfig_dir that tells retroarch where to look for files that autoconfigure a controller when you plug it in/connect the controller via bluetooth. Currently in that directory there is no file that will link up to your bluetooth connected DS4 – so as far as Lakka is concerned it has no idea what you’ve connected and therefore will not try to autoconfigure the controller. The default location for the joypad autoconfigure files is /tmp/joypads

Do you remember how earlier I said make sure you record the line Name: from bluetootchctl ? If you didn’t start from the beginning of this post again because if you don’t have that theres no point proceeding on to the next steps.

Special Notes

OpenELEC that Lakka is built on has certain parts of the file system that are deliberately completely unable to be written to. Unfortunately the default joypad folder happens to be one of these places. Luckily there is a simple way around this.

Step 1:

Hold down Share and the PS Home button until the controller turns itself off i.e. the LED light goes out


Download this file Sony-PlayStation4-DualShock4-Controller-Bluetooth

Step 2:

For the sake of simplicity all I did was copied that file to the joypad directory that you can access by browsing the Lakka network shares from another computer – I’d suggest doing it the same way

Step 3:

We need to edit retroarch.cfg – now to do this you first need to stop the retroarch service. Refer to as to how to do this. Once you have stopped the service move on to step 4

Step 4:

Now the service is stopped we can edit the file:

nano /storage/.config/retroarch/retroarch.cfg

The line we want to edit currently reads:

joypad_autoconfig_dir = “/tmp/joypads”

Edit this line so it says this:

joypad_autoconfig_dir = “/storage/joypads”

**Tip – in nano to find a word press Ctrl + W then type in the word you are looking for and press enter

Once the line has been edited press Ctrl + x – nano will warn you changes have been made – type y to confirm the changes, press enter and the file will be saved.

Step 5:

Restart retroarch by typing:

systemctl start retroarch

Step 6:

You should be back on the main Lakka Screen (the orange coloured one) all you should need to do now is press the PS Home button once and the controller should pair again, and then you should see a message saying that it has autoconfigured and you can now use the controller. The controller should also show its status light as a solid colour.

Step 7 (Here if Step 6 didn’t get your controller working and some special notes):

If you need autoconfiguration of other controllers make sure you copy the relevant files from /tmp/joypads to /storage/joypads  – otherwise all you’ll be able to pair up or use is your DS4. For me I only have a DS3 and a DS4 paired so I just copied those files from the original directory.

If your controller still did not autoconfigure:

If you open up any of the autoconfigure files you will see the first line says:

input_device=”Some Controller Name”

Lakka uses that name to match up to the device you are using for autoconfigure. In my setup the controller when paired was simply called “Wireless Controller” (which is how the file your downloaded has been configured) – I’m not sure if this will be the same for everyone hence telling everyone to get this important detail from bluetoothctl.

If your controller does not autoconfigure make sure that you have edited the first line of the *.cfg file you downloaded earlier to match the name you got from bluetoothctl

For me the DS4 controller actually had force feedback whereas the DS3 did not so it was a nice extra feature. If your controller name was different if you could leave a comment to let me know what it is that would be great as we could pass that on to the Lakka development team so they can include these files in future releases.

I am using the following bluetooth adaptor (mentioned in my previous blog post is where to buy):

Bus 001 Device 004: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)

I am running this version of Lakka:

Linux Lakka 4.1.13 #1 SMP Tue Dec 22 09:40:55 CET 2015 armv7l GNU/Linux

Here is a video showing me using both the PS3 and PS4 controllers in game on my setup

3 comments on “Lakka on Raspberry Pi 2 with Dualshock4 Wireless Controller

  • when put bluetoothctl putty freezes… I’m running Lakka on an Intel NUC which has build in BT. what should I do?

    • Upgrade Lakka to the latest version – Intel NUC’s do have a few weird issues.

      The other option would be plug the NUC into a monitor and see if the system is actually hanging and if it is then check the syslogs to find out why.

  • I wanted to try Lakka but honestly, screw this. They’ll have to work on nags like this is they want it to be a better alternative to RetroPie.

Leave a Reply

Your email address will not be published. Required fields are marked *