This is an old revision of the document!
Work In Progress
Written By Dominic Clifton (C) 2007
Data is transferred two and from the Ergodex DX1's second interface (the first interface is a HID USB Keyboard) in multiple of 16 bytes.
After snooping the USB communications between the host machine and the Ergodex DX1 I've found out the following information (which is incomplete, please
16 bytes per command.
Byte 1: Command Code Bytes 2-16: Command Data
Usage
Send when device is idle.
Command Code
0x02
Command Data
The 15 byes of command data is made up as follows:
* Byte 1: unknown, use 0x00 * Byte 2: unknown (seen values 0x00 and 0x01, use 0x00 for now) * Byte 3: set leds - bitmask
0x00 - 00000000 - all led's off 0x01 - 00000001 - green led on, red led off 0x02 - 00000010 - green led off, red led on 0x03 - 00000011 - green led on, red led on
* Byte 4: unknown use 0x00
* Byte 5: This byte seems to control whether the main keys on the erogodex send back any data when pressed
0x00 - enable keymap, all programmed keys will now send back data when pressed 0x01 - clear keymap, all previously programmed keys are cleared from the device's memory.
* Byte 5: unknown, ergodex and ryan's drivers set this to 0x01 before and after sending one or more “Program Keys” commands, if left set at 0x00 the device appears to work as expected.
* Byte 6: unknown, ergodex and ryan's drivers set this to 0x01 before and after sending one or more “Program Keys” commands, if left set at 0x00 the device appears to work as expected.
Examples:
* Sent by erogdex software each time it changes the keyboard layout, before the “Program Keys” commands
00 00 01 00 01 01 01 00 00 00 00 00 00 00 00
* Sent by erogdex software each time it changes the keyboard layout, after the “Program Keys” commands
02 00 00 01 00 00 01 01 00 00 00 00 00 00 00 00
Contents unknown at present.
Usage
Program up to 4 keys per command
Command Code
0x03
Command Data
3 bytes per key (below) If a key is not to be programmed then pad the command with 0x00's
Then for each key that has a single key macro assigned to it sends 3 bytes
Key types:
0x01 - "Single Key" 0x02 - "Modifier Key" 0x03 - "Macro"
When key is:
Byte 3: Set to a valid Keyboard Scan Code
See Keyboard Scan Code Specification [References 1,2] Appendix C: USB Keyboard/Keypad Page (0x07)
Byte 3: Set as follows
0x01 LEFT CTRL 0x02 LEFT SHIFT 0x04 LEFT ALT 0x08 LEFT WIN KEY (Left GUI Key) 0x10 RIGHT CTRL 0x20 RIGHT SHIFT 0x40 RIGHT ALT 0x80 RIGHT WIN KEY (Right GUI Key)
Byte 3: Empty Value (0x00)
When keys are assigned “Single” or “Modifer” keys data is received by the HID interface for key up and key down events (8 bytes per event, see below)
When keys are assigned “Macro” keys data is received by the “control” interface for key up and key down events (16 bytes per event)
Example of data sent when switching to an application that has a profile enabled for it.
000003: Bulk or Interrupt Transfer (UP), 06.02.2007 14:50:42.4375000 +5.0312500 Pipe Handle: 0x88094694 (Endpoint Address: 0x2) Send 0x10 bytes to the device: 02 00 00 01 00 01 01 01 00 00 00 00 00 00 00 00 ................ 000004: Bulk or Interrupt Transfer (UP), 06.02.2007 14:50:42.4843750 +0.0468750 Pipe Handle: 0x88094694 (Endpoint Address: 0x2) Send 0x30 bytes to the device: 03 01 02 02 02 03 00 03 03 00 04 03 00 0E 03 00 ................ 03 12 03 00 18 03 00 1B 03 00 29 03 00 2C 03 00 ..........)..,.. 02 00 00 01 00 00 01 01 00 00 00 00 00 00 00 00 ................
Usage
Sent when device is idle.
Command Code
0x0A
Command Data
Fill with 0x00's
Command Response:
16 bytes
Events are triggered by the device when keys are pressed on it. Which events you receive depend upon the device's status.
The HID interface receives the following events:
Each HID event causes the device to send 8 bytes of data.
If a key assigned to a “Modifier Key” is pressed at the same time as one or more keys assigned to “Modifier Key” or a single key assigned to “Single Key” then only one event is received and the data is combined. e.g. if you assign keys 1-Shift, 2-Control, 3-A, 4-B and press 1 2 and 3 at the same time you'll get one event, if you press keys 1-4 you'll get two events. (TODO: double check)
There's not much point going into further detail regarding the HID event data as it should be the same as any other standard USB keyboard.
One thing to note is if you program keys 1-3 with ctrl and alt and shift and press them all at the same time you receive the following data
07 00 00 00 00 00 00 00
This indicates the values are additive, it has been reported it's possible to assign a key to “Modifier Key” and use the value 0x07 which simulates pressing all the keys together.
The control interface receives the following events:
Each HID event causes the device to send 16 bytes of data.
The first byte indicates the event type
The next 15 bytes are different depending on the event type
Status Changed
The remaining 15 bytes of data is made up as follows
The last two bits indicate the current status of the buttons
0x00 - 00 - both buttons pressed 0x01 - 01 - record button pressed 0x02 - 10 - hand button pressed 0x03 - 11 - no buttons pressed
It looks like byte 5 is set as follows:
0x01 - keys are enabled 0x00 - keys are enabled
TODO: verify this
* Bytes 6-15: unknown (only seen filled with 0x00's)
Macro Key Pressed
The remaining 15 bytes of data is made up as follows
when a key is pressed the value corresponds to number printed on the physical keys
0x00 when no keys assigned to “Macro Key” are pressed.
TODO: try creating a few “Macro Key” assignments and try various combinations of pressing and releasing.
- Key Support, Keyboard Scan Codes, and Windows
http://www.microsoft.com/whdc/device/input/Scancode.mspx
- Keyboard Scan Code Specification
http://download.microsoft.com/download/1/6/1/161ba512-40e2-4cc9-843a-923143f3456c/scancode.doc