Sebi came with another project on his own – using PS2’s (Microsoft PlayStation) Dual Shock 2 remote controller for initial cart steering. It took couple days for this idea to grow in a pretty long story – as always.
Let’s start from beginning – what is Dual Shock 2 remote controller?

Install Simple DirectMedia Layer library
$ sudo apt-get install libsdl2-dev
Save following text into test.cpp file:
#include <SDL2/SDL.h>
int main( int argc, char *argv[] ) {
SDL_ShowSimpleMessageBox( SDL_MESSAGEBOX_INFORMATION,
"Hello World",
"You have successfully compiled and linked an SDL2"
" program, congratulations.", NULL );
return 0;
}
Compile:
$ g++ test.cpp -o test -lSDL2
Run:
$ ./test

Set DS2 in a pairing mode with PS + SHARE buttons pressed at the same time.
Check available BlueTooth devices from BBB:
$ hcitool scan
Scanning ...
38:68:A4:1D:00:7D n/a
A4:AE:11:3F:1D:F4 n/a <- this is our DS2
Try to read more details from our DS2:
$ sdptool records A4:AE:11:3F:1D:F4
Service Name: Wireless Controller
Service Description: Game Controller
Service Provider: Sony Interactive Entertainment
Service RecHandle: 0x10001
Service Class ID List:
"Human Interface Device" (0x1124)
Protocol Descriptor List:
"L2CAP" (0x0100)
PSM: 17
"HIDP" (0x0011)
Language Base Attr List:
code_ISO639: 0x656e
encoding: 0x6a
base_offset: 0x100
Profile Descriptor List:
"Human Interface Device" (0x1124)
Version: 0x0100
Service RecHandle: 0x10002
Service Class ID List:
"PnP Information" (0x1200)
Protocol Descriptor List:
"L2CAP" (0x0100)
PSM: 1
"SDP" (0x0001)
Profile Descriptor List:
"PnP Information" (0x1200)
Version: 0x0103
Connect & trust & pair!
$ bluetoothctl
[bluetooth]# scan on
Discovery started
[CHG] Controller 50:8C:B1:5E:C7:66 Discovering: yes
[NEW] Device 88:C6:26:7A:6D:73 88-C6-26-7A-6D-73
[CHG] Device 88:C6:26:7A:6D:73 ManufacturerData Key: 0x0003
[CHG] Device 88:C6:26:7A:6D:73 ManufacturerData Value:
00 60 3b 00 00 0b 18 54 cf e5 09 5a 88 c6 26 7a .`;....T...Z..&z
6d 73 12 ms.
[NEW] Device A4:AE:11:3F:1D:F4 Wireless Controller
[CHG] Device A4:AE:11:3F:1D:F4 Modalias: usb:v054Cp09CCd0100
[CHG] Device A4:AE:11:3F:1D:F4 UUIDs: 00001124-0000-1000-8000-00805f9b34fb
[CHG] Device A4:AE:11:3F:1D:F4 UUIDs: 00001200-0000-1000-8000-00805f9b34fb
[NEW] Device 38:68:A4:1D:00:7D [TV] Samsung Q70 Series (75)
[CHG] Device 88:C6:26:7A:6D:73 ManufacturerData Key: 0x0003
[CHG] Device 88:C6:26:7A:6D:73 ManufacturerData Value:
00 60 3b 00 00 0b 18 54 cf e5 09 5a 88 c6 26 7a .`;....T...Z..&z
6d 73 12 ms.
[bluetooth]# trust A4:AE:11:3F:1D:F4
[CHG] Device A4:AE:11:3F:1D:F4 Trusted: yes
Changing A4:AE:11:3F:1D:F4 trust succeeded
[bluetooth]# pair A4:AE:11:3F:1D:F4
Attempting to pair with A4:AE:11:3F:1D:F4
[CHG] Device A4:AE:11:3F:1D:F4 Connected: yes
[CHG] Device A4:AE:11:3F:1D:F4 UUIDs: 00001124-0000-1000-8000-00805f9b34fb
[CHG] Device A4:AE:11:3F:1D:F4 UUIDs: 00001200-0000-1000-8000-00805f9b34fb
[CHG] Device A4:AE:11:3F:1D:F4 ServicesResolved: yes
[CHG] Device A4:AE:11:3F:1D:F4 Paired: yes
Pairing successful
[CHG] Device 88:C6:26:7A:6D:73 ManufacturerData Key: 0x0003
[CHG] Device 88:C6:26:7A:6D:73 ManufacturerData Value:
00 60 3b 00 00 0b 18 54 cf e5 09 5a 12 .`;....T...Z.
Checking again & disconnect:
[Wireless Controller]# paired-devices
Device A4:AE:11:3F:1D:F4 Wireless Controller
[Wireless Controller]# disconnect A4:AE:11:3F:1D:F4
Attempting to disconnect from A4:AE:11:3F:1D:F4
[CHG] Device A4:AE:11:3F:1D:F4 ServicesResolved: no
Successful disconnected
[CHG] Device A4:AE:11:3F:1D:F4 Connected: no
And here we’ve hit a problem when SDL 1.2 sees that joystick and SDL 2.0 not. It all works on Ubuntu, but not on our BBB. It took me few days to figure out that it is a permission problem. Few sources here:
https://forums.libsdl.org/viewtopic.php?t=9772
https://github.com/libsdl-org/SDL/blob/e9af6dcd93e92013198ec7cc8445555632b86c37/README-linux.txt
http://wntrknit.freeshell.org/sdl2-joysticks/99-joystick.rules
I’ve ended up with following command which fixes the problem till another restart. Hopefully Andrew will be able to fix it permanently.
sudo chmod 0666 /dev/input/event*
All working now! What you are seeing on a picture below are events collected from a DS2 controller connected over the Bluetooth to our BeagleBoneBlue!

One thought on “Dual Shock 2 remote controller for PS4”