Connect PS3 Controller over Bluetooth in Linux with Bluez
Connecting a PS3 controller over Bluetooth in Linux can be a bit tricky. Hopefully this guide will help get your old but still useful controller working on Linux wirelessly over Bluetooth.
Important Note
One thing that needs to be noted here, is that the PS3 controller connects over bluetooth in a less secure way. This causes problems for the latest bluez versions because in the most recent updates, fixes were added to beef up its security to avoid HID spoofing attacks. So, in order to connect the PS3 controller, we need to edit the bluez config file and open up some security holes to allow some legacy connection methods.
Edit Bluez Config
The config file will be located here:
/etc/bluetooth/input.conf
If the file does not exist, you can create it.
Edit the file so it includes the following:
[General]
ClassicBondedOnly=false
The [General]
line defines the section. If that already exists, then you don’t need to add that part but you do need to make sure that the next line is underneath that section and not another one. The ClassicBondedOnly
option is set to false
to allow for legacy connections. So if you ever need to enable the security again, either remove this line or set it to true
. It always defaults to true
if the line is not present.
Connect the controller wirelessly over Bluetooth with Bluez
In a terminal, run the following command:
bluetoothctl
This will run the bluetooth control tool. You can type help
to get a list of commands for more details. While this is running, we can run a few commands to ensure a proper connection is established:
[bluetooth]# agent on
[bluetooth]# default-agent
Its possible that this is not needed but we want to ensure the agent is running and the default agent is set.
Now, you want to connect your PS3 controller by usb to your computer and the press the PS
button. Once connected, keep an eye on the terminal window. You should see a message that the controller was connected and you will be asked to authorize the device. You should see a similar message as the following:
[agent] Authorize service service_uuid (yes/no):
Type yes
and hit enter. The controller should now be authorized to connect.
Disconnect the controller from the usb cable and press the PS
button again. The controller should now be connected wirelessly.
Enjoy :)