The PS3 supports up to 7 Six Axis controllers in either wired USB mode or via bluetooth. When the bluetooth Blu-ray remote is used, it defaults to operating as controller 7, although as with the controllers they can all be remapped to another port between 1 and 7.

When using Linux, the controllers are automatically detected when connected via a USB cable.

I: Bus=0005 Vendor=054c Product=0268 Version=0100
N: Name="Sony Computer Entertainment Wireless Controller"

The DualShock 3 has exactly the same vendor and product code.

Using the hidd patch available at http://www.pabr.org/sixlinux/sixlinux.en.html it is possible to use the sixaxis wirelessly under Linux kernels higher than 2.6.20. Geoff’s informed me that this patch was put into the mainline kernel by Marcel Holtmann, so you should no longer need the patch.

When dumping the data from a bluetooth connection, the stream looks like this:

ACL data: handle 43 flags 0x02 dlen 54
  L2CAP(d): cid 0x0041 len 50 [psm 0]
    A1 01 00 b1 b2 b3 00 xl yl xr yr 00 00 00 00 up rt dn lf l2
    r2 l1 r2 tr ci cr sq 00 00 00 03 04 14 FF B7 00 16 23 FA 77
    01 81 02 08 01 F5 01 95 00 02
Data Stream Format
Bytes Meaning
A1 01 HID data on channel 01
00 Unknown
b1 b2 b3 Simple button states
00 Unknown (maybe placeholder for keycode?)
xl yl Left analogue stick, xl=00 ⇒ left, xl=FF ⇒ right, yl=00 ⇒ top, yl=FF ⇒ bottom
xr yr Right analogue stick, xr=00 ⇒ left, xr=FF ⇒ right, yr=00 ⇒ top, yr=FF ⇒ bottom
00 00 00 00 Unknown (but correspond to missing axes 4-7)
up rt dn lf Pressure sensitive digital pad buttons
l2 r2 l1 r2 Pressure sensitive shoulder buttons
tr ci cr sq Pressure sensitive Triangle, Circle, Cross, Square buttons
00 00 00 Unknown (maybe space for PS and the 2 unknown buttons before ENTER?)
03 Status? 03 when operating normally, 02 when charging cable plugged in
05 Seems to be power rating - 05=full, 02=dying, 01=just before shutdown, EE=charging
14 Status? 14 when operating by bluetooth, 10 when operating by bluetooth with cable plugged in, 16 when bluetooh and rumble
ff b9 00 00 23 16 77 01 81 Unknown (some values seem to fluctuate - maybe voltage and signal quality readings?)
02 08 01 f2 01 93 Accelerator data - big-endian 0..1023, centred at 512, resolution 0.01g
00 02 Z gyro - measures counter-clockwise rotation, 0..1023, nominally centred but see note below

Button states
Value b1 b2 b3
01 Select L2 PS
02 Left Hat R2 n/a
04 Right Hat L1 n/a
08 Start R1 n/a
10 Digital pad - up Triangle n/a
20 Digital pad - right Cricle n/a
40 Digital pad - down Cross n/a
80 Digital pad - left Square n/a

The accelerometer data can be tricky to interpret, I’m still in the easrly stages of this, but the following pages might be useful: wii Motion analysis and Chumby motion analysis.

The datasheet for the ADXL330 in the wiimote is available, which would be useful background reading.

Accelerometer data
Field Example Purpose Note
1 0208 accX / sin(roll) On my sixaxis, +11 is rest, +126 is 90deg left, -100 is 90deg right
2 01f2 accY / sin(pitch) On my sixaxis, -19 is rest, -117 is 90deg nose down, +114 is 90deg, controls facing you
3 0193 accZ / gravity On my sixaxis, sat on the table is -93, upside down is 131

When at rest, the vector sum of these should be around 100 (1g=9.8m/s^2). In this example it’s -101.

Possibly, accZ should be used in the roll/pitch calculation. Also note that if the sixaxis is moving rapidly, sin(roll) or sin(pitch) may be a lot bigger than +-128. Some people seem to be using atan2(accX/accZ) and atan2(accY,accZ) for roll and pitch...

Calibration data
accX accY accZ Description
11 -19 -93 Resting on table
19 -33 130 Upside down, resting on sticks
-86 -37 -10 Balancing on right edge (note you need to help it balance!)
111 -39 -23 Balancing on leftt edge (note you need to help it balance!)

The gyro is for instantaneous yaw (i.e. clockwise and counter-clockwise rotations). The resting point is nominally 512, although it varies massively between controllers. My 4 controllers rest at -18,82,121 and -512. That last one is obviously really broken as it only measures counter-clockwise rotations, although it does reach the full range. As such, the reading from the gyro probably only makes sense when considering the delta from previous readings...

The HID report protocol for the sixaxis is available here SixAxis_ProtocolDescriptor.

 
ps3/hardware/sixaxis.txt · Last modified: 2008/05/15 00:07
 
Recent changes RSS feed Creative Commons License Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki