Me wearing ridiculous goggles

XBOX 360 Chatpad Protocol

The chatpad communicates using standard 19.2kbps serial. (If you haven’t already, read the chatpad pinout.)

Initialization sequence

Greg Porter’s Propeller driver gives some basic information about the protocol, but much of it is implicit in assembly comments. In Greg’s driver I noticed two unexplained binary messages:

  1. “InitMessage” (87 02 8C 1F CC), and
  2. “AwakeMessage” (87 02 8C 1B D0).

I tried sending just one or the other to confirm that both are necessary, and they are:

  • Sending just “InitMessage” causes the chatpad to send some sort of status report message (8 bytes) at about 10Hz. The message doesn’t change as keys are pressed, and it eventually stops coming.
  • Sending just “AwakeMessage” gets no response.
  • Sending “AwakeMessage” after “InitMessage” causes the chatpad to start sending messages when keys are pressed.

Message Framing

Messages from the Chatpad appear to always be eight bytes in length.

Status Messages

Status messages are sent every 78 milliseconds and start with byte A5. Here’s an example:

A5 45 F0 04 00 04 04 1A

I currently have no idea what these messages mean.

Key Messages

Key messages are sent when a key is pressed or released. Oddly, the chatpad sends up to four such messages at each press/release event. Key messages start with byte B4.

Here are the press and release messages (respectively) for the A key:

B4 C5 00 00 37 00 00 50
B4 C5 00 00 00 00 00 87

Byte 4 in the press message (37 above) appears to be a keycode that uniquely identifies the key.

The chatpad can detect up to two simultaneous keys. When two keys are down, the keycode of the second key pressed appears in byte 5. For example, here is the sequence of messages generated by pressing A, pressing S, releasing A, then releasing S:

B4 C5 00 00 37 00 00 50
B4 C5 00 00 37 36 00 1A
B4 C5 00 00 36 00 00 51
B4 C5 00 00 00 00 00 87

From this we can see that Byte 7 is a checksum, computed by summing bytes 0-6 (modulo 256) and negating the result (two’s-complement).

Modifiers are transmitted in Byte 3, using a four-bit mask to represent the four modifier keys. Here is the sequence produced for shift-A:

B4 C5 00 01 00 00 00 86
B4 C5 00 01 37 00 00 4F
B4 C5 00 01 00 00 00 86
B4 C5 00 00 00 00 00 87

Do not be deceived by the use of a four-bit mask: the chatpad can’t detect more than two simultaneous keys, so there will never be more than two modifier bits set — and if two modifier bits are set, no non-modifier keycode can follow.

Key Map

In the table below, “M1” means the modifier mask (byte 3) is set to 1.

As you can see, the engineer responsible for the key map went insane before completing the right edge, where the keycodes become random.

C1 C2 C3 C4 C5 C6 C7 C8 C9 C10
17 16 15 14 13 12 11 67 66 65
27 26 25 24 23 22 21 76 75 64
37 36 35 34 33 32 31 77 72 62
M1 46 45 44 43 42 41 52 53 63
M2 M8 55 54     51 71 M4

In case you don’t have a chatpad handy to interpret the table above, here’s the same data phrased differently:

Numbers

Key Code
1 17
2 16
3 15
4 14
5 13
6 12
7 11
8 67
9 66
0 65

Letters

Key Code
A 37
B 42
C 44
D 35
E 25
F 34
G 33
H 32
I 76
J 31
K 77
L 72
M 52
N 41
O 75
P 64
Q 27
R 24
S 36
T 23
U 21
V 43
W 26
X 45
Y 22
Z 46

Punctuation

Key Code
. 53
, 62

Control

Key Code
Enter 63
Backspace 71
Left 55
Right 51

Modifiers

Key Bitmask
Shift 1
Green Square 2
Orange Circle 4
People 8

Code to Key

This table is the inverse of the data above.

Code Key
11 7
12 6
13 5
14 4
15 3
16 2
17 1
21 U
22 Y
23 T
24 R
25 E
26 W
27 Q
31 J
32 H
33 G
34 F
35 D
36 S
37 A
41 N
42 B
43 V
44 C
45 X
46 Z
51 Right
52 M
53 .
54 Space
55 Left
62 ,
63 Enter
64 P
65 0
66 9
67 8
71 Backspace
72 L
75 O
76 I
77 K
  1_ 2_ 3_ 4_ 5_ 6_ 7_
_1 7 U J N Right   Backspace
_2 6 Y H B M , L
_3 5 T G V . Enter  
_4 4 R F C Space P  
_5 3 E D X Left 0 O
_6 2 W S Z   9 I
_7 1 Q A     8 K

More Cliffle

By Topic