Monado OpenXR Runtime
Loading...
Searching...
No Matches
vp2_protocol.h
Go to the documentation of this file.
1// Copyright 2025, Beyley Cardellio
2// SPDX-License-Identifier: BSL-1.0
3/*!
4 * @file
5 * @brief Vive Pro 2 HID protocol definitions.
6 * @author Beyley Cardellio <ep1cm1n10n123@gmail.com>
7 * @ingroup drv_vp2
8 */
9
10#pragma once
11
12#include "xrt/xrt_byte_order.h"
13
14#include <assert.h>
15#include <stdint.h>
16
17
18//! Size of every report, including the report ID.
19#define VP2_DATA_SIZE 64
20
21//! Largest payload after struct vp2_feature_header, larger ones are rejected with @ref VP2_ACK_INVALID.
22#define VP2_PAYLOAD_SIZE 60
23
24/*!
25 * Report IDs.
26 *
27 * VP2_REPORT_ID_COMMAND and VP2_REPORT_ID_FEATURE carry the same binary commands (struct vp2_feature_header followed
28 * by the payload), the MCU handles them the same way. Commands that reply do so with an input report on the same ID.
29 *
30 * VP2_REPORT_ID_STRING takes an ASCII command right after the report ID and replies with [id][size][ascii]. The
31 * commands start with "mfg-", "usr-" or "eng-". "mfg-r-" reads factory data and "mfg-s-" queries the hardware, but
32 * "mfg-s-" also has commands that reboot or write protect the MCU. Unknown commands reply with "-22". For example:
33 * - "mfg-r-devsn", "mfg-r-pcbsn", "mfg-r-pcbid" and "mfg-r-skuid" read factory strings.
34 * - "mfg-r-ps_info" reads the proximity sensor and its calibration.
35 * - "mfg-s-bridgeid" reads the video bridge chip ID, firmware version and hotplug state.
36 * - "mfg-s-audioinfo" reads the audio version, amp power limit, gain, sample rate and button.
37 * - "mfg-s-hdmi" reads the reply of the last display request getter, see @ref VP2_COMMAND_DISPLAY_REQUEST.
38 * - "mfg-s-panel" reads the display flags, power state, CPLD register 3, the frame period of each panel and the video
39 * bridge IRQ line.
40 * - "usr-w-brightness=<N>" doesn't set the brightness, it power cycles and reprograms the panels.
41 */
43{
44 VP2_REPORT_ID_COMMAND = 0x01, //!< Binary commands as output reports
45 VP2_REPORT_ID_STRING = 0x02, //!< ASCII commands
46 VP2_REPORT_ID_STATUS = 0x03, //!< struct vp2_status_report
48 0x04, //!< Binary commands as feature reports, reading it returns struct vp2_feature_state
49};
50
51/*!
52 * Binary commands, the sub_id of struct vp2_feature_header.
53 *
54 * VP2_COMMAND_DISPLAY_REQUEST takes an ASCII request and is handled in the background, one at a time. Requests that
55 * arrive while one is still running are dropped. Some of them:
56 * - "wireless,<0/1>" is persisted, it has to be 0 for dtd 3 and above.
57 * - "dtd,<N>" selects the timing, a single digit, see @ref enum vp2_resolution. 6 and above fall back to 0.
58 * - "chipreset" resets the video bridge and sets it up again with the EDID for the current dtd.
59 * - "setbrightness,<N>" sets the brightness, the HTC driver sends 80 to 130.
60 * - Getters like "fwname", "powermode", "framerate", "errcnt" and "panelstatus" put their reply in a buffer that is
61 * read with "mfg-s-hdmi" on VP2_REPORT_ID_STRING. Requests run in the same loop that handles the reports, so the
62 * reply is ready by the time the MCU handles the next report.
63 */
65{
67 0x2266, //!< Replies with the MCU version as 16 hex digits, e.g. "0000000000203056"
68 VP2_COMMAND_DISPLAY_REQUEST = 0x2970, //!< ASCII display request, see above, no reply
69 VP2_COMMAND_CODEC_REQUEST = 0x2971, //!< "codecreg=<reg>,<value>" or "hpampreg=<reg>,<value>" in hex, no reply
70 VP2_COMMAND_FEATURE_EVENT = 0x2978, //!< @ref struct vp2_feature_event, no reply
71 VP2_COMMAND_FEATURE_STATE = 0x2987, //!< @ref struct vp2_feature_state, read as a feature report
72 VP2_COMMAND_STATUS_REPORT = 0x2CD0, //!< @ref struct vp2_status_report
73 VP2_COMMAND_DEBUG_REPORT = 0x2CD2, //!< Named by the HTC driver, never sent by the MCU
74 VP2_COMMAND_SYSTEM_REBOOT = 0x5566, //!< Replies with VP2_ACK_OK, then resets the MCU
75 VP2_COMMAND_REPORT = 0x7788, //!< Named by the HTC driver, never sent by the MCU
76
77 VP2_COMMAND_LOG_READ_START = 0xB0EA, //!< Replies with the size of the log as a __le32, 0xFFFFFFFF if none
78 VP2_COMMAND_LOG_READ = 0xB0EB, //!< @ref struct vp2_config_read_request, replies with up to 60 bytes
79 VP2_COMMAND_LOG_READ_ABORT = 0xB0EC, //!< Replies with a __le32 0
80 VP2_COMMAND_LOG_READ_END = 0xB0ED, //!< Replies with a __le32 0
81 VP2_COMMAND_CONFIG_READ_START = 0xB1EA, //!< Replies with the size of the config blob as a __le32
82 VP2_COMMAND_CONFIG_READ = 0xB1EB, //!< @ref struct vp2_config_read_request, replies with up to 60 bytes
83 VP2_COMMAND_CONFIG_READ_ABORT = 0xB1EC, //!< Replies with a __le32 0
84 VP2_COMMAND_CONFIG_READ_END = 0xB1ED, //!< Replies with a __le32 0
85};
86
87/*!
88 * Replies of commands that only acknowledge, as ASCII after a struct vp2_feature_header with the same report ID and
89 * command. Unknown commands get VP2_ACK_INVALID.
90 */
91#define VP2_ACK_OK "1"
92#define VP2_ACK_FAILED "-1"
93#define VP2_ACK_INVALID "-22"
94
95/*!
96 * Transfers, the family is the high byte of the command and the step is the low byte, see VP2_TRANSFER_COMMAND.
97 *
98 * Write transfers start with struct vp2_transfer_start, send the data in work steps of up to 60 bytes, then end with
99 * an empty end step that checks the CRC. Every step replies with VP2_ACK_OK or VP2_ACK_FAILED.
100 */
102{
103 VP2_TRANSFER_APP = 0xA0, //!< MCU application, only handled by the bootloader
104 VP2_TRANSFER_IAP = 0xA1, //!< Rewrites the bootloader, don't use
105 VP2_TRANSFER_FPGA = 0xA2, //!< CPLD image
106 VP2_TRANSFER_AUDIO = 0xA3, //!< Audio codec firmware
107 VP2_TRANSFER_VBRIDGE = 0xA4, //!< Video bridge firmware
108 VP2_TRANSFER_CONFIG_WRITE = 0xA5, //!< Rewrites the config blob, don't use
109 VP2_TRANSFER_LOG_READ = 0xB0, //!< See VP2_COMMAND_LOG_READ
110 VP2_TRANSFER_CONFIG_READ = 0xB1, //!< See VP2_COMMAND_CONFIG_READ
111};
112
113enum vp2_transfer_step
114{
115 VP2_TRANSFER_STEP_START = 0xEA,
116 VP2_TRANSFER_STEP_WORK = 0xEB,
117 VP2_TRANSFER_STEP_ABORT = 0xEC,
118 VP2_TRANSFER_STEP_END = 0xED,
119};
120
121#define VP2_TRANSFER_COMMAND(family, step) ((uint16_t)(((family) << 8) | (step)))
122
123//! Starting value of the transfer CRC-32, "Vive" in ASCII. In zlib terms the CRC is crc32(VP2_TRANSFER_CRC_SEED, data).
124#define VP2_TRANSFER_CRC_SEED 0x56697665u
125
126//! Size of the header in front of the JSON in the config blob, struct vp2_config_header.
127#define VP2_CONFIG_HEADER_SIZE 128
128
129//! Largest config blob the MCU will return, including the header.
130#define VP2_CONFIG_MAX_SIZE 0x8000
131
132//! Magic of struct vp2_config_header, the CRC-32 of "viveconfig".
133#define VP2_CONFIG_MAGIC 0x3EE4DFDCu
134
135/*!
136 * Valid mask bits of struct vp2_feature_event. Bits 4 and 63 are accepted but do nothing.
137 *
138 * VP2_FEATURE_EVENT_PROXIMITY_OVERRIDE and VP2_FEATURE_EVENT_WIRELESS_AUTH are only handled in wireless mode. The auth
139 * token is big endian, bit 7 of the first byte is a separate flag and the other 23 bits have to match the top 23 bits
140 * of the CRC-32 of the MCU's 12 character serial number (generated from its unique ID) followed by
141 * @ref vp2_status_report::nonce. Once accepted the proximity override is honoured until the authentication times out.
142 *
143 * VP2_FEATURE_EVENT_THERMAL_WATCHDOG controls a check that runs every 5 seconds: the MCU stops feeding its watchdog,
144 * and so resets itself, while @ref vp2_status_report::thermal_adc is nonzero and below 0x371.
145 */
146#define VP2_FEATURE_EVENT_STATUS_REPORT (1ull << 0)
147#define VP2_FEATURE_EVENT_AMP_GAIN (1ull << 1)
148#define VP2_FEATURE_EVENT_BRIGHTNESS_REFRESH (1ull << 2)
149#define VP2_FEATURE_EVENT_AMP_POWER_LIMIT (1ull << 3)
150#define VP2_FEATURE_EVENT_AUDIO_ROUTE (1ull << 5)
151#define VP2_FEATURE_EVENT_AUDIO_PROFILE (1ull << 6)
152#define VP2_FEATURE_EVENT_DISPLAY_POWER (1ull << 48)
153#define VP2_FEATURE_EVENT_POWER_STATE (1ull << 49)
154#define VP2_FEATURE_EVENT_PROXIMITY_OVERRIDE (1ull << 50)
155#define VP2_FEATURE_EVENT_WIRELESS_AUTH (1ull << 51)
156#define VP2_FEATURE_EVENT_THERMAL_WATCHDOG (1ull << 62)
157
158#define VP2_DISPLAY_POWER_XOR 0xC4
159#define VP2_POWER_STATE_XOR 0x78
160#define VP2_PROXIMITY_OVERRIDE_XOR 0x10
161#define VP2_THERMAL_WATCHDOG_XOR 0x80
162
163/*!
164 * Power states for @ref VP2_FEATURE_EVENT_POWER_STATE, the HTC driver uses ready, idle and standby. 1 is treated the
165 * same as ready.
166 */
168{
169 VP2_POWER_STATE_READY = 2, //!< Display on
170 VP2_POWER_STATE_IDLE = 3, //!< Display fully powered off, stays off until ready is sent
171 VP2_POWER_STATE_STANDBY = 4, //!< Backlights off, the panels aren't reprogrammed when going back to ready
172 VP2_POWER_STATE_SLEEP = 5, //!< Display and sensors off
173};
174
175//! Bits of @ref vp2_feature_state::display_flags.
177{
178 VP2_DISPLAY_FLAG_ON = 1 << 0, //!< Display on
179 VP2_DISPLAY_FLAG_BRIDGE_ON = 1 << 5, //!< Video bridge powered
180 VP2_DISPLAY_FLAG_PANELS_INITIALIZED = 1 << 6, //!< Set the first time the panels power on, never cleared
181 VP2_DISPLAY_FLAG_WIRELESS = 1 << 7, //!< The persisted "wireless,1" display request setting
182};
183
184//! Bits of vp2_feature_event::thermal_watchdog, before the XOR.
186{
187 VP2_THERMAL_WATCHDOG_SKIP_CHECK = 1 << 0, //!< Don't check the thermal ADC
188 VP2_THERMAL_WATCHDOG_ALWAYS_FEED = 1 << 1, //!< Keep feeding the watchdog whatever the thermal ADC says
189};
190
191//! Audio buttons in struct vp2_status_report, only one is reported at a time.
193{
194 VP2_AUDIO_BUTTON_NONE = 0,
195 VP2_AUDIO_BUTTON_VOLUME_UP = 1,
196 VP2_AUDIO_BUTTON_VOLUME_DOWN = 2,
197 VP2_AUDIO_BUTTON_MUTE_MIC = 4,
198};
199
200//! @ref vp2_status_report::proximity_trend
202{
203 VP2_PROXIMITY_TREND_STEADY = 0,
204 VP2_PROXIMITY_TREND_FALLING = 1,
205 VP2_PROXIMITY_TREND_RISING = 2,
206};
207
208//! Proximity values above this mean the headset is being worn.
209#define VP2_PROXIMITY_THRESHOLD 150
210
211//! Unit of @ref vp2_status_report::ipd in meters.
212#define VP2_IPD_UNIT_METERS 0.00001f
213
214#pragma pack(push, 1)
215
216//! Header of the binary commands, the payload follows.
218{
219 uint8_t id;
220 __le16 sub_id; //!< @ref enum vp2_command
221 uint8_t size; //!< Size of the payload, up to @ref VP2_PAYLOAD_SIZE
222};
223
224//! Request for VP2_COMMAND_CONFIG_READ and VP2_COMMAND_LOG_READ, sent after the report ID.
226{
227 __le16 sub_id; //!< @ref VP2_COMMAND_CONFIG_READ
228 uint8_t size; //!< Size of offset
229 __le32 offset; //!< Offset into the config blob (including the header) or the log
230};
231
232//! Payload of the start step of a write transfer.
234{
235 __le32 size; //!< Size of the data, checked against a limit for each family
236 __le32 crc; //!< CRC-32 of the data, see @ref VP2_TRANSFER_CRC_SEED
237};
238
239/*!
240 * Payload of @ref VP2_COMMAND_FEATURE_EVENT. Only the fields with their bit set in valid_mask are applied. Display
241 * power and power state are ignored while the CPLD reports an abnormal state, see vp2_feature_state::cpld_state.
242 */
244{
245 __le64 valid_mask; //!< VP2_FEATURE_EVENT_* bits
246 uint8_t status_report_enable; //!< Starts or stops the status reports, stays set across sessions
247 uint8_t amp_gain; //!< Headphone amp attenuation, higher is quieter, ignored while amp_power_limit is on
248 uint8_t brightness_refresh; //!< Value is unused, only refreshes @ref vp2_feature_state::brightness
249 uint8_t amp_power_limit; //!< 1 by default, the HTC driver's sound boost sends 0
250 uint8_t unused_12;
251 uint8_t audio_route_mode; //!< 0, 1 or 2, 128 restores the previous mode
252 uint8_t audio_profile_index; //!< Codec and amp register preset stored in the headset's flash
253 uint8_t unused_15[25];
254 uint8_t display_power; //!< 0 off or 1 on, XORed with @ref VP2_DISPLAY_POWER_XOR
255 uint8_t power_state; //!< enum vp2_power_state, XORed with @ref VP2_POWER_STATE_XOR
256 uint8_t proximity_override; //!< Wireless only, 0 absent, 1 present, 0x80 keep alive, see the XOR define
257 uint8_t wireless_auth_token[3]; //!< Wireless only, see @ref VP2_FEATURE_EVENT_WIRELESS_AUTH
258 uint8_t unused_46[8];
259 uint8_t thermal_watchdog; //!< @ref enum vp2_thermal_watchdog_flags, XORed with @ref VP2_THERMAL_WATCHDOG_XOR
260 uint8_t unused_55;
261};
262
263static_assert(sizeof(struct vp2_feature_event) == 56, "bad struct size");
264
265/*!
266 * Read with a @ref VP2_REPORT_ID_FEATURE feature report, the MCU fills in the header itself. The versions are parsed
267 * from hex strings, so a string of "0000000000203056" becomes 0x203056.
268 */
270{
271 uint8_t id; //!< @ref VP2_REPORT_ID_FEATURE
272 __le16 sub_id; //!< @ref VP2_COMMAND_FEATURE_STATE
273 uint8_t size; //!< @ref VP2_PAYLOAD_SIZE
274 uint8_t unused_0[2];
275 __le16 bridge_revision; //!< Video bridge register 0x300A
276 __le32 bootloader_version; //!< Same as "mfg-s-iapswver"
277 __le32 mcu_version; //!< Same as @ref VP2_COMMAND_GET_SOFTWARE_VERSION
278 uint8_t cpld_version; //!< 0 while a CPLD transfer is running
279 uint8_t audio_version; //!< 0 while an audio transfer is running
280 uint8_t bridge_version; //!< High nibble major, low nibble minor, 0 while a bridge transfer is running
281 uint8_t unused_15[3];
282 uint8_t wireless_mode; //!< Always 0 in the firmware on my unit.
283 uint8_t firmware_variant; //!< Selects the transfer size limits
284 __le16 proximity_calibration[8]; //!< Factory proximity sensor data, "mfg-r-ps_user_data <N>" reads one
285 __le16 ipd_adc_min; //!< Factory IPD ADC value at the narrowest position
286 __le16 ipd_adc_max; //!< Factory IPD ADC value at the widest position
287 uint8_t unused_40[4];
288 __le64 unknown_version; //!< Always 0x303070
289 uint8_t amp_gain; //!< 0xFF while the audio is powered off
290 uint8_t brightness; //!< 0 while the display is powered off
291 uint8_t display_flags; //!< @ref enum vp2_display_flags
292 uint8_t cpld_state; //!< 3 normally, derived from CPLD status bits
293 uint8_t status_report_enabled;
294 uint8_t amp_power_limit;
295 uint8_t power_state; //!< @ref enum vp2_power_state, or 0/1 from CPLD state changes
296 uint8_t hardware_id; //!< From the factory data
297};
298
299static_assert(sizeof(struct vp2_feature_state) == VP2_DATA_SIZE, "bad struct size");
300
301//! Status report, sent every 50ms while @ref VP2_FEATURE_EVENT_STATUS_REPORT is enabled.
303{
304 uint8_t id; //!< @ref VP2_REPORT_ID_STATUS
305 __le16 sub_id; //!< @ref VP2_COMMAND_STATUS_REPORT
306 uint8_t size; //!< Size of the rest of the report
307 __le32 ipd_adc; //!< Raw IPD slider position, only the low 16 bits are used
308 uint8_t system_button; //!< 1 while pressed
309 uint8_t audio_button; //!< @ref enum vp2_audio_button
310 uint8_t audio_route_mode; //!< @ref vp2_feature_event::audio_route_mode
311 uint8_t audio_profile_index; //!< @ref vp2_feature_event::audio_profile_index
312 __le16 proximity_trend; //!< @ref enum vp2_proximity_trend
313 __le16 proximity; //!< See @ref VP2_PROXIMITY_THRESHOLD
314 __le16 ipd; //!< See @ref VP2_IPD_UNIT_METERS, clamped to 5700..7050
315 uint8_t reserved[38]; //!< Always 0
316 uint8_t earphone; //!< 1 in the codec's earphone mode, always 0 on most boards
317 __le32 thermal_adc; //!< Only the low 16 bits are used, see @ref VP2_FEATURE_EVENT_THERMAL_WATCHDOG
318 uint8_t wireless_auth; //!< 1 while wireless authentication is active, always 0 on a cable
319 __be16
320 nonce; //!< Low 16 bits of thermal_adc times the MCU uptime in ms, see @ref VP2_FEATURE_EVENT_WIRELESS_AUTH
321};
322
323static_assert(sizeof(struct vp2_status_report) == VP2_DATA_SIZE, "bad struct size");
324
325/*!
326 * Header of the config blob, the JSON follows. @ref VP2_COMMAND_CONFIG_READ offsets start at this header.
327 */
329{
330 __le32 magic; //!< @ref VP2_CONFIG_MAGIC
331 __le32 total_size; //!< Header and JSON, the size @ref VP2_COMMAND_CONFIG_READ_START replies with
332 __le32 json_size;
333 uint8_t unused_12[52];
334 char json_sha256[64]; //!< SHA-256 of the JSON as hex, not null terminated
335};
336
337static_assert(sizeof(struct vp2_config_header) == VP2_CONFIG_HEADER_SIZE, "bad struct size");
338
339#pragma pack(pop)
Header of the config blob, the JSON follows.
Definition vp2_protocol.h:329
__le32 magic
VP2_CONFIG_MAGIC
Definition vp2_protocol.h:330
__le32 total_size
Header and JSON, the size VP2_COMMAND_CONFIG_READ_START replies with.
Definition vp2_protocol.h:331
char json_sha256[64]
SHA-256 of the JSON as hex, not null terminated.
Definition vp2_protocol.h:334
Request for VP2_COMMAND_CONFIG_READ and VP2_COMMAND_LOG_READ, sent after the report ID.
Definition vp2_protocol.h:226
__le16 sub_id
VP2_COMMAND_CONFIG_READ
Definition vp2_protocol.h:227
__le32 offset
Offset into the config blob (including the header) or the log.
Definition vp2_protocol.h:229
uint8_t size
Size of offset.
Definition vp2_protocol.h:228
Payload of VP2_COMMAND_FEATURE_EVENT.
Definition vp2_protocol.h:244
uint8_t brightness_refresh
Value is unused, only refreshes vp2_feature_state::brightness.
Definition vp2_protocol.h:248
uint8_t audio_profile_index
Codec and amp register preset stored in the headset's flash.
Definition vp2_protocol.h:252
uint8_t thermal_watchdog
enum vp2_thermal_watchdog_flags, XORed with VP2_THERMAL_WATCHDOG_XOR
Definition vp2_protocol.h:259
uint8_t power_state
enum vp2_power_state, XORed with VP2_POWER_STATE_XOR
Definition vp2_protocol.h:255
uint8_t wireless_auth_token[3]
Wireless only, see VP2_FEATURE_EVENT_WIRELESS_AUTH.
Definition vp2_protocol.h:257
uint8_t proximity_override
Wireless only, 0 absent, 1 present, 0x80 keep alive, see the XOR define.
Definition vp2_protocol.h:256
__le64 valid_mask
VP2_FEATURE_EVENT_* bits.
Definition vp2_protocol.h:245
uint8_t audio_route_mode
0, 1 or 2, 128 restores the previous mode
Definition vp2_protocol.h:251
uint8_t amp_power_limit
1 by default, the HTC driver's sound boost sends 0
Definition vp2_protocol.h:249
uint8_t status_report_enable
Starts or stops the status reports, stays set across sessions.
Definition vp2_protocol.h:246
uint8_t display_power
0 off or 1 on, XORed with VP2_DISPLAY_POWER_XOR
Definition vp2_protocol.h:254
uint8_t amp_gain
Headphone amp attenuation, higher is quieter, ignored while amp_power_limit is on.
Definition vp2_protocol.h:247
Header of the binary commands, the payload follows.
Definition vp2_protocol.h:218
__le16 sub_id
enum vp2_command
Definition vp2_protocol.h:220
uint8_t size
Size of the payload, up to VP2_PAYLOAD_SIZE.
Definition vp2_protocol.h:221
Read with a VP2_REPORT_ID_FEATURE feature report, the MCU fills in the header itself.
Definition vp2_protocol.h:270
uint8_t cpld_state
3 normally, derived from CPLD status bits
Definition vp2_protocol.h:292
uint8_t cpld_version
0 while a CPLD transfer is running
Definition vp2_protocol.h:278
__le16 sub_id
VP2_COMMAND_FEATURE_STATE
Definition vp2_protocol.h:272
uint8_t brightness
0 while the display is powered off
Definition vp2_protocol.h:290
__le32 bootloader_version
Same as "mfg-s-iapswver".
Definition vp2_protocol.h:276
uint8_t power_state
enum vp2_power_state, or 0/1 from CPLD state changes
Definition vp2_protocol.h:295
uint8_t size
VP2_PAYLOAD_SIZE
Definition vp2_protocol.h:273
__le64 unknown_version
Always 0x303070.
Definition vp2_protocol.h:288
__le16 ipd_adc_max
Factory IPD ADC value at the widest position.
Definition vp2_protocol.h:286
uint8_t audio_version
0 while an audio transfer is running
Definition vp2_protocol.h:279
uint8_t display_flags
enum vp2_display_flags
Definition vp2_protocol.h:291
__le16 ipd_adc_min
Factory IPD ADC value at the narrowest position.
Definition vp2_protocol.h:285
uint8_t wireless_mode
Always 0 in the firmware on my unit.
Definition vp2_protocol.h:282
uint8_t bridge_version
High nibble major, low nibble minor, 0 while a bridge transfer is running.
Definition vp2_protocol.h:280
uint8_t firmware_variant
Selects the transfer size limits.
Definition vp2_protocol.h:283
__le32 mcu_version
Same as VP2_COMMAND_GET_SOFTWARE_VERSION.
Definition vp2_protocol.h:277
__le16 bridge_revision
Video bridge register 0x300A.
Definition vp2_protocol.h:275
uint8_t id
VP2_REPORT_ID_FEATURE
Definition vp2_protocol.h:271
__le16 proximity_calibration[8]
Factory proximity sensor data, "mfg-r-ps_user_data <N>" reads one.
Definition vp2_protocol.h:284
uint8_t amp_gain
0xFF while the audio is powered off
Definition vp2_protocol.h:289
uint8_t hardware_id
From the factory data.
Definition vp2_protocol.h:296
Status report, sent every 50ms while VP2_FEATURE_EVENT_STATUS_REPORT is enabled.
Definition vp2_protocol.h:303
__le16 proximity
See VP2_PROXIMITY_THRESHOLD.
Definition vp2_protocol.h:313
__be16 nonce
Low 16 bits of thermal_adc times the MCU uptime in ms, see VP2_FEATURE_EVENT_WIRELESS_AUTH.
Definition vp2_protocol.h:320
uint8_t wireless_auth
1 while wireless authentication is active, always 0 on a cable
Definition vp2_protocol.h:318
__le32 ipd_adc
Raw IPD slider position, only the low 16 bits are used.
Definition vp2_protocol.h:307
__le16 ipd
See VP2_IPD_UNIT_METERS, clamped to 5700..7050.
Definition vp2_protocol.h:314
uint8_t id
VP2_REPORT_ID_STATUS
Definition vp2_protocol.h:304
uint8_t audio_profile_index
vp2_feature_event::audio_profile_index
Definition vp2_protocol.h:311
__le16 sub_id
VP2_COMMAND_STATUS_REPORT
Definition vp2_protocol.h:305
uint8_t size
Size of the rest of the report.
Definition vp2_protocol.h:306
uint8_t audio_route_mode
vp2_feature_event::audio_route_mode
Definition vp2_protocol.h:310
__le16 proximity_trend
enum vp2_proximity_trend
Definition vp2_protocol.h:312
uint8_t earphone
1 in the codec's earphone mode, always 0 on most boards
Definition vp2_protocol.h:316
uint8_t reserved[38]
Always 0.
Definition vp2_protocol.h:315
uint8_t audio_button
enum vp2_audio_button
Definition vp2_protocol.h:309
uint8_t system_button
1 while pressed
Definition vp2_protocol.h:308
__le32 thermal_adc
Only the low 16 bits are used, see VP2_FEATURE_EVENT_THERMAL_WATCHDOG.
Definition vp2_protocol.h:317
Payload of the start step of a write transfer.
Definition vp2_protocol.h:234
__le32 crc
CRC-32 of the data, see VP2_TRANSFER_CRC_SEED.
Definition vp2_protocol.h:236
__le32 size
Size of the data, checked against a limit for each family.
Definition vp2_protocol.h:235
#define VP2_DATA_SIZE
Size of every report, including the report ID.
Definition vp2_protocol.h:19
vp2_transfer_family
Transfers, the family is the high byte of the command and the step is the low byte,...
Definition vp2_protocol.h:102
@ VP2_TRANSFER_CONFIG_WRITE
Rewrites the config blob, don't use.
Definition vp2_protocol.h:108
@ VP2_TRANSFER_AUDIO
Audio codec firmware.
Definition vp2_protocol.h:106
@ VP2_TRANSFER_FPGA
CPLD image.
Definition vp2_protocol.h:105
@ VP2_TRANSFER_IAP
Rewrites the bootloader, don't use.
Definition vp2_protocol.h:104
@ VP2_TRANSFER_APP
MCU application, only handled by the bootloader.
Definition vp2_protocol.h:103
@ VP2_TRANSFER_CONFIG_READ
See VP2_COMMAND_CONFIG_READ.
Definition vp2_protocol.h:110
@ VP2_TRANSFER_VBRIDGE
Video bridge firmware.
Definition vp2_protocol.h:107
@ VP2_TRANSFER_LOG_READ
See VP2_COMMAND_LOG_READ.
Definition vp2_protocol.h:109
vp2_command
Binary commands, the sub_id of struct vp2_feature_header.
Definition vp2_protocol.h:65
@ VP2_COMMAND_CONFIG_READ
struct vp2_config_read_request, replies with up to 60 bytes
Definition vp2_protocol.h:82
@ VP2_COMMAND_DISPLAY_REQUEST
ASCII display request, see above, no reply.
Definition vp2_protocol.h:68
@ VP2_COMMAND_LOG_READ_ABORT
Replies with a __le32 0.
Definition vp2_protocol.h:79
@ VP2_COMMAND_LOG_READ_END
Replies with a __le32 0.
Definition vp2_protocol.h:80
@ VP2_COMMAND_REPORT
Named by the HTC driver, never sent by the MCU.
Definition vp2_protocol.h:75
@ VP2_COMMAND_LOG_READ_START
Replies with the size of the log as a __le32, 0xFFFFFFFF if none.
Definition vp2_protocol.h:77
@ VP2_COMMAND_LOG_READ
struct vp2_config_read_request, replies with up to 60 bytes
Definition vp2_protocol.h:78
@ VP2_COMMAND_CONFIG_READ_END
Replies with a __le32 0.
Definition vp2_protocol.h:84
@ VP2_COMMAND_CODEC_REQUEST
"codecreg=<reg>,<value>" or "hpampreg=<reg>,<value>" in hex, no reply
Definition vp2_protocol.h:69
@ VP2_COMMAND_GET_SOFTWARE_VERSION
Replies with the MCU version as 16 hex digits, e.g.
Definition vp2_protocol.h:66
@ VP2_COMMAND_SYSTEM_REBOOT
Replies with VP2_ACK_OK, then resets the MCU.
Definition vp2_protocol.h:74
@ VP2_COMMAND_DEBUG_REPORT
Named by the HTC driver, never sent by the MCU.
Definition vp2_protocol.h:73
@ VP2_COMMAND_STATUS_REPORT
struct vp2_status_report
Definition vp2_protocol.h:72
@ VP2_COMMAND_CONFIG_READ_ABORT
Replies with a __le32 0.
Definition vp2_protocol.h:83
@ VP2_COMMAND_FEATURE_STATE
struct vp2_feature_state, read as a feature report
Definition vp2_protocol.h:71
@ VP2_COMMAND_CONFIG_READ_START
Replies with the size of the config blob as a __le32.
Definition vp2_protocol.h:81
@ VP2_COMMAND_FEATURE_EVENT
struct vp2_feature_event, no reply
Definition vp2_protocol.h:70
vp2_proximity_trend
vp2_status_report::proximity_trend
Definition vp2_protocol.h:202
vp2_display_flags
Bits of vp2_feature_state::display_flags.
Definition vp2_protocol.h:177
@ VP2_DISPLAY_FLAG_WIRELESS
The persisted "wireless,1" display request setting.
Definition vp2_protocol.h:181
@ VP2_DISPLAY_FLAG_BRIDGE_ON
Video bridge powered.
Definition vp2_protocol.h:179
@ VP2_DISPLAY_FLAG_ON
Display on.
Definition vp2_protocol.h:178
@ VP2_DISPLAY_FLAG_PANELS_INITIALIZED
Set the first time the panels power on, never cleared.
Definition vp2_protocol.h:180
vp2_thermal_watchdog_flags
Bits of vp2_feature_event::thermal_watchdog, before the XOR.
Definition vp2_protocol.h:186
@ VP2_THERMAL_WATCHDOG_SKIP_CHECK
Don't check the thermal ADC.
Definition vp2_protocol.h:187
@ VP2_THERMAL_WATCHDOG_ALWAYS_FEED
Keep feeding the watchdog whatever the thermal ADC says.
Definition vp2_protocol.h:188
#define VP2_CONFIG_HEADER_SIZE
Size of the header in front of the JSON in the config blob, struct vp2_config_header.
Definition vp2_protocol.h:127
vp2_power_state
Power states for VP2_FEATURE_EVENT_POWER_STATE, the HTC driver uses ready, idle and standby.
Definition vp2_protocol.h:168
@ VP2_POWER_STATE_SLEEP
Display and sensors off.
Definition vp2_protocol.h:172
@ VP2_POWER_STATE_IDLE
Display fully powered off, stays off until ready is sent.
Definition vp2_protocol.h:170
@ VP2_POWER_STATE_STANDBY
Backlights off, the panels aren't reprogrammed when going back to ready.
Definition vp2_protocol.h:171
@ VP2_POWER_STATE_READY
Display on.
Definition vp2_protocol.h:169
vp2_report_id
Report IDs.
Definition vp2_protocol.h:43
@ VP2_REPORT_ID_STATUS
struct vp2_status_report
Definition vp2_protocol.h:46
@ VP2_REPORT_ID_COMMAND
Binary commands as output reports.
Definition vp2_protocol.h:44
@ VP2_REPORT_ID_STRING
ASCII commands.
Definition vp2_protocol.h:45
@ VP2_REPORT_ID_FEATURE
Binary commands as feature reports, reading it returns struct vp2_feature_state.
Definition vp2_protocol.h:47
vp2_audio_button
Audio buttons in struct vp2_status_report, only one is reported at a time.
Definition vp2_protocol.h:193
Endian-specific byte order defines.