Monado OpenXR Runtime
Data Structures | Macros | Functions | Variables
vive_protocol.h File Reference

Vive USB HID reports. More...

#include <asm/byteorder.h>
#include <stdint.h>
#include "os/os_hid.h"
Include dependency graph for vive_protocol.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  vive_controller_button_report
 
struct  vive_imu_range_modes_report
 
struct  vive_mainboard_status_report
 
struct  vive_headset_power_report
 
struct  vive_headset_mainboard_device_info_report
 
struct  vive_firmware_version_report
 
struct  vive_config_start_report
 
struct  vive_config_read_report
 
struct  vive_imu_sample
 
struct  vive_imu_report
 
struct  vive_controller_lighthouse_pulse
 
struct  vive_controller_lighthouse_pulse_report
 
struct  vive_controller_message
 
struct  vive_controller_report1
 
struct  vive_controller_report2
 
struct  vive_headset_lighthouse_pulse
 
struct  vive_headset_lighthouse_pulse_report
 
struct  vive_controller_haptic_pulse_report
 
struct  vive_controller_poweroff_report
 

Macros

#define VIVE_CONTROLLER_BUTTON_REPORT_ID   0x01
 
#define VIVE_CONTROLLER_USB_BUTTON_TRIGGER   (1 << 0)
 
#define VIVE_CONTROLLER_USB_BUTTON_GRIP   (1 << 2)
 
#define VIVE_CONTROLLER_USB_BUTTON_MENU   (1 << 12)
 
#define VIVE_CONTROLLER_USB_BUTTON_SYSTEM   (1 << 13)
 
#define VIVE_CONTROLLER_USB_BUTTON_THUMB   (1 << 18)
 
#define VIVE_CONTROLLER_USB_BUTTON_TOUCH   (1 << 20)
 
#define VIVE_IMU_RANGE_MODES_REPORT_ID   0x01
 
#define VIVE_MAINBOARD_STATUS_REPORT_ID   0x03
 
#define VIVE_HEADSET_POWER_REPORT_ID   0x04
 
#define VIVE_HEADSET_POWER_REPORT_TYPE   0x2978
 
#define VIVE_HEADSET_MAINBOARD_DEVICE_INFO_REPORT_ID   0x04
 
#define VIVE_HEADSET_MAINBOARD_DEVICE_INFO_REPORT_TYPE   0x2987
 
#define VIVE_FIRMWARE_VERSION_REPORT_ID   0x05
 
#define VIVE_CONFIG_START_REPORT_ID   0x10
 
#define VIVE_CONFIG_READ_REPORT_ID   0x11
 
#define VIVE_IMU_REPORT_ID   0x20
 
#define VIVE_CONTROLLER_LIGHTHOUSE_PULSE_REPORT_ID   0x21
 
#define VIVE_CONTROLLER_REPORT1_ID   0x23
 
#define VIVE_CONTROLLER_BATTERY_CHARGING   0x80
 
#define VIVE_CONTROLLER_BATTERY_CHARGE_MASK   0x7f
 
#define VIVE_CONTROLLER_BUTTON_TRIGGER   0x01
 
#define VIVE_CONTROLLER_BUTTON_TOUCH   0x02
 
#define VIVE_CONTROLLER_BUTTON_THUMB   0x04
 
#define VIVE_CONTROLLER_BUTTON_SYSTEM   0x08
 
#define VIVE_CONTROLLER_BUTTON_GRIP   0x10
 
#define VIVE_CONTROLLER_BUTTON_MENU   0x20
 
#define VIVE_CONTROLLER_REPORT2_ID   0x24
 
#define VIVE_HEADSET_LIGHTHOUSE_PULSE_REPORT_ID   0x25
 
#define VIVE_CONTROLLER_DISCONNECT_REPORT_ID   0x26
 
#define VIVE_CONTROLLER_COMMAND_REPORT_ID   0xff
 
#define VIVE_CONTROLLER_HAPTIC_PULSE_COMMAND   0x8f
 
#define VIVE_CONTROLLER_POWEROFF_COMMAND   0x9f
 

Functions

struct vive_controller_button_report __attribute__ ((packed))
 
char * vive_read_config (struct os_hid_device *hid_dev)
 
int vive_get_imu_range_report (struct os_hid_device *hid_dev, double *gyro_range, double *acc_range)
 
int vive_read_firmware (struct os_hid_device *hid_dev, uint32_t *firmware_version, uint8_t *hardware_revision, uint8_t *hardware_version_micro, uint8_t *hardware_version_minor, uint8_t *hardware_version_major)
 

Variables

uint8_t id
 
uint8_t unknown1
 
uint16_t maybe_type
 
uint32_t sequence
 
uint32_t buttons
 
union {
   uint16_t   trigger
 
   uint16_t   battery_voltage
 
}; 
 
uint8_t battery
 
uint8_t unknown2
 
uint32_t hardware_id
 
uint16_t touch [2]
 
uint16_t unknown3
 
uint16_t trigger_hires
 
uint8_t unknown4 [24]
 
uint16_t trigger_raw
 
uint8_t unknown5 [8]
 
uint8_t maybe_bitfield
 
uint8_t unknown6
 
uint8_t gyro_range
 
uint8_t accel_range
 
uint8_t unknown [61]
 
uint8_t len
 
uint16_t lens_separation
 
uint16_t reserved1
 
uint8_t button
 
uint8_t reserved2 [3]
 
uint8_t proximity_change
 
uint8_t reserved3
 
uint16_t proximity
 
uint16_t ipd
 
uint8_t reserved4 [46]
 
uint16_t type
 
uint16_t edid_vid
 
uint16_t edid_pid
 
uint32_t display_firmware_version
 
uint32_t firmware_version
 
uint8_t string1 [16]
 
uint8_t string2 [16]
 
uint8_t hardware_version_micro
 
uint8_t hardware_version_minor
 
uint8_t hardware_version_major
 
uint8_t hardware_revision
 
uint8_t fpga_version_minor
 
uint8_t fpga_version_major
 
uint8_t reserved [13]
 
uint8_t unused [63]
 
uint8_t payload [62]
 
uint16_t acc [3]
 
uint16_t gyro [3]
 
uint32_t time
 
uint8_t seq
 
struct vive_imu_sample sample [3]
 
uint16_t duration
 
uint32_t timestamp
 
struct vive_controller_lighthouse_pulse pulse [7]
 
uint8_t timestamp_hi
 
uint8_t timestamp_lo
 
struct vive_controller_message message
 
uint8_t command
 
uint8_t zero
 
uint16_t pulse_high
 
uint16_t pulse_low
 
uint16_t repeat_count
 
uint8_t magic [4]
 
const struct vive_headset_power_report power_on_report
 
const struct vive_headset_power_report power_off_report
 

Detailed Description

Vive USB HID reports.

Author
Lubosz Sarnecki lubos.nosp@m.z.sa.nosp@m.rneck.nosp@m.i@co.nosp@m.llabo.nosp@m.ra.c.nosp@m.om

Macro Definition Documentation

◆ VIVE_CONFIG_READ_REPORT_ID

#define VIVE_CONFIG_READ_REPORT_ID   0x11

◆ VIVE_CONFIG_START_REPORT_ID

#define VIVE_CONFIG_START_REPORT_ID   0x10

Referenced by vive_read_config().

◆ VIVE_CONTROLLER_BATTERY_CHARGE_MASK

#define VIVE_CONTROLLER_BATTERY_CHARGE_MASK   0x7f

◆ VIVE_CONTROLLER_BATTERY_CHARGING

#define VIVE_CONTROLLER_BATTERY_CHARGING   0x80

◆ VIVE_CONTROLLER_BUTTON_GRIP

#define VIVE_CONTROLLER_BUTTON_GRIP   0x10

◆ VIVE_CONTROLLER_BUTTON_MENU

#define VIVE_CONTROLLER_BUTTON_MENU   0x20

◆ VIVE_CONTROLLER_BUTTON_REPORT_ID

#define VIVE_CONTROLLER_BUTTON_REPORT_ID   0x01

◆ VIVE_CONTROLLER_BUTTON_SYSTEM

#define VIVE_CONTROLLER_BUTTON_SYSTEM   0x08

◆ VIVE_CONTROLLER_BUTTON_THUMB

#define VIVE_CONTROLLER_BUTTON_THUMB   0x04

◆ VIVE_CONTROLLER_BUTTON_TOUCH

#define VIVE_CONTROLLER_BUTTON_TOUCH   0x02

◆ VIVE_CONTROLLER_BUTTON_TRIGGER

#define VIVE_CONTROLLER_BUTTON_TRIGGER   0x01

◆ VIVE_CONTROLLER_COMMAND_REPORT_ID

#define VIVE_CONTROLLER_COMMAND_REPORT_ID   0xff

◆ VIVE_CONTROLLER_DISCONNECT_REPORT_ID

#define VIVE_CONTROLLER_DISCONNECT_REPORT_ID   0x26

◆ VIVE_CONTROLLER_HAPTIC_PULSE_COMMAND

#define VIVE_CONTROLLER_HAPTIC_PULSE_COMMAND   0x8f

◆ VIVE_CONTROLLER_LIGHTHOUSE_PULSE_REPORT_ID

#define VIVE_CONTROLLER_LIGHTHOUSE_PULSE_REPORT_ID   0x21

◆ VIVE_CONTROLLER_POWEROFF_COMMAND

#define VIVE_CONTROLLER_POWEROFF_COMMAND   0x9f

◆ VIVE_CONTROLLER_REPORT1_ID

#define VIVE_CONTROLLER_REPORT1_ID   0x23

◆ VIVE_CONTROLLER_REPORT2_ID

#define VIVE_CONTROLLER_REPORT2_ID   0x24

◆ VIVE_CONTROLLER_USB_BUTTON_GRIP

#define VIVE_CONTROLLER_USB_BUTTON_GRIP   (1 << 2)

◆ VIVE_CONTROLLER_USB_BUTTON_MENU

#define VIVE_CONTROLLER_USB_BUTTON_MENU   (1 << 12)

◆ VIVE_CONTROLLER_USB_BUTTON_SYSTEM

#define VIVE_CONTROLLER_USB_BUTTON_SYSTEM   (1 << 13)

◆ VIVE_CONTROLLER_USB_BUTTON_THUMB

#define VIVE_CONTROLLER_USB_BUTTON_THUMB   (1 << 18)

◆ VIVE_CONTROLLER_USB_BUTTON_TOUCH

#define VIVE_CONTROLLER_USB_BUTTON_TOUCH   (1 << 20)

◆ VIVE_CONTROLLER_USB_BUTTON_TRIGGER

#define VIVE_CONTROLLER_USB_BUTTON_TRIGGER   (1 << 0)

◆ VIVE_FIRMWARE_VERSION_REPORT_ID

#define VIVE_FIRMWARE_VERSION_REPORT_ID   0x05

Referenced by vive_read_firmware().

◆ VIVE_HEADSET_LIGHTHOUSE_PULSE_REPORT_ID

#define VIVE_HEADSET_LIGHTHOUSE_PULSE_REPORT_ID   0x25

◆ VIVE_HEADSET_MAINBOARD_DEVICE_INFO_REPORT_ID

#define VIVE_HEADSET_MAINBOARD_DEVICE_INFO_REPORT_ID   0x04

◆ VIVE_HEADSET_MAINBOARD_DEVICE_INFO_REPORT_TYPE

#define VIVE_HEADSET_MAINBOARD_DEVICE_INFO_REPORT_TYPE   0x2987

◆ VIVE_HEADSET_POWER_REPORT_ID

#define VIVE_HEADSET_POWER_REPORT_ID   0x04

◆ VIVE_HEADSET_POWER_REPORT_TYPE

#define VIVE_HEADSET_POWER_REPORT_TYPE   0x2978

◆ VIVE_IMU_RANGE_MODES_REPORT_ID

#define VIVE_IMU_RANGE_MODES_REPORT_ID   0x01

◆ VIVE_IMU_REPORT_ID

#define VIVE_IMU_REPORT_ID   0x20

◆ VIVE_MAINBOARD_STATUS_REPORT_ID

#define VIVE_MAINBOARD_STATUS_REPORT_ID   0x03

Function Documentation

◆ __attribute__()

struct vive_controller_poweroff_report __attribute__ ( (packed)  )

◆ vive_get_imu_range_report()

int vive_get_imu_range_report ( struct os_hid_device hid_dev,
double *  gyro_range,
double *  acc_range 
)

◆ vive_read_config()

char* vive_read_config ( struct os_hid_device hid_dev)

◆ vive_read_firmware()

int vive_read_firmware ( struct os_hid_device hid_dev,
uint32_t *  firmware_version,
uint8_t *  hardware_revision,
uint8_t *  hardware_version_micro,
uint8_t *  hardware_version_minor,
uint8_t *  hardware_version_major 
)

Variable Documentation

◆ @81

union { ... }

◆ acc

uint16_t acc[3]

◆ accel_range

uint8_t accel_range

◆ battery

uint8_t battery

◆ battery_voltage

uint16_t battery_voltage

◆ button

uint8_t button

◆ buttons

uint32_t buttons

◆ command

uint8_t command

◆ display_firmware_version

uint32_t display_firmware_version

◆ duration

uint16_t duration

◆ edid_pid

uint16_t edid_pid

◆ edid_vid

uint16_t edid_vid

◆ firmware_version

uint32_t firmware_version

◆ fpga_version_major

uint8_t fpga_version_major

◆ fpga_version_minor

uint8_t fpga_version_minor

◆ gyro

uint16_t gyro[3]

◆ gyro_range

uint8_t gyro_range

◆ hardware_id

uint32_t hardware_id

◆ hardware_revision

uint8_t hardware_revision

◆ hardware_version_major

uint8_t hardware_version_major

◆ hardware_version_micro

uint8_t hardware_version_micro

◆ hardware_version_minor

uint8_t hardware_version_minor

◆ id

uint8_t id

◆ ipd

uint16_t ipd

◆ len

uint8_t len

Referenced by xrt_prober_match_string().

◆ lens_separation

uint16_t lens_separation

◆ magic

uint8_t magic[4]

◆ maybe_bitfield

uint8_t maybe_bitfield

◆ maybe_type

uint16_t maybe_type

◆ message

struct vive_controller_message message

◆ payload

uint8_t payload

◆ power_off_report

const struct vive_headset_power_report power_off_report

◆ power_on_report

const struct vive_headset_power_report power_on_report

◆ proximity

uint16_t proximity

◆ proximity_change

uint8_t proximity_change

◆ pulse

◆ pulse_high

uint16_t pulse_high

◆ pulse_low

uint16_t pulse_low

◆ repeat_count

uint16_t repeat_count

◆ reserved

uint8_t reserved

◆ reserved1

uint8_t reserved1

◆ reserved2

uint8_t reserved2

◆ reserved3

uint8_t reserved3

◆ reserved4

uint8_t reserved4[46]

◆ sample

struct vive_imu_sample sample[3]

◆ seq

uint8_t seq

◆ sequence

uint32_t sequence

◆ string1

uint8_t string1[16]

◆ string2

uint8_t string2[16]

◆ time

uint32_t time

◆ timestamp

uint32_t timestamp

◆ timestamp_hi

uint8_t timestamp_hi

◆ timestamp_lo

uint8_t timestamp_lo

◆ touch

uint16_t touch[2]

◆ trigger

uint16_t trigger

◆ trigger_hires

uint16_t trigger_hires

◆ trigger_raw

uint16_t trigger_raw

◆ type

uint16_t type

◆ unknown

uint16_t unknown

◆ unknown1

uint32_t unknown1

◆ unknown2

uint32_t unknown2

◆ unknown3

uint16_t unknown3

◆ unknown4

uint8_t unknown4[24]

◆ unknown5

uint8_t unknown5[8]

◆ unknown6

uint8_t unknown6

◆ unused

uint8_t unused[63]

◆ zero

uint8_t zero