When reading data from a device, events are received as data packets, with a header as described above. Here we provide (very rudimentary) documentation for the format of the device-dependent data, for at least one type of mouse and keyboard (specifically, the 46060A two-button mechanical mouse and 46021A keyboard); other mice and keyboards may or may not be similar.
The first byte of data is a bitmask. Only two bits have known meaning:
0x02
The data portion contains mouse motion deltas, two signed 8-bit quantities, X delta first.
0x40
The data portion contains a key or mouse button up/down event, one byte. The low bit is 0 if the event is a ‘down' event, 1 if an ‘up' event. The other seven bits identify the key or button, according to the table below.
If both bits are set, the mouse deltas appear before the button byte.
The known identifying values for key/button events are (only the 0xfe bits are listed):
0x04
‘Extend char' (right-hand).
0x06
‘Extend char' (left-hand).
0x08
‘Shift' (right-hand).
0x0a
‘Shift' (left-hand).
0x10
4, on the numeric keypad.
0x12
8, on the numeric keypad.
0x14
5, on the numeric keypad.
0x16
9, on the numeric keypad.
0x18
6, on the numeric keypad.
0x1a
7, on the numeric keypad.
0x1c
The comma key on the numeric keypad.
0x1e
‘Enter', on the numeric keypad.
0x20
1, on the numeric keypad
0x22
The slash key on the numeric keypad.
0x24
2, on the numeric keypad.
0x26
The plus key on the numeric keypad.
0x28
3, on the numeric keypad.
0x2a
The asterisk key on the numeric keypad.
0x2c
0, on the numeric keypad.
0x2e
The minus key on the numeric keypad.
0x42
The second (counting from the left) of the four unmarked keys at the top right.
0x46
The third (counting from the left) of the four unmarked keys at the top right.
0x48
The period key on the numeric keypad.
0x4a
The leftmost of the four unmarked keys at the top right.
0x4c
The ‘Tab' key on the numeric keypad.
0x4e
The rightmost of the four unmarked keys at the top right.
0x70
The digit-7 / ampersand key.
0x72
The digit-6 / circumflex key.
0x74
The digit-5 / percent-sign key.
0x76
The digit-4 / dollar-sign key.
0x78
The digit-3 / hash-mark key.
0x7a
The digit-2 / at-sign key.
0x7c
The digit-1 / exclamation-point key.
0x7e
The backquote / tilde key.
0xb0
The digit-8 / asterisk key.
0xb2
The digit-9 / left-parenthesis key.
0xb4
The digit-0 / right-parenthesis key.
0xb6
The minus-sign / underscore key.
0xb8
The equal-sign / plus-sign key.
0xc6
The left-bracket / left-brace key.
0xc8
The right-bracket / right-brace key.
0xca
The backslash / vertical-bar key.
0xd6
The semicolon / colon key.
0xd8
The single-quote / double-quote key.
0xdc
The arrow key pointing up and left.
0xe2
The period / less-than key.
0xe4
The comma / greater-than key.
0xe6
The slash / question-mark key.
0xf8
The left-pointing arrow key.
0xfa
The down-pointing arrow key.
0xfc
The up-pointing arrow key.
0xfe
The right-pointing arrow key.