User Tools

Site Tools


usb_protocol_information

This is an old revision of the document!


Work In Progress

Ergodex DX1 protocol

Written By Dominic Clifton (C) 2007

Overview

Data is transferred to and from the Ergodex DX1's second interface in multiple of 16 bytes. We refer this second interface as the “Control” interface. The first interface is a HID USB Keyboard.

After snooping the USB communications between the host machine and the Ergodex DX1 the following information has been compiled.

We split up the information into requests and responses

Control Requests

16 bytes per request.

* Byte 1: Request Code

* Bytes 2-16: Request Data

Request data is different for each request.

Set Device

Usage

Send when device is idle.

Request Code

0x02

Request Data

The 15 byes of request data is made up as follows:

  • Byte 1: unknown, use 0x00
  • Byte 2: unknown (seen values 0x00 and 0x01, use 0x00 for now)
0x01 - enable "Test" mode.

When the device is in this mode will cause a “Control” device “Key Test” event to be raised when pressing or releasing any key.

0x00 - normal mode
  • 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 6: unknown, ergodex and ryan's drivers set this to 0x01 before and after sending one or more “Program Keys” requests, if left set at 0x00 the device appears to work as expected.
  • Byte 7: unknown, ergodex and ryan's drivers set this to 0x01 before and after sending one or more “Program Keys” requests, 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” requests
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” requests
00 00 01 00 00 01 01 00 00 00 00 00 00 00 00
  • Sent by erogdex software when you focus the ergodex manager window
00 01 01 00 01 01 01 00 00 00 00 00 00 00 00

Contents unknown at present.

Program Keys

Usage

Program up to 5 keys per requests

Request Code

0x03

Request Data

3 bytes per key (below) If a key is not to be programmed then pad the request with 0x00's

Then for each key that has a single key macro assigned to it sends 3 bytes

  • Byte 1: key number in hex (corresponds to the number on the physical key itself) 0x01 for Key 1, etc
  • Byte 2: “Key Type”

Key types:

0x01 - "Single Key"
0x02 - "Modifier Key"
0x03 - "Macro"
  • Byte 3: different depending on “Key Type”

When key is:

  • “Single Key”

Byte 3: Set to a valid Keyboard Scan Code

See Keyboard Scan Code Specification [References 1,2] Appendix C: USB Keyboard/Keypad Page (0x07)

  • “Modifier Key”

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)
  • “Macro 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   ................

Status Inquiry

Usage

Sent when device is idle.

Request Code

0x01

Request Data

Fill with 0x00's

Get Device Information

Use to request a “Device Information” response.

Usage

Sent when device is idle.

Request Code

0x0A

Request Data

Fill with 0x00's

Event and Response Data

HID Events are triggered by the device when keys are pressed on it. Which events you receive depend upon the device's status.

HID Events

The HID interface receives the following events:

  • Key pressed and released events for keys assigned to “Single Key” or “Modifier Key” by the “Program Keys” command.

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.

Control Responses

The ergodex pad sends the sends data to the control interface when:

  • Hand button pressed or released
  • Record button pressed or released
  • Key pressed or released for keys assigned to “Macro Key” by a “Program Keys” request.
  • Key pressed or released when the pad is in “Test” mode.
  • Status Requested
  • Serial Number Requested

Data is set to the control interface in 16 byte blocks.

  • Byte 1: “Event Type” code.
  • Bytes 2-16: 15 bytes which is different for each response.

Status Changed

Sent in response to a status inquiry request or because the device's status changed due to the “Hand” or “Record” buttons being pressed.

Event Type Code

0x01

Data

The remaining 15 bytes of data is made up as follows

  • Byte 1: unknown (seen value 0x04 only)
  • Byte 2: status of something (seen values 0x00 and 0x01) - might be of led or whether keys are active?
  • Byte 3: status of something (seen values 0x00 and 0x01) - might be of led or whether keys are active?
  • Byte 4: bit-mapped button status.

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
  • Byte 5: status of something (seen values 0x00 and 0x01) - might be of led or whether keys are active?

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

Sent as soon as a key assigned to “Macro Key” is pressed or released.

Event Type Code

0x02

Data

The remaining 15 bytes of data is made up as follows

  • Byte 1: unknown (seen value 0x01)
  • Byte 2: unknown (seen value 0x01)
  • Bytes 3-8:

when a key is pressed the values corresponds to number printed on the physical keys

if one key is pressed then byte 3 will be the number of the key pressed, bytes 4-8 will contain 0x00

if two keys are pressed then byte 3 and 4 will contain the numbers of the key that are currently pressed in random order, bytes 5-8 will contain 0x00

and so on, up to 6 keys.

  • Bytes 9-15: unknown (only seen filled with 0x00's)

Test

Sent as soon as a key is pressed or released when the device is in “Test” mode.

Event Type Code

0x03

Data

The data for this response appears to be the same as the “Macro Key Pressed” response.

Device Information

Sent in response to a “Get Device Information” request

Event Type Code

0x0A

Data

The remaining 15 bytes of data is made up as follows

  • Bytes 1-8: PCB serial number? - appears to always be different from serial number printed underneath each ergodex. The numbers seem to bear no relation, but this number always uniquely identifies a DX1 pad.
  • Bytes 9-10: binary status flags? pcb and or firmware revision numbers? (seen value 0x0101 only)
  • Bytes 11-15: unknown (seen value 0x0000000000 only)

References

usb_protocol_information.1170886354.txt.gz · Last modified: 2007/02/07 23:12 (external edit)