xboxdrv/PROTOCOL
2008-05-03 11:58:50 +02:00

368 lines
17 KiB
Text
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

===========================
[[ Protocol Descriptions ]]
===========================
General:
========
The following was learned through a combination of guessing and
looking at the Windows, MacOSX and Linux Kernel drivers. No gurantee
for correctness.
Use usb_interrupt_read() not usb_bulk_read(), the later one fails with
the Xbox360 guitar.
Xbox:
=====
The A, B, X, Y, black, white, LT and RT buttons on the Xbox pad are 8bit
pressure sensitive.
The two memory ports of the controller aren't discussed here.
LED: the controller doesn't have LEDs
+----------- small weight (right side), 0-255
v v-- large weight (left side), 0-255
Rumble: { 0x00, 0x06, 0x00, s, 0x00, large };
^-- length of the message
struct XboxMsg
{
// --------------------------
unsigned int type :8;
unsigned int length :8;
// data[2] ------------------
unsigned int dpad_up :1;
unsigned int dpad_down :1;
unsigned int dpad_left :1;
unsigned int dpad_right :1;
unsigned int start :1;
unsigned int back :1;
unsigned int thumb_l :1;
unsigned int thumb_r :1;
// data[3] ------------------
unsigned int dummy :8;
unsigned int a :8;
unsigned int b :8;
unsigned int x :8;
unsigned int y :8;
unsigned int black :8;
unsigned int white :8;
unsigned int lt :8;
unsigned int rt :8;
// data[6] ------------------
int x1 :16;
int y1 :16;
// data[10] -----------------
int x2 :16;
int y2 :16;
} __attribute__((__packed__));
Xbox360 Controller
==================
The Xbox360 controller doesn't have pressure sensitive A,B,X,Y,LB,RB
buttons like the Xbox controller, only LT and RT are analog. Black and
white are replaced by LB and RB. And in addition to that it has a
guide button (big fat X).
Interface 0:
Endpoint 1(in): Controller events
Endpoint 2(out): Messages to the controller
Interface 1:
Endpoint 3(in): UNKNOWN (maybe headset)
Endpoint 4(out): UNKNOWN (maybe headset)
Endpoint 5(in): UNKNOWN (maybe headset)
Endpoint 6(out): UNKNOWN (maybe headset)
Interface 2:
Endpoint 6(in): UNKNOWN (maybe headset)
Interface 3:
None:
On first connect the controller sends:
len: 3 data: 0x01 0x03 0x0e // current LED status
len: 3 data: 0x02 0x03 0x00 // UNKNOWN: maybe headset connection status or volume
len: 3 data: 0x03 0x03 0x03 // Rumble Status (0x00 in the last pos means rumble is disabled, 0x03 is default)
len: 3 data: 0x08 0x03 0x00 // UNKNOWN: maybe headset connection status or volume
len: 20 data: 0x00 0x14 0x00 0x00 0x00 0x00 0x69 0xed 0x23 0xff 0x6b 0x00 0x15 0x03 0x00 0x00 0x00 0x00 0x00 0x00
len: 20 data: 0x00 0x14 0x00 0x00 0x00 0x00 0xfc 0xec 0x23 0xff 0x6b 0x00 0x15 0x03 0x00 0x00 0x00 0x00 0x00 0x00
The first four lines are unknown, but seem to be always the same, the
"len: 20" ones are event data of the following form. The controller
sends them two times on each button press and also two times on first
connect.
Commands send to the controller:
--------------------------------
,--------- type of message
v v-- length of message
LED: { 0x01, 0x03, LED_STATUS };
LED Status Update Message, send out after one has changed the led status:
{ 0x01 0x03 LED_STATUS } (blinking states are reported as non-blinking)
+-------- large weight (left side), 0-255
v v-- small weight (right side), 0-255
Rumble: { 0x00, 0x08, 0x00, large, small, 0x00, 0x00, 0x00 };
^ ^-- length of the message
`--------- type of message
Unknown:
sending { 0x02, 0x03, INT } causes a reply of { 0x03, 0x03, INT } (values of 0-3 are supported)
sending { 0x02, 0x03, 0x00 } causes future rumble update messages to be ignored, this seems to be permanent, even disconnecting the controller doesn't reset it
Event Messages:
struct Xbox360Msg
{
// -------------------------
unsigned int type :8; // always 0
unsigned int length :8; // always 0x14
// data[2] ------------------
unsigned int dpad_up :1;
unsigned int dpad_down :1;
unsigned int dpad_left :1;
unsigned int dpad_right :1;
unsigned int start :1;
unsigned int back :1;
unsigned int thumb_l :1;
unsigned int thumb_r :1;
// data[3] ------------------
unsigned int lb :1;
unsigned int rb :1;
unsigned int guide :1;
unsigned int dummy1 :1; // always 0
unsigned int a :1;
unsigned int b :1;
unsigned int x :1;
unsigned int y :1;
// data[4] ------------------
unsigned int lt :8;
unsigned int rt :8;
// data[6] ------------------
int x1 :16;
int y1 :16;
// data[10] -----------------
int x2 :16;
int y2 :16;
// data[14]; ----------------
unsigned int dummy2 :32; // always 0
unsigned int dummy3 :16; // always 0
} __attribute__((__packed__));
Xbox360 Guitar
==============
The Xbox360 Guitar behaves the same as a regular Xbox360 controller
and talks the same protocol just with the meaning of a few buttons and
axis changed. The guitar doesn't have rumble support.
struct Xbox360GuitarMsg
{
// -------------------------
unsigned int type :8;
unsigned int length :8;
// data[2] ------------------
unsigned int dpad_up :1; // also strum-up
unsigned int dpad_down :1; // also strum-down
unsigned int dpad_left :1;
unsigned int dpad_right :1;
unsigned int start :1;
unsigned int back :1;
unsigned int thumb_l :1; // unused
unsigned int thumb_r :1; // unused
// data[3] ------------------
unsigned int orange :1; // 5
unsigned int rb :1; // unused
unsigned int guide :1;
unsigned int dummy1 :1; // unused
unsigned int green :1; // 1, A
unsigned int red :1; // 2, B
unsigned int blue :1; // 4, X
unsigned int yellow :1; // 3, Y
// data[4] ------------------
unsigned int lt :8; // unknown
unsigned int rt :8; // unknown
// data[6] ------------------
int x1 :16; // unused
int y1 :16; // unused
// data[10] -----------------
int whammy :16;
int tilt :16;
// data[14]; ----------------
unsigned int dummy2 :32; // unused
unsigned int dummy3 :16; // unused
} __attribute__((__packed__));
Xbox360 Wireless
================
The wireless reciever acts as a single USB device, each of the four
controller is on a seperate Interface together with the headset port:
Interface 0:
Endpoint 1(in/out): Controller 1
Endpoint 2(in/out): Headset 1
Interface 1:
Endpoint 3(in/out): Controller 1
Endpoint 4(in/out): Headset 1
Interface 2:
Endpoint 5(in/out): Controller 1
Endpoint 6(in/out): Headset 1
Interface 3:
Endpoint 7(in/out): Controller 4
Endpoint 8(in/out): Headset 1
v-- typo? might be 0x0c, i.e. length
Rumble: { 0x00, 0x01, 0x0f, 0xc0, 0x00, large, small, 0x00, 0x00, 0x00, 0x00, 0x00 }
^ ^--- ???
+--------- seems the same as in Event Data
LED: { 0x00, 0x00, 0x08, 0x40 + (mode % 0x0e), 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
Connection Status Messages:
0x08 0x00 - Nothing
0x08 0x40 - Headset
0x08 0x80 - Controller
0x08 0xc0 - Controller and Headset
On connection:
--------------
len: 2 data: 0x08 0x80
len: 29 data: 0x00 0x0f 0x00 0xf0 0xf0 0xcc 0xfd 0x1f 0x9f 0x70 0xc9 0x00 0x63 0xb0 0x00 0x05 0x13 0xa7 0x20 0x1d 0x30 0x03 0x40 0x01 0x50 0x01 0xff 0xff 0xff
len: 29 data: 0x00 0xf8 0x02 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
Different connection:
---------------------
|||| |||| |||| |||| |||| |||| |||| _________________ Serial?_________ |||| |||| |||| _____ Battery?
29 data: 0x00 0x0f 0x00 0xf0 0xf0 0xcc 0xfd[0x55 0x40 0xf0 0x48 0xe4 0x5d 0x10]0x00 0x05 0x13[0x67]0x20 0x1d 0x30 0x03 0x40 0x01 0x50 0x01 0xff 0xff 0xff
len: 29 data: 0x00 0x0f 0x00 0xf0 0xf0 0xcc 0xfd 0x1f 0x9f 0x70 0xc9 0x00 0x63 0xb0 0x00 0x05 0x13 0xe7 0x20 0x1d 0x30 0x03 0x40 0x01 0x50 0x01 0xff 0xff 0xff
len: 29 data: 0x00 0x0f 0x00 0xf0 0xf0 0xcc 0xfd 0x1f 0x9f 0x70 0xc9 0x00 0x63 0xb0 0x00 0x05 0x13 0xa7 0x20 0x1d 0x30 0x03 0x40 0x01 0x50 0x01 0xff 0xff 0xff
When the controller connects it sends { 0x08 0x80 } -> 0000'1000 1000'0000
When the headset connects it sends: { 0x08 0xc0 } -> 0000'1000 1100'0000
When nothing is connected: { 0x08 0x00 } -> 0000'1000 0000'0000
Event data:
===========
+-------- always 0
| +---- 0x01 when a event message, 0x00 otherwise (battery status?), also 0xf8 and 0x0f (both on new connection)
| | +--- always 0xf0 (1111'0000)
| | |
| | | +-- length
v v v v v---- normal xbox event message, but one byte shorter + 5x 0x00 padding
len: 29 data: 0x00 0x01 0x00 0xf0 0x00 0x13 0x20 0x00 0x00 0x00 0xc1 0x08 0xc9 0xfc 0x67 0xf4 0xe5 0xfe 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
len: 29 data: 0x00 0x00 0x00 0xf0 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
len: 29 data: 0x00 0x01 0x00 0xf0 0x00 0x13 0x00 0x00 0x00 0x00 0xc1 0x08 0xc9 0xfc 0x67 0xf4 0xe5 0xfe 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
len: 29 data: 0x00 0x00 0x00 0xf0 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
Battery Status Msg (maybe):
------------------------
len: 29 data: 0x00 0xf8 0x03 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
len: 29 data: 0x00 0xf8 0x02 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
Battery Full(?):
len: 29 data: 0x00 0x00 0x00 0xf0 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
Controller without doing anything
2 data: 0x08 0x80
29 data: 0x00 0x00 0x00 0x00 0x05 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
____ battery ?
29 data: 0x00 0x00 0x00 0x13 0xe2 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
29 data: 0x00 0x00 0x00 0x13 0xe6 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
29 data: 0x00 0x00 0x00 0x20 0x1d 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
29 data: 0x00 0x00 0x00 0x40 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
29 data: 0x00 0x00 0x00 0xf0 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
29 data: 0x00 0x0f 0x00 0xf0 0xf0 0xcc 0xfd 0x1f 0x9f 0x70 0xc9 0x00 0x63 0xb0 0x00 0x05 0x13 0xe7 0x20 0x1d 0x30 0x03 0x40 0x01 0x50 0x01 0xff 0xff 0xff
29 data: 0x00 0xf8 0x02 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
Unknown Messages:
29 data: 0x00 0x00 0x00 0x20 0x1d 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
29 data: 0x00 0x00 0x00 0x40 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
29 data: 0x00 0xf8 0x03 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
29 data: 0x00 0xf8 0x02 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
---------------
len: 29 data: 0x00 0x01 0x00 0xf0 0x00 0x13 0x00 0x00 0x00 0x00 0x94 0xff 0xc0 0x02 0xa6 0x02 0xf0 0xf6 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
len: 29 data: 0x00 0x01 0x00 0xf0 0x00 0x13 0x00 0x00 0x00 0x00 0x14 0xfd 0xc0 0x02 0xa6 0x02 0xf0 0xf6 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
len: 29 data: 0x00 0x00 0x00 0x00 0x05 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
Battery Message?:
len: 29 data: 0x00 0x00 0x00 0x13 0xa2 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
len: 29 data: 0x00 0x00 0x00 0x13 0xe2 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
len: 29 data: 0x00 0x00 0x00 0x13 0xe6 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
// Charging?
len: 29 data: 0x00 0x00 0x00 0x13 0xe0 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
Unknown:
len: 29 data: 0x00 0xf8 0x02 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
len: 29 data: 0x00 0x00 0x00 0x20 0x1d 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
len: 29 data: 0x00 0x00 0x00 0x40 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
len: 29 data: 0x00 0x00 0x00 0xf0 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
len: 29 data: 0x00 0x01 0x00 0x13 0xa6 0x13 0x00 0x00 0x00 0x00 0xa9 0xfc 0x60 0x01 0x9d 0x00 0x61 0xf7 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - similar to normal event message
Init message
__________________________________ ____
len: 29 data: 0x00 0x0f 0x00 0xf0 0xf0 0xcc 0xfd 0x1f 0x9f 0x70 0xc9 0x00 0x63 0xb0 0x00 0x05 0x13 0xa7 0x20 0x1d 0x30 0x03 0x40 0x01 0x50 0x01 0xff 0xff 0xff
len: 29 data: 0x00 0x0f 0x00 0xf0 0xf0 0xcc 0xfd 0x1f 0x9f 0x70 0xc9 0x00 0x63 0xb0 0x00 0x05 0x13 0xe7 0x20 0x1d 0x30 0x03 0x40 0x01 0x50 0x01 0xff 0xff 0xff
C1n: 29 data: 0x00 0x0f 0x00 0xf0 0xf0 0xcc 0xfd 0x55 0x40 0xf0 0x47 0xee 0x1a 0xb0 0x00 0x05 0x13 0xe1 0x20 0x1d 0x30 0x03 0x40 0x01 0x50 0x01 0xff 0xff 0xff
C2n: 29 data: 0x00 0x0f 0x00 0xf0 0xf0 0xcc 0xfd 0x55 0x40 0xf0 0x48 0xe4 0x5d 0x10 0x00 0x05 0x13 0xa7 0x20 0x1d 0x30 0x03 0x40 0x01 0x50 0x01 0xff 0xff 0xff
C3n: 29 data: 0x00 0x0f 0x00 0xf0 0xf0 0xcc 0xfd 0x55 0x40 0xf0 0x47 0x06 0x87 0xc0 0x00 0x05 0x13 0xa7 0x20 0x1d 0x30 0x03 0x40 0x01 0x50 0x01 0xff 0xff 0xff
len: 29 data: 0x00 0xf8 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
len: 29 data: 0x00 0xf8 0x02 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
len: 28 data: 0x00 0x01 0xff 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
# Request power-off?
len: 29 data: 0x00 0xf8 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
len: 29 data: 0x00 0xf8 0x02 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
29 data: 0x00 0x0f 0x00 0xf0 0xf0 0xcc 0xfd 0x55 0x40 0xf0 0x48 0xe4 0x5d 0x10 0x00 0x05 0x13 0xa7 0x20 0x1d 0x30 0x03 0x40 0x01 0x50 0x01 0xff 0xff 0xff
29 data: 0x00 0x00 0x00 0x00 0x05 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
29 data: 0x00 0x00 0x00 0x40 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
29 data: 0x00 0x00 0x00 0xf0 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
# EOF #