I was looking for a way to use a PlayStation Dual Sock 3 SixAxis controller (that is a mouthful of a name) with my Android phone. I found Dancing Pixel Studios Sixaxis Controller app which looked like the only real solution. It requires root which isn’t a problem because for me because I have Cyanogenmod on my phone.
Looking at the documentation for the app you need to pair the controller to your phone via USB. I could pair by plugging into my phone or using a computer. I decided to use my my computer because I wanted to see how pairing works.
When pairing using your computer you need to get the bluetooth mac from the app on your phone then use a pairing tool to set the paired mac stored on the device to the that id. The app maker provides a Windows tool (doesn’t help me because I use OS X). For Linux users they have a comment about finding a tool called sixpair “floating around the internet”. OS X they have a modified version of the referenced sixpair tool but it requires libusb.
Looking into pairing a bit more, the mac handing is really simple. It’s just a USB feature report. Not wanting to deal with libusb and not being satisfied with the above options I decided to write my own pairing tool.
As with most things I like to write I wanted to make it cross platform. So I used HIDAPI which is a very nice USB interface for dealing with USB on multiple platforms. It’s lightweight and is just essentially a wrapper around the platform specific USB system.
I’m calling my tool sixaxispairer and I put the source up on GitHub. Currently, I’ve only built and tested it on OS X but it should work on Windows and Linux too. At least that was the goal.