# P.I. Engineering SDK Help

## X-keys XC-RS232-DB9 Data Report

### General Information

The X-keys XC-RS232-DB9 allows for the conversion of serial data to usb hid data and vis-versa. The XC-RS232-DB9 has the standard RS232 9 Pin Male connector. Connect a serial device to the 9 pin plug, connect the usb cord of the XC-RS232-DB9 to the computer. Incoming RS232 data is converted to a hid input report(s) as described below in input report 2. General Incoming RS232 from the Connected Serial Device. The connected serial device can be written to using output report 7. Send Command to RS232. Knowledge of the serial device's data structure is required. In addition the XC-RS232-DB9 has 12 digital inputs (6 ports with a left and right on each) to allow for switches to be connected. These switches can be programmed to send macros of all kinds including serial commands. X-keys Basic Setup utility can be used to program the macros. A unique feature of the XC-RS232-DB9 is that it does not have to be connected a computer, it can be self powered. This allows for a scenario where the switches have been hardware programmed with certain serial output messages, the usb plug can be plugged into any power source and the switches will send their macros when pressed.

VID | 05f3h
XC-RS232-DB9 PID #1 | 04E9h or 1257
XC-RS232-DB9 PID #2 | 04EAh or 1258
XC-RS232-DB9 PID #3 | 04EBh or 1259
XC-RS232-DB9 PID #4 | 04ECh or 1260
Consumer Usage Page | 1
Usage Page | 000Ch or 12

PID #1 Endpoints: Consumer Usge Page Input and Output (Hid Usage Page 12, Hid Usage 1), Mouse (Hid Usage Page 1, Hid Usage 2), Joystick (Hid Usage Page 1, Hid Usage 4).
PID #2 Endpoints: Consumer Usge Page Output (Hid Usage Page 12, Hid Usage 1), Mouse (Hid Usage Page 1, Hid Usage 2), Keyboard (Hid Usage Page 1, Hid Usage 6) and Multimedia (Hid Usage Page 12 and 1, Hid Usage 1 and 128). The use of this PID is mainly for Hardware Mode. Hardware Mode allows users to store macros to the device itself using the MacroWorks 3.1 programming utility or the X-keys Android app. Once the macros are stored they will work on any computer or OS that supports HID.
PID #3 Endpoints: Consumer Usge Page Output (Hid Usage Page 12, Hid Usage 1), Mouse (Hid Usage Page 1, Hid Usage 2), Joystick (Hid Usage Page 1, Hid Usage 4) and Multimedia (Hid Usage Page 12 and 1, Hid Usage 1 and 128). The use of this PID is mainly for Hardware Mode. Hardware Mode allows users to store macros to the device itself using the MacroWorks 3.1 programming utility or the X-keys Android app. Once the macros are stored they will work on any computer or OS that supports HID.
PID #4 Endpoints: Consumer Usge Page Input and Output (Hid Usage Page 12, Hid Usage 1), Boot Mouse (Hid Usage Page 1, Hid Usage 2), Boot Keyboard (Hid Usage Page 1, Hid Usage 6).

The IAB-RS232 is an Android enabled device in PIDs #1, #2 or #3. This means the device can be enumerated, read (if input report available), and written to on Android OS that support host USB, generally 3.1 or higher. Android OS is not able to enumerate a device with a boot keyboard and thus if the IAB-RS232 is in PID #4 it will appear to the Android OS as only a hardware keyboard/mouse, you will not be able to get a handle to it but it will work as a keyboard/mouse assuming there are hardware macros recorded on the keys.

IAB-RS232 is supported by P.I. Engineering X-keys Basic Setup for PC users, P.I. Engineering SDK samples for Microsoft C# Express, VB Express, Microsoft C++ 2010 and Eclipse and Linux.

### X-keys XC-RS232-DB9 Input Report

Figure 1: X-keys XC-RS232-DB9

Report Length: 37 bytes

1. General Incoming Data for XC-RS232-DB9 Switch Data

This data is returned when new data is detected such as button presses or unit id change. This report can be manually stimulated by sending an output report: Generate Data which is very useful for obtaining the initial state of the device immediately after enumeration. This report is available only in PID #1 and PID #4.

Byte 1* | Byte 2 | Byte 3 | Byte 4 | Byte 5 | Bytes 6-7 | Byte 8 | Bytes 9-37
Constant | Unit ID | Data Type | Jacks 1-4 | Jacks 5-6 | Reserved | NumLck, CapsLck, ScrLck | Reserved
0 | <data> | DT | D1 | D2 | value | D3 | value

DT: Data Type value of 0 or 2 indicates the following data is a General Incoming Data report, 2 if generated by the output report: Generate Data. Data Type value of 216 (0xd8) indicates incoming RS232 data from the connected serial device, see below. Data Type 217 (0xd9) indicates either a CTS Wait or CTS Clear from the connected serial device, see below. Data Type value of 214 (0xd6) indicates a Descriptor Data Report, see below. Data Type value of 224 (0xE0) indicates a Custom Data Report, see below.
D1: If using a splitter to read both L and R then for all bits 0 for switch open, 1 for switch closed. If plugging in only one switch to the jack then the corresponding R will always be closed for that jack. Bit 1=1R, bit 2=1L, bit 3=2R, bit 4=2L, bit 5=3R, bit 6=3L, bit 7=4R, bit 8=4L.
D2: If using a splitter to read both L and R then for all bits 0 for switch open, 1 for switch closed. If plugging in only one switch to the jack then the corresponding R will always be closed for that jack. Bit 1=5R, bit 2=5L, bit 3=6R, bit 4=6L, bits 5-8=na.
D3: Bit 1=NumLock, bit 2=CapsLock, bit 3=ScrLock, bit 4=On Boot (sets the bit when device is booted up by the usb then sets it back to 0) .

2. General Incoming RS232 from the Connected Serial Device

This data is returned when the connected serial device sends data. This report is available only in PID #1 and PID #4.

Byte 1* | Byte 2 | Byte 3 | Byte 4 | Byte 5 | Bytes 6 | Byte 7... | Bytes (Count+5)-37
Constant | Unit ID | Data Type | Count | Byte 1* | Byte 2 | Byte 3... | Reserved
0 | <data> | 216 | Count | value | value | value | value

Count: Number of bytes to follow, ignore the bytes above this count. For example if Count=3 then the first valid byte is Byte 5, next is Byte 6 and the last is Byte 7.

3. CTS Message from the Connected Serial Device

This data is returned when the connected serial device sends data. This report is available only in PID #1 and PID #4.

Byte 1* | Byte 2 | Byte 3 | Byte 4 | Bytes 5-37
Constant | Unit ID | Data Type | CTS | Reserved
0 | <data> | 217 | CTS | value

CTS: 0 means wait, 40h means clear to go.

4. Descriptor Data

This data is returned after an output report: Request for Descriptor is sent. This report is available only in PID #1 and PID #4.

Byte 1* | Byte 2 | Byte 3 | Byte 4 | Byte 5 | Byte 6 | Byte 7 | Byte 8 | Byte 9 | Byte 10 | Byte 11 | Byte 12 | Byte 13 | Byte 14 | Byte 15 | Byte 16 | Byte 17 | Bytes 18-27 | Byte 28 | Byte 29 | Byte 30 | Bytes 31-37
Constant | Unit ID | Data Type | Mode | Key mapstart | Layer2 Offset | Constant | Constant | Max Columns | Max Rows | LED State | Version | PID Low | PID Hi | Reserved | Max Address lo | Max Address hi | Reserved | Baud Rate | Reserved | Parity | Reserved
0 | <data> | 214 | Mode | 32 | 208 | 255 | 255 | 2 | 8 | LEDs | <data> | PIDL | PIDH | value | value | value | value | Baud | value | Parity | value

Mode: 0 means device is in PID #1, 1 = PID #2, 2 = PID #3, 3 = PID #4.
LEDs: Device has 4 digital outputs, this byte tells the current state of the outputs. Bit 1 set means Out 1 is on, bit 2 set means Out 2 is on, bit 7 set means Green LED is on, bit 8 set means Red LED is on.
PIDL: LSB of the Product Identification number or PID.
PIDH: MSB of the Product Identification number or PID.
Baud: 231/Baud gives baudrate in Kilo Baud. For example a value of 12 is 231/12=19.25 or 19250 baudrate.
Parity: 0=none, 2=Even, 6=Odd.

5. Custom Data

This data is returned after an output report: Generate Custom Data is sent. This report is available only in PID #1 and PID #4.

Byte 1* | Byte 2 | Byte 3 | Byte 4 | Byte 5 | Byte 6 | Byte 7 | Bytes Count+5 to 36 | Byte 37
Constant | Unit ID | Data Type | Count of custom bytes to follow | Custom byte 1 | Custom byte 2 | Custom byte 3... | Reserved | Increment
0 | <data> | 224 | Count | B1 | B2 | B3... | value | Increment

Count: Number of custom bytes to follow.
B1: 1st custom byte.
B2: 2nd custom byte.
B3: 3rd custom byte and so on for as many bytes as specified in Count.
Increment: This byte is incremented each time a Custom Data report is sent thus even if 2 identical reports are sent they will both come in even if SuppressDuplicate reports is on.

6. Check Dongle Key, available only on version 8 or higher.

This is received immediately following a Check Dongle Key output report is sent. The four values R0-R3 are required to continue the check. See Dongle Implementation for further details.

Byte 1* | Byte 2 | Byte 3 | Byte 4 | Byte 5 | Byte 6 | Byte 7 | Bytes 8 to 36
Constant | Unit ID | Data Type | 1st byte returned from hash | 2nd byte returned from hash | 3rd byte returned from hash | 4th byte returned from hash | Reserved
0 | <data> | 193 | R0 | R1 | R2 | R3 | value

R0: Value need for comparison to check for correct dongle key.
R1: Value need for comparison to check for correct dongle key.
R2: Value need for comparison to check for correct dongle key.
R3: Value need for comparison to check for correct dongle key.

### X-keys XC-RS232-DB9 Output Report

The following types of output reports are shown in the summary below. Available for all PIDs. Please be aware that several of these commands result in writing to the device's eeprom which has a limit to the number of writes allowed before it is "burnt out". The manufacturer's specification is 50,000 eeprom writes. Because of this we recommend the commands designated with e be executed rarely and not within timing loops. Note, the first byte listed in this documentation is 0 and represents the report ID. This is not present on some non-PC operating systems. So when sending an output report on Android for example, eliminate this byte.

Report | Format | Description
--- | --- | ---
1 | 0, 179, LEDIndex, State, 0... | Set LED
2 | 0, 189, UnitID, 0... | Set Unit IDe
3 | 0, 217, BaudRate, 0... | Set Baud Ratee
4 | 0, 219, Parity, 0... | Set Paritye
5 | 0, 218, RTS, 0 | Set RTS
6 | 0, 208, Val, 0... | Send to Keyboarde
7 | 0, 209, Count, B1, B2, B3, 0... | Send Command to RS232
8 | 0, 214, 0... | Request Descriptor
9 | 0, 177, 0... | Generate Data
10 | 0, 222, CMD_PASS, 0... | Obey Command/Pass Through Datae
11 | 0, 224, Count, B1, B2, B3..., 0... | Generate Custom Data
12 | 0, 204, Mode, 0... | Change PIDe
13 | 0, 201, Modifier, 0, HC1, HC2, HC3, HC4, HC5, HC6, 0... | Keyboard Reflector (PID #2 and #4 only)
14 | 0, 203, Buttons, Mouse X, Mouse Y, 0, Wheel Y, 0... | Mouse Reflector
15 | 0, 202, Joystick X, Joystick Y, Joystick Z rot., Joystick Z, Joystick Slider, Game Buttons 1, Game Buttons 2, Game Buttons 3, Game Buttons 4, 0, Point of View Hat, 0... | Joystick Reflector (PID #1 and #3 only)
16 | 0, 225, Usage ID LSB, Usage ID MSB, 0... | Multimedia Reflector (PID #2 and #3 only)
17 | 0, 195, Version LSB, Version MSB, 0... | Set Version Numbere
18 | 0, 238, 0... | Reboot Device
19 | 0, 192, K0, K1, K2, K3, 0... | Set Dongle Keye
20 | 0, 193, N0, N1, N2, N3, 0... | Check Dongle Key

eCommand writes to EEPROM, do not perform this command excessively, do not exceed 50,000 writes to EEPROM.

Endpoint: Vendor Defined Usage Page.

Report Length: 36 bytes.

1. Set LED

Send this output report to control the LEDs and the 2 additional digial outputs.

Byte 1* | Byte 2 | Byte 3 | Byte 4 | Bytes 5-36
Constant | Command | LED Index | LED State | Constant
0 | 179 | LEDIndex | LEDState | 0

LEDIndex: 6 = Green LED.
LEDState: 0 = off, 1 = on.

2. Set Unit ID

Send this output report to set the Unit ID of the device. This is useful if connecting more than one of the same device to the a computer.

Byte 1* | Byte 2 | Byte 3 | Bytes 4-36
Constant | Command | Unit ID (0-255) | Constant
0 | 189 | value | 0

3. Set Baud Rate

Sets the baud rate of the IAB-RS232 which must match that of the connected serial device in order to communicate.

Byte 1* | Byte 2 | Byte 3 | Bytes 4-36
Constant | Command | Baud Rate Index | Constant
0 | 217 | Baud | 0

Baud: 0=1200, 1=2400, 2=4800, 3=9600, 4=19200, 5=38400, 6=57600, 7=115400.

4. Set Parity

Sets the parity of the IAB-RS232 which must match that of the connected serial device in order to communicate.

Byte 1* | Byte 2 | Byte 3 | Bytes 4-36
Constant | Command | Parity Index | Constant
0 | 219 | Parity | 0

Parity: 0=None, 2=Even, 6=Odd.

5. Set RTS

Sets the RTS of the IAB-RS232.

Byte 1* | Byte 2 | Byte 3 | Bytes 4-36
Constant | Command | RTS Index | Constant
0 | 218 | RTS | 0

RTS: 0=Clear, 1=Wait.

6. Send to Keyboard

All incoming ASCII messages from the connected serial device will be converted and sent out to the keyboard. For example if there is an RS232 message "31 0D" when this message is sent "1" followed by a carriage return is typed out. This feature requires the IAB-RS232 to have a keyboard endpoint (PID#2 or #4).

Byte 1* | Byte 2 | Byte 3 | Bytes 4-36
Constant | Command | Send Index | Constant
0 | 210 | Val | 0

Val: 0=don't send to keyboard, 1=send to keyboard.

7. Send Command to RS232

Send commands to the connected serial device. Knowledge of the commands for the device is required.

Byte 1* | Byte 2 | Byte 3 | Byte 4 | Byte 5 | Byte 6 | Bytes (Count+4)-36
Constant | Command | Count | Byte 1* | Byte 2 | Byte 3... | Constant
0 | 209 | Count | B1 | B2 | B3... | 0

Count: Number of bytes to follow.
B1: Value of 1st byte
B2: Value of 2nd byte
B3: Value of 3rd byte and so forth

If the connected serial device has commands in ascii, for example B8; then put in the corresponding ascii codes for this: Count=3, B1=66, B2=56 and B3=59.

8. Request Descriptor

After sending this output report a Descriptor input report will be generated.

Byte 1* | Byte 2 | Bytes 3-36
Constant | Command | Constant
0 | 214 | 0

9. Generate Data

After sending this output report a General Incoming Data input report will be generated with bit 2 of PS set. This is useful in determining the initial state of the device before any data has changed.

Byte 1* | Byte 2 | Bytes 3-36
Constant | Command | Constant
0 | 177 | 0

10. Obey Commands/Pass Through Data

After sending this output report a Custom Data input report will be generated with Byte 2 set to 222 and the count and custom bytes following.

Byte 1* | Byte 2 | Byte 3 | Bytes 4 to 36
Constant | Command | Desired setting | Constant
0 | 222 | CMD_PASS | 0

CMD_PASS: Bit 1 is set if want device to obey output report commands sent over the RS232. This setting is only relevant for users wishing to control the XC-RS232-DB9 device from the connected serial device which would not be a normal application. Bit 2 is set if user wishes to receive incoming data from the connected RS232 device.

11. Generate Custom Data

After sending this output report a Custom Data input report will be generated with Byte 3 set to 224 and the count and custom bytes following.

Byte 1* | Byte 2 | Byte 3 | Byte 4 | Byte 5 | Byte 6... | Bytes (Count+4) to 36
Constant | Command | Count of custom bytes to follow | Custom byte 1 | Custom byte 2 | Custom byte 3... | Constant
0 | 224 | Count | B1 | B2 | B3... | 0

Count: Number of custom bytes to follow.
B1: 1st custom byte.
B2: 2nd custom byte.
B3: 3rd custom byte and so on for as many bytes as specified in Count.

12. Change PID

Send this output report to change between the four PIDs. This needs to be done if the user wishes a different combination of endpoints. The combinations are described above.

Byte 1* | Byte 2 | Byte 3 | Bytes 4-36
Constant | Command | Mode | Constant
0 | 204 | Mode | 0

Mode: 0 for PID #1, 1 for PID #2, 2 for PID #3 and 3 for PID #4.
PID #1 Endpoints: Consumer Usge Page Input and Output (Hid Usage Page 12, Hid Usage 1), Mouse (Hid Usage Page 1, Hid Usage 2), Joystick (Hid Usage Page 1, Hid Usage 4).
PID #2 Endpoints: Consumer Usge Page Output (Hid Usage Page 12, Hid Usage 1), Mouse (Hid Usage Page 1, Hid Usage 2), Keyboard (Hid Usage Page 1, Hid Usage 6) and Multimedia (Hid Usage Page 12 and 1, Hid Usage 1 and 128). The use of this PID is mainly for Hardware Mode. Hardware Mode allows users to store macros to the device itself using the MacroWorks 3.1 programming utility or the X-keys Android app. Once the macros are stored they will work on any computer or OS that supports HID.
PID #3 Endpoints: Consumer Usge Page Output (Hid Usage Page 12, Hid Usage 1), Mouse (Hid Usage Page 1, Hid Usage 2), Joystick (Hid Usage Page 1, Hid Usage 4) and Multimedia (Hid Usage Page 12 and 1, Hid Usage 1 and 128). The use of this PID is mainly for Hardware Mode. Hardware Mode allows users to store macros to the device itself using the MacroWorks 3.1 programming utility or the X-keys Android app. Once the macros are stored they will work on any computer or OS that supports HID.
PID #4 Endpoints: Consumer Usge Page Input and Output (Hid Usage Page 12, Hid Usage 1), Boot Mouse (Hid Usage Page 1, Hid Usage 2), Boot Keyboard (Hid Usage Page 1, Hid Usage 6).

13. Keyboard Reflector

Sends native keyboard messages. Must have the device set to a PID with a keyboard endpoint; PID #4 or PID #2.

Byte 1* | Byte 2 | Byte 3 | Byte 4 | Byte 5 | Byte 6 | Byte 7 | Byte 8 | Byte 9 | Byte 10 | Bytes 11-36
Constant | Command | Modifier | Constant | Hid Code 1 | Hid Code 2 | Hid Code 3 | Hid Code 4 | Hid Code 5 | Hid Code 6 | Constant
0 | 201 | Modifier | 0 | HC1 | HC2 | HC3 | HC4 | HC5 | HC6 | 0

Modifier: Bit 1=Left Ctrl, bit 2=Left Shift, bit 3=Left Alt, bit 4=Left Gui, bit 5=Right Ctrl, bit 6=Right Shift, bit 7=Right Alt, bit 8=Right Gui.
HC1=Hid Code for 1st key down, or 0 to release previous key press in this byte position.
HC2=Hid Code for 2nd key down, or 0 to release previous key press in this byte position.
HC3=Hid Code for 3rd key down, or 0 to release previous key press in this byte position.
HC4=Hid Code for 4th key down, or 0 to release previous key press in this byte position.
HC5=Hid Code for 5th key down, or 0 to release previous key press in this byte position.
HC6=Hid Code for 6th key down, or 0 to release previous key press in this byte position.

14. Mouse Reflector

Sends native mouse messages.

Byte 1* | Byte 2 | Byte 3 | Byte 4 | Byte 5 | Byte 6 | Byte 7 | Bytes 8-36
Constant | Command | Buttons | Mouse X | Mouse Y | Constant | Wheel Y | Constant
0 | 203 | Buttons | X | Y | 0 | WY | 0

Buttons: Bit 1=Left, bit 2=Right, bit 3=Center, bit 4=XButton1, bit 5=XButton2.
X=Mouse X motion. 128=0 no motion, 1-127 is right, 255-129=left, finest inc (1 and 255) to coarsest (127 and 129).
Y=Mouse Y motion. 128=0 no motion, 1-127 is down, 255-129=up, finest inc (1 and 255) to coarsest (127 and 129).
WY=Wheel Y. 128=0 no motion, 1-127 is up, 255-129=down, finest inc (1 and 255) to coarsest (127 and 129).
Example 1: Move mouse 1 mickey, the finest increment.
x+: 0, 203, 0, 1, 0, 0, 0
x-: 0, 203, 0, 255, 0, 0, 0
y+: 0, 203, 0, 0, 1, 0, 0
y-: 0, 203, 0, 0, 255, 0, 0
Example 2: Wheel Y with increment of 5.
+ motion: 0, 203, 0, 0, 0, 0, 5
- motion: 0, 203, 0, 0, 0, 0, 250 where 250=255-5
Example 3: Left button click.
left button down: 0, 203, 1, 0, 0, 0, 0
left button up: 0, 203, 0, 0, 0, 0, 0
Example 4: Left button down and drag
with mouse at starting position: 0, 203, 1, 0, 0, 0, 0
move mouse with button down: 0, 203, 1, 30, 30, 0, 0
release button: 0, 203, 0, 0, 0, 0, 0

15. Joystick Reflector

Sends native joystick messages. Must have the device set to a PID with a joystick endpoint; PID #1 or PID #3.

Byte 1* | Byte 2 | Byte 3 | Byte 4 | Byte 5 | Byte 6 | Byte 7 | Byte 8 | Byte 9 | Byte 10 | Byte 11 | Byte 12 | Byte 13 | Bytes 14-36
Constant | Command | Joystick X | Joystick Y | Joystick Z rot. | Joystick Z | Joystick Slider | Game Buttons | Game Buttons | Game Buttons | Game Buttons | Constant | Point of View Hat | Constant
0 | 202 | X | Y | Z rot. | Z | Slider | GB1 | GB2 | GB3 | GB4 | 0 | Hat | 0

X: Joystick X, 0-127 is from center to full right, 255-128 is from center to full left.
Y: Joystick Y, 0-127 is from center to bottom, 255-128 is from center to top.
Z rot.: Joystick Z rot., 0-127 is from center to bottom, 255-128 is from center to top.
Z.: Joystick Z, 0-127 is from center to bottom, 255-128 is from center to top.
Slider: Joystick Slider, 0-127 is from center to bottom, 255-128 is from center to top.
GB1: Game buttons 1-8, bit 1= game button 1, bit 2=game button 2, etc.
GB2: Game buttons 9-16, bit 1= game button 9, bit 2=game button 10, etc.
GB3: Game buttons 17-24, bit 1= game button 17, bit 2=game button 18, etc.
GB4: Game buttons 25-32, bit 1= game button 25, bit 2=game button 26, etc.
Hat: 0 to 7 clockwise, 8 is no hat.

16. Multimedia Reflector

Sends 2 byte multimedia messages. Must have the device set to a PID with a multimedia endpoint; PID #2 or PID #3. When in this PID there is no input data report available thus users of this feature will not be able to read any data, only write output reports. If desiring this feature users are instructed to use MacroWorks 3.1 programming utility for programming of the buttons and converting to a multimedia PID. This command must be followed with an "up" command with ULo and UHi =0.

Byte 1* | Byte 2 | Byte 3 | Byte 4 | Bytes 8-36
Constant | Command | Usage ID Lo | Usage ID Hi | Constant
0 | 225 | ULo | UHi | 0

ULo=Usage ID low byte see hut1_12.pdf, pages 75-85 Consumer Page.
UHi=Usage ID high byte see hut1_12.pdf, pages 75-85 Consumer Page.

Example: My Computer - 0, 225, 94, 01, 0... and send report using WriteData. Then 0, 225, 0, 0, 0... and send report using WriteData. In this example 0194 is the Usage ID for My Computer.

17. Set Version Number

Send this output report to set the Version of the device. This is not the firmware version given in the descriptor but a 2 byte number available on enumeration. The value is "remembered" so if it is changed, using this report, the device must be rebooted. The device can be rebooted by replugging it or by sending the output report : Reboot Device. The device is also rebooted when changing pids using output report: Change PID.

Byte 1* | Byte 2 | Byte 3 | Byte 4 | Bytes 5-36
Constant | Command | Version LB (0-255) | Version HB (0-255) | Constant
0 | 195 | value | value | 0

18. Reboot Device

Send this output report to reboot the device without having to unplug it. After sending this report the device must be re-enumerated.

Byte 1* | Byte 2 | Bytes 3-36
Constant | Command | Constant
0 | 238 | 0

19. Set Dongle Key

Sets the user entered key. Remember these numbers as they are required to check for the key. This is intented to be done once by the developer prior to sale. See Dongle Implemenation for more details.

Byte 1* | Byte 2 | Byte 3 | Byte 4 | Byte 5 | Byte 6 | Bytes 7-36
Constant | Command | 1st byte of key | 2nd byte of key | 3rd byte of key | 4th byte of key | Constant
0 | 192 | K0 | K1 | K2 | K3 | 0

K0: 1st byte of user determined dongle key, any number 1-254.
K1: 2nd byte of user determined dongle key, any number 1-254.
K2: 3rd byte of user determined dongle key, any number 1-254.
K3: 4th byte of user determined dongle key, any number 1-254.

20. Check Dongle Key

Checks the key that was entered in Set Dongle Key. This is intented to be done by the developer within their own software to determine if the connected X-keys device is the one they sold to the customer. 4 random bytes along with the actual key are entered into the DongleCheck2() hash function of the Piehid32.dll/PieHid32Net.dll which returns 4 bytes. Then after sending this output report a Check Dongle Key input report will be received containing the same 4 bytes returned from the hash if the key matches. See Dongle Implemenation for more details.

Byte 1* | Byte 2 | Byte 3 | Byte 4 | Byte 5 | Byte 6 | Bytes 7-36
Constant | Command | Random number | Random number | Random number | Random number | Constant
0 | 192 | N0 | N1 | N2 | N3 | 0

K0: 1st byte of a random number that was used in the hash, any number 1-254.
K1: 2nd byte of a random number that was used in the hash, any number 1-254.
K2: 3rd byte of a random number that was used in the hash, any number 1-254.
K3: 4th byte of a random number that was used in the hash, any number 1-254.

*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