Opensource firmware for NRF52840 Pro Micro that copycats the Steam Controller 2 Puck and adds an Xbox and Switch mode
openpuck docs PROTOCOL.md
13 kB · 405 lines
Markdown

# OpenPuck Controller Protocol This document describes the complete controller-to-puck protocol implemented by `OpenPuck.ino`. ## 1. Scope OpenPuck emulates the Valve Steam Controller 2 "puck" dongle. There are two separate protocols: 1. USB host-facing protocol between the puck and the computer. 2. 2.4 GHz radio protocol between the puck and the controller. Both are required for a fully compatible implementation. ## 2. Bond record A bond slot is 24 bytes: ```text offset size meaning 0x00 4 proteus_uuid / token, little-endian 0x04 4 ibex_uuid, little-endian 0x08 16 controller serial, ASCII, not null-terminated if fully filled ``` The puck stores four independent bond slots. Slot `N` is exposed as USB HID interface `N`. An empty slot is all zeroes. ## 3. USB protocol ### 3.1 Steam-mode USB layout Steam mode enumerates as Valve `28DE:1304` and exposes four HID interfaces with the same report descriptor as the real puck. Each interface owns one bond slot. Relevant report IDs: - Input: `0x40`, `0x41`, `0x42`, `0x43`, `0x44`, `0x45`, `0x79`, `0x7B` - Output: `0x80` to `0x89` - Feature: `0x01`, `0x02` ### 3.2 Feature commands Feature payload framing is: ```text [cmd][len][payload...] ``` Implemented commands: - `0x83`: attribute block - `0xAE`: string attribute - `0xB4`: connection state for the interface's slot - `0xAD`: pairing mode enable/disable - `0xA2`: write or clear the interface's 24-byte bond slot - `0xA3`: read the interface's 24-byte bond slot #### `0xB4` response ```text [0xB4][0x01][state] ``` - `0x02`: controller connected on this slot - `0x01`: not connected #### `0xA2` write `len` must be at least `24`. A zero-filled 24-byte payload clears the slot. Any non-zero valid payload writes the bond verbatim. #### `0xA3` read Returns: ```text [0xA3][0x18][24-byte bond] ``` ### 3.3 Host-to-controller relay When Steam writes feature report `0x01`, OpenPuck forwards it over RF to the controller as an `E3` frame containing a SET sub-TLV: ```text [E3][sub_len][0x…