Monado OpenXR Runtime
vp2_hid.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 Implementation of the Vive Pro 2 HID interface.
6 * @author Beyley Cardellio <ep1cm1n10n123@gmail.com>
7 * @ingroup drv_vp2
8 */
9
10
11#ifdef __cplusplus
12extern "C" {
13#endif
14
15
16#define VP2_VID 0x0bb4
17#define VP2_PID 0x0342
18
19enum vp2_resolution
20{
21 VP2_RESOLUTION_2448_1224_90_03 = 0,
22 VP2_RESOLUTION_2448_1224_120_05 = 1,
23 VP2_RESOLUTION_3264_1632_90_00 = 2,
24 VP2_RESOLUTION_3680_1836_90_02 = 3,
25 VP2_RESOLUTION_4896_2448_90_02 = 4,
26 VP2_RESOLUTION_4896_2448_120_02 = 5,
27};
28
29static inline void
30vp2_resolution_get_extents(enum vp2_resolution res, int *out_w, int *out_h)
31{
32 switch (res) {
33 case VP2_RESOLUTION_2448_1224_90_03:
34 case VP2_RESOLUTION_2448_1224_120_05:
35 *out_w = 2448;
36 *out_h = 1224;
37 break;
38 case VP2_RESOLUTION_3264_1632_90_00:
39 *out_w = 3264;
40 *out_h = 1632;
41 break;
42 case VP2_RESOLUTION_3680_1836_90_02:
43 *out_w = 3680;
44 *out_h = 1836;
45 break;
46 case VP2_RESOLUTION_4896_2448_90_02:
47 case VP2_RESOLUTION_4896_2448_120_02:
48 *out_w = 4896;
49 *out_h = 2448;
50 break;
51 default:
52 assert(!"unreachable: bad resolution");
53 *out_w = 0;
54 *out_h = 0;
55 break;
56 }
57}
58
59struct vp2_hid;
60
61int
62vp2_hid_open(struct os_hid_device *hid_dev, struct vp2_hid **out_hid);
63
64enum vp2_resolution
65vp2_get_resolution(struct vp2_hid *vp2);
66
67void
68vp2_hid_destroy(struct vp2_hid *vp2);
69
70#ifdef __cplusplus
71} // extern "C"
72#endif
Representing a single hid interface on a device.
Definition: os_hid.h:29
Definition: vp2_hid.c:34