# P.I. Engineering SDK Help

## PS2 Host Emulator Data Report

### General Information

VID | 05f3h
PID | 020Dh or 525
Consumer Usage Page | 1
Usage Page | 000Ch or 12

### PS2 Host Emulator Input Report

Endpoint: 1, consumer usage page.

Report Length: 9 bytes.

1. Keyboard Data

Byte 1* | Byte 2 | Byte 3 | Byte 4 | Byte 5 | Byte 6 | Byte 7 | Byte 8 | Byte 9
Constant | Keyboard Data ID | 1st Key Pressed | 2nd Key Pressed | 3rd Key Pressed | 4th Key Pressed | Reserved | Reserved | Reserved
0 | DataType | HidCode | HidCode | HidCode | HidCode | value | value | value

DataType: Identifies that the following data is keyboard data, DataType has a value of 5 if the keyboard is plugged into the port labeled Device 1 and a value of 1 if the keyboard is plugged into the port labeled Device 2.
HidCode: The value of HidCode is the actual Hid Code value of the key pressed, or 0 if no key is pressed. Modifier keys are an exception, the values of 160-167 instead of 224-231. See Hid Code Table below for more information.

2. Mouse Data

Byte 1* | Byte 2 | Byte 3 | Byte 4 | Byte 5 | Byte 6 | Byte 7 | Byte 8 | Byte 9
Constant | Mouse Data ID | Mouse Buttons | X Position | Y Position | Scroll | Reserved | Reserved | Reserved
0 | DataType | Buttons | XPos | YPos | Scroll | value | value | value

DataType: Identifies that the following data is mouse data, DataType has a value of 8 if the keyboard is plugged into the port labeled Device 1 and a value of 4 if the keyboard is plugged into the port labeled Device 2.
Buttons: Bit 1= Left, bit 2= Right, bit 3=Center.
XPos: Indicates the mouse horizontal position, signed byte 0-255.
YPos: Indicates the mouse vertical position, signed byte 0-255.
Scroll: 1 for scroll up, 255 for scroll down.

### PS2 Host Emulator Output Report

The following output report is available; Change Mouse Message Speed.

Endpoint: 2, vendor defined usage page.

Report Length: 9 bytes.

1. Change Mouse Message Speed

To slow the mouse messages down it is necessary to send two WriteData messages with about 30-40ms delay between each.

Byte 1* | Byte 2 | Byte 3 | Byte 4 | Byte 5 | Byte 6 | Byte 7 | Byte 8 | Byte 9
Constant | Mouse Port | Speed Command | Constant | Constant | Constant | Constant | Constant | Constant
0 | MousePort | 243 | 0 | 0 | 0 | 0 | 0 | 0

Byte 1* | Byte 2 | Byte 3 | Byte 4 | Byte 5 | Byte 6 | Byte 7 | Byte 8 | Byte 9
Constant | Mouse Port | Speed Command | Constant | Constant | Constant | Constant | Constant | Constant
0 | Mouseport | Speed | 0 | 0 | 0 | 0 | 0 | 0

MousePort: The port into which the mouse is plugged into, use 0 if mouse is plugged into the port labeled Device 2 and 1 if mouse is plugged into the port labeled Device 1.
Speed: The value of Speed is 20 for a moderate slow down (50ms) or 10 for even more delay (100ms). To reset the mouse message speed to the default set Speed to 60.

Hid Code Table

Each key on the keyboard has an associated 3 digit HID code. The following lists each key code and its associated key. The Key Description lists the key description using the English language keyboard. If the operating system has loaded a different language in the Keyboard Properties- Language some codes will have different output. For example scan code 039 is a semicolon (;) in English but in Swedish it is ö.

HID Key Code | HID Key Code(Hex) | Key Description
--- | --- | ---
000 | 00 | Reserved (no event indicated)
001 | 01 | Keyboard ErrorRollOver
002 | 02 | Keyboard POSTFail
003 | 03 | Keyboard ErrorUndefined
004 | 04 | Keyboard a and A
005 | 05 | Keyboard b and B
006 | 06 | Keyboard c and C
007 | 07 | Keyboard d and D
008 | 08 | Keyboard e and E
009 | 09 | Keyboard f and F
010 | 0A | Keyboard g and G
011 | 0B | Keyboard h and H
012 | 0C | Keyboard i and I
013 | 0D | Keyboard j and J
014 | 0E | Keyboard k and K
015 | 0F | Keyboard l and L
016 | 10 | Keyboard m and M
017 | 11 | Keyboard n and N
018 | 12 | Keyboard o and O
019 | 13 | Keyboard p and P
020 | 14 | Keyboard q and Q
021 | 15 | Keyboard r and R
022 | 16 | Keyboard s and S
023 | 17 | Keyboard t and T
024 | 18 | Keyboard u and U
025 | 19 | Keyboard v and V
026 | 1A | Keyboard w and W
027 | 1B | Keyboard x and X
028 | 1C | Keyboard y and Y
029 | 1D | Keyboard z and Z
030 | 1E | Keyboard 1 and !
031 | 1F | Keyboard 2 and @
032 | 20 | Keyboard 3 and #
033 | 21 | Keyboard 4 and $
034 | 22 | Keyboard 5 and %
035 | 23 | Keyboard 6 and ^
036 | 24 | Keyboard 7 and &
037 | 25 | Keyboard 8 and *
038 | 26 | Keyboard 9 and (
039 | 27 | Keyboard 0 and )
040 | 28 | Keyboard Return (ENTER)
041 | 29 | Keyboard ESCAPE
042 | 2A | Keyboard DELETE (Backspace)
043 | 2B | Keyboard Tab
044 | 2C | Keyboard Spacebar
045 | 2D | Keyboard - and (underscore)
046 | 2E | Keyboard = and +
047 | 2F | Keyboard [ and {
048 | 30 | Keyboard ] and }
049 | 31 | Keyboard \ and |
050 | 32 | Keyboard Non-US # and~
051 | 33 | Keyboard ; and :
052 | 34 | Keyboard ' and "
053 | 35 | Keyboard ` and ~
054 | 36 | Keyboard , and <
055 | 37 | Keyboard . and >
056 | 38 | Keyboard / and ?
057 | 39 | Keyboard Caps Lock
058 | 3A | Keyboard F1
059 | 3B | Keyboard F2
060 | 3C | Keyboard F3
061 | 3D | Keyboard F4
062 | 3E | Keyboard F5
063 | 3F | Keyboard F6
064 | 40 | Keyboard F7
065 | 41 | Keyboard F8
066 | 42 | Keyboard F9
067 | 43 | Keyboard F10
068 | 44 | Keyboard F11
069 | 45 | Keyboard F12
070 | 46 | Keyboard PrintScreen
071 | 47 | Keyboard Scroll Lock
072 | 48 | Keyboard Pause
073 | 49 | Keyboard Insert
074 | 4A | Keyboard Home
075 | 4B | Keyboard PageUp
076 | 4C | Keyboard Delete Forward
077 | 4D | Keyboard End
078 | 4E | Keyboard PageDown
079 | 4F | Keyboard RightArrow
080 | 50 | Keyboard LeftArrow
081 | 51 | Keyboard DownArrow
082 | 52 | Keyboard UpArrow
083 | 53 | Keypad Num Lock and Clear
084 | 54 | Keypad /
085 | 55 | Keypad *
086 | 56 | Keypad -
087 | 57 | Keypad +
088 | 58 | Keypad ENTER
089 | 59 | Keypad 1 and End
090 | 5A | Keypad 2 and Down Arrow
091 | 5B | Keypad 3 and PageDn
092 | 5C | Keypad 4 and Left Arrow
093 | 5D | Keypad 5
094 | 5E | Keypad 6 and Right Arrow
095 | 5F | Keypad 7 and Home
096 | 60 | Keypad 8 and Up Arrow
097 | 61 | Keypad 9 and PageUp
098 | 62 | Keypad 0 and Insert
099 | 63 | Keypad . and Delete
101 | 65 | Keyboard Application
102 | 66 | Keyboard Power
103 | 67 | Keypad =
104 | 68 | Keyboard F13
105 | 69 | Keyboard F14
106 | 6A | Keyboard F15
107 | 6B | Keyboard F16
108 | 6C | Keyboard F17
109 | 6D | Keyboard F18
110 | 6E | Keyboard F19
111 | 6F | Keyboard F20
112 | 70 | Keyboard F21
113 | 71 | Keyboard F22
114 | 72 | Keyboard F23
115 | 73 | Keyboard F24
116 | 74 | Keyboard Execute
117 | 75 | Keyboard Help
118 | 76 | Keyboard Menu
119 | 77 | Keyboard Select
120 | 78 | Keyboard Stop
121 | 79 | Keyboard Again
122 | 7A | Keyboard Undo
123 | 7B | Keyboard Cut
124 | 7C | Keyboard Copy
125 | 7D | Keyboard Paste
126 | 7E | Keyboard Find
127 | 7F | Keyboard Mute
128 | 80 | Keyboard Volume Up

The following codes are not Hid codes but unique to the PS2 Host Emulator:
102 66 Pause/Break
160 A0 Left Ctrl
161 A1 Left Shift
162 A2 Left Alt
163 A3 Left Win
164 A4 Right Ctrl
165 A5 Right Shift
166 A6 Right Alt
167 A7 Right Win

*This first byte may be omitted on some non-PC operating systems. On these systems the read and write lengths will be 1 byte smaller.

Back to top