Showing posts with label devicekit. Show all posts
Showing posts with label devicekit. Show all posts

Friday, 22 May 2009

Sixaxis support in BlueZ

Getting the Sixaxis PlayStation 3 joypad to work with Linux (in Bluetooth mode) is a bit of a pain. There were my various attempts at cleaning up the code lying around on the Internet, and hacks involving hidd.

The way to set the pad up in Bluetooth mode is fairly straight forward:
  • Open the USB device
  • Get the device's Bluetooth address through magic USB commands
  • Write your Bluetooth adapter's address in the pad (magic USB commands again), and then give the device back to the USB HID driver, so that it works as a pad through USB.
  • Set up the internals of bluetoothd so it recognises the device, and allows it to connect to your computer
  • When the device connects through Bluetooth, poke at it with magic commands again to enable its HID mode (code is already in bluetoothd's input plugin)
Yesterday I refactored my code as a bluetoothd plugin.

First up, detecting the device being plugged in. I wanted to use DeviceKit's GObject helper library, but it uses the D-Bus DeviceKit daemon which will be going away (note, this is just the DeviceKit daemon itself, not the -power, or -disks "sub"-daemons), in favour of libudev usage.

So I ported devkit-gobject to use libudev directly. Patch is currently being reviewed (it's in DavidZ's inbox), and it should show up soon in udev-extras under a different namespace.

After a bit of work, I had a bluetoothd plugin that detected PS3 pads being plugged in, and did the necessary work to make bluetoothd recognise it on plug.


Next, finishing up the libudev GObject helper library, and getting the bluetoothd plugin reviewed. And it would be nice to finally get the extra functionality merged into a hid driver in the kernel.

PS: Any info on the PS3 Headset or the keypad?