Joystick Mapping Information for Game Developers

General

  1. EdgeTX can output joystick / gamepad information via USB HID with ID (VID_1209&PID_4F54 / 1209:4F54).
  2. EdgeTX performs configurable input processing including dead bands, mixing, and non-linear scaling.
  3. A wide variety of controllers run EdgeTX. By default all devices output the same "Classic Joystick" report format with 8 analog axis and 24 digital buttons.
  4. Buttons are digital (0 = off, 1 = on).
  5. Analog axis have 11 bit resoultion.

Linux: evdev

Linux's evdev API uses open (fcntl.h) with /dev/input/event[...] and read (unistd.h) to read input_event (linux/joystick.h).

identity

  1. EVIOCGID : device_id.vendor is 4617 / 0x1209
  2. EVIOCGID : device_id.product is 20308 / 0x4F54

input labels

EdgeTXevent nameevent code
CH1ABS_XEV_ABS 0
CH2ABS_YEV_ABS 1
CH3ABS_ZEV_ABS 2
CH4ABS_RXEV_ABS 3
CH5ABS_RYEV_ABS 4
CH6ABS_RZEV_ABS 5
CH7ABS_THROTTLEEV_ABS 6
CH8ABS_RUDDEREV_ABS 7
CH9BTN_SOUTHEV_KEY 304 / 0x130
CH10BTN_EASTEV_KEY 305 / 0x131
CH11BTN_CEV_KEY 306 / 0x132
CH12BTN_NORTHEV_KEY 307 / 0x133
CH13BTN_WESTEV_KEY 308 / 0x134
CH14BTN_ZEV_KEY 309 / 0x135
CH15BTN_TLEV_KEY 310 / 0x136
CH16BTN_TREV_KEY 311 / 0x137
CH17BTN_TL2EV_KEY 312 / 0x138
CH18BTN_TR2EV_KEY 313 / 0x139
CH19BTN_SELECTEV_KEY 314 / 0x13A
CH20BTN_STARTEV_KEY 315 / 0x13B
CH21BTN_MODEEV_KEY 316 / 0x13C
CH22BTN_THUMBLEV_KEY 317 / 0x13D
CH23BTN_THUMBREV_KEY 318 / 0x13E
CH24(no name)EV_KEY 319 / 0x13F
CH25BTN_TRIGGER_HAPPY1EV_KEY 704 / 0x2C0
CH26BTN_TRIGGER_HAPPY2EV_KEY 705 / 0x2C1
CH27BTN_TRIGGER_HAPPY3EV_KEY 706 / 0x2C2
CH28BTN_TRIGGER_HAPPY4EV_KEY 707 / 0x2C3
CH29BTN_TRIGGER_HAPPY5EV_KEY 708 / 0x2C4
CH30BTN_TRIGGER_HAPPY6EV_KEY 709 / 0x2C5
CH31BTN_TRIGGER_HAPPY7EV_KEY 710 / 0x2C6
CH32BTN_TRIGGER_HAPPY8EV_KEY 711 / 0x2C7

Linux: joystick

Linux's joystick API uses open (fcntl.h) with /dev/input/js and read (unistd.h) to read js_event (linux/joystick.h).

identity

JSIOCGNAME is "EdgeTX [...] Joystick" or "OpenTX [...] Joystick". The middle part ("[...]") is device specific.

input labels

EdgeTXread js_event
CH1JS_EVENT_AXIS 0
CH2JS_EVENT_AXIS 1
[...][...]
CH8JS_EVENT_AXIS 7
CH9JS_EVENT_BUTTON 0
CH10JS_EVENT_BUTTON 1
[...][...]
CH32JS_EVENT_BUTTON 23

Windows: DirectInput

Windows's DirectInput uses IDirectInputDevice8::GetDeviceState to read DIJOYSTATE (dinput.h). DIJOYSTATE2 (c_dfDIJoystick2) outputs the same information.

identity

DIDEVICEINSTANCE.guidProduct starts with "4F541209-". The trailing part of the GUID is device specific.

input labels

EdgeTXDIJOYSTATE
CH1lX
CH2lY
CH3lZ
CH4lRx
CH5lRy
CH6lRz
CH7rglSlider[1]
CH8rglSlider[0]
CH9rgbButtons[0]
CH10rgbButtons[1]
[...][...]
CH32rgbButtons[23]

Windows: Multimedia

Windows' Multimedia API uses joyGetPosEx to read JOYINFOEX (joystickapi.h). The older joyGetPos / JOYINFO only support CH1-CH3 and CH9-CH32 with the same mapping as the newer JOYINFOEX.

identity

  1. JOYCAPS.wMid is 4617 / 0x1209
  2. JOYCAPS.wPid is 20308 / 0x4F54

input labels

EdgeTXJOYINFOEX
CH1dwXpos
CH2dwYpos
CH3dwZpos
CH4dwVpos
CH5(not available)
CH6dwRpos
CH7dwUpos
CH8(not available)
CH9dwButtons & 0x000001
CH10dwButtons & 0x000002
CH11dwButtons & 0x000004
[...][...]
CH32dwButtons & 0x800000

Windows: Raw Input

Windows' Raw Input API uses GetRawInputData (WinUser.h), HidP_GetUsageValue and HidP_GetUsages (hidpi.h).

identity

  1. RID_DEVICE_INFO_HID.dwVendorId is 4617 / 0x1209
  2. RID_DEVICE_INFO_HID.dwProductId is 20308 / 0x4F54

input labels

EdgeTXHidP_Get[...]ValueUsagePageUsage
CH1HidP_GetValueCaps [7]0x010x30
CH2HidP_GetValueCaps [6]0x010x31
CH3HidP_GetValueCaps [5]0x010x32
CH4HidP_GetValueCaps [4]0x010x33
CH5HidP_GetValueCaps [3]0x010x34
CH6HidP_GetValueCaps [2]0x010x35
CH7HidP_GetValueCaps [1]0x010x36
CH8HidP_GetValueCaps [0]0x010x37
CH9HidP_GetButtonCaps [0]0x090x01
CH10HidP_GetButtonCaps [0]0x090x02
[...][...][...][...]
CH32HidP_GetButtonCaps [0]0x090x18

Windows: Windows.Gaming.Input

Windows' RawGameController uses winrt::Windows::Gaming::Input::RawGameController (winrt/Windows.Gaming.Input.h).

identity

  1. RawGameController::HardwareVendorId is 4617 / 0x1209
  2. RawGameController::HardwareProductId is 20308 / 0x4F54

input labels

EdgeTXGetCurrentReading
CH1axisArray[0]
CH2axisArray[1]
[...][...]
CH8axisArray[7]
CH9buttonArray[0]
CH10buttonArray[1]
[...][...]
CH32buttonArray[23]