19#define VP2_DATA_SIZE 64
22#define VP2_PAYLOAD_SIZE 60
92#define VP2_ACK_FAILED "-1"
93#define VP2_ACK_INVALID "-22"
113enum vp2_transfer_step
115 VP2_TRANSFER_STEP_START = 0xEA,
116 VP2_TRANSFER_STEP_WORK = 0xEB,
117 VP2_TRANSFER_STEP_ABORT = 0xEC,
118 VP2_TRANSFER_STEP_END = 0xED,
121#define VP2_TRANSFER_COMMAND(family, step) ((uint16_t)(((family) << 8) | (step)))
124#define VP2_TRANSFER_CRC_SEED 0x56697665u
127#define VP2_CONFIG_HEADER_SIZE 128
130#define VP2_CONFIG_MAX_SIZE 0x8000
133#define VP2_CONFIG_MAGIC 0x3EE4DFDCu
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)
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
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,
203 VP2_PROXIMITY_TREND_STEADY = 0,
204 VP2_PROXIMITY_TREND_FALLING = 1,
205 VP2_PROXIMITY_TREND_RISING = 2,
209#define VP2_PROXIMITY_THRESHOLD 150
212#define VP2_IPD_UNIT_METERS 0.00001f
253 uint8_t unused_15[25];
258 uint8_t unused_46[8];
281 uint8_t unused_15[3];
287 uint8_t unused_40[4];
293 uint8_t status_report_enabled;
294 uint8_t amp_power_limit;
333 uint8_t unused_12[52];
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
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.