Plug the PS3 SIXAXIS controller into a Linux PC via USB and you'll get something like this:
$ dmesg | tail -4
usb 1-3: new full speed USB device using ohci_hcd and address 16
usb 1-3: configuration #1 chosen from 1 choice
input: Sony PLAYSTATION(R)3 Controller as /class/input/input14
input: USB HID v1.11 Joystick [Sony PLAYSTATION(R)3 Controller] on usb-0000:00:03.0-3
$ lsusb | grep Sony
Bus 001 Device 016: ID 054c:0268 Sony Corp.
Using the jstest program (in the joystick Debian package), we can get the joystick info:
Joystick (Sony PLAYSTATION(R)3 Controller) has 28 axes (X, Y, Z, Rz, ...)
and 19 buttons (Trigger, ThumbBtn, ThumbBtn2, ...)
So the joystick seems to provide 28 analog axes ? a lot more than the advertised 6! However, things don't work right; no data is returned from the joystick. We know that the pad works in PS3 Linux, though, so the next step is to get Sony's Linux source CD (CELL-Linux-CL_20061110-SRCCD.iso). Inside is the archive linux-20061110.tar.bz2, which contains a patch:
This patch is against the 2.6.16 Cell kernel, but it's easy enough to apply to other kernels. It looks like it's one minor fix to remove an ordering assumping in hid_parser_local, and a quirk to send a HID_REQ_GET_REPORT packet to the pad during initialization (for whatever reason).
Here is a copy of the patch that applies cleanly to the Debian linux-source-2.6.18 package:
* sixaxis-2.6.18.patch [Please register to see this link. ]
With it, jstest now reports proper data values. Here are the axis and button assignments:
Axis Assignment
0 Left thumb X
1 Left thumb Y
2 Right thumb X
3 Right thumb Y
4-7 nothing
8 Dpad Up
9 Dpad Right
10 Dpad Down
11 Dpad Left
12 L2
13 R2
14 L1
15 R1
16 Triangle
17 Circle
18 Cross
19 Square
20-27 nothing
Button Assignment
0 Select
1 L3
2 R3
3 Start
4 Dpad Up
5 Dpad Right
6 Dpad Down
7 Dpad Left
8 L2
9 R2
10 L1
11 R1
12 Triangle
13 Circle
14 Cross
15 Square
16 PS Button
17-18 nothing
Note that analog buttons appear as both analog axes and digital buttons. Unfortunately, a number of axes appear to do nothing, and the motion sensing axes are nowhere to be seen. There is probably some way to enable them (some HID_REQ_SET_REPORT command, perhaps?), but I haven't found what it is.