Skip to content

Configuration

Configuration

The OpenArcade server configuration controls device mappings, button assignments, and system behavior.

Config File Location

EnvironmentPath
Production/var/lib/openarcade/config.json
Development./config.json (working directory)

Config File Structure

{
"devices": {
"AA:BB:CC:DD:EE:FF": {
"name": "Left Buttons",
"descriptor": {
"type": "button_panel",
"num_buttons": 8
},
"active_mode": "keyboard",
"modes": {
"keyboard": {
"1": { "keycode": "HID_KEY_Z" },
"2": { "keycode": "HID_KEY_X" },
"3": { "keycode": "HID_KEY_C" }
}
},
"ui_bindings": {
"button_1": "1",
"button_2": "2"
},
"last_seen": "2024-03-15T10:30:00Z"
}
},
"global": {
"default_mode": "keyboard",
"scan_interval_ms": 100
}
}

Device Configuration

Basic Fields

FieldTypeDescription
namestringHuman-readable device name
descriptorobjectDevice capabilities
active_modestringCurrently active mapping mode
last_seenISO 8601Last connection timestamp

Descriptor

Describes the device’s physical capabilities:

{
"descriptor": {
"type": "button_panel",
"num_buttons": 8,
"has_joystick": false,
"has_display": true
}
}

Modes

Multiple mapping profiles per device:

{
"modes": {
"keyboard": {
"1": { "keycode": "HID_KEY_Z" },
"2": { "keycode": "HID_KEY_X" }
},
"fighting": {
"1": { "keycode": "HID_KEY_A" },
"2": { "keycode": "HID_KEY_S" }
}
}
}

UI Bindings

Maps visual UI buttons to physical controls:

{
"ui_bindings": {
"button_1": "1",
"button_2": "2",
"joystick_up": "joy_u"
}
}

Keycode Reference

Standard USB HID keycodes are supported:

Letters

HID_KEY_A through HID_KEY_Z

Numbers

HID_KEY_0 through HID_KEY_9

Function Keys

HID_KEY_F1 through HID_KEY_F12

Special Keys

KeycodeKey
HID_KEY_ENTEREnter
HID_KEY_ESCAPEEscape
HID_KEY_BACKSPACEBackspace
HID_KEY_TABTab
HID_KEY_SPACESpace

Arrows

KeycodeKey
HID_KEY_RIGHT_ARROW
HID_KEY_LEFT_ARROW
HID_KEY_DOWN_ARROW
HID_KEY_UP_ARROW

Modifiers

KeycodeKey
HID_KEY_LEFT_CTRLLeft Control
HID_KEY_LEFT_SHIFTLeft Shift
HID_KEY_LEFT_ALTLeft Alt

Global Configuration

{
"global": {
"default_mode": "keyboard",
"scan_interval_ms": 100,
"reconnect_delay_ms": 1000,
"max_reconnect_attempts": 5
}
}
FieldDefaultDescription
default_mode"keyboard"Default mapping mode for new devices
scan_interval_ms100BLE scan interval
reconnect_delay_ms1000Initial reconnect delay
max_reconnect_attempts5Max reconnect attempts

Live Configuration Updates

Configuration changes take effect immediately:

  1. Config app sends update via WebSerial
  2. SerialConfigService writes to config.json
  3. IPC event sent to RuntimeControlServer
  4. StateReducer reloads mappings
  5. New mappings applied to next input

Environment Variables

VariableDefaultDescription
OPENARCADE_CONFIG_PATH/var/lib/openarcade/config.jsonConfig file location
OPENARCADE_HID_DEVICE/dev/hidg0HID gadget device
OPENARCADE_SERIAL_DEVICE/dev/ttyGS0Serial gadget device
OPENARCADE_LOG_LEVELINFOLogging verbosity

Next Steps