Debian Codegraph @

src/xrt/auxiliary/vive/vive_tweaks.c

raw symbols SCIP
1 // Copyright 2023, Collabora, Ltd.cxx . . $ `<file>/src/xrt/auxiliary/vive/vive_tweaks.c`/
2 // SPDX-License-Identifier: BSL-1.0
3 /*!
4 * @file
5 * @brief Tweaks for various bits on Vive and Index headsets.
6 * @author Jakob Bornecrantz <[email protected]>
7 * @ingroup aux_vive
8 */
9
10 #include "xrt/xrt_defines.h"cxx . . $ `<file>/src/xrt/include/xrt/xrt_defines.h`/
11
12 #include "vive_config.h"cxx . . $ `<file>/src/xrt/auxiliary/vive/vive_config.h`/
13 #include "vive_tweaks.h"cxx . . $ `<file>/src/xrt/auxiliary/vive/vive_tweaks.h`/
14
15 #include <assert.h>
16 #include <string.h>
17
18
19 /*
20 *
21 * Tweaks for FOV.
22 *
23 */
24
25 struct fov_entrycxx . . $ fov_entry#
26 {
27 const char *device_serial_numbercxx . . $ fov_entry#device_serial_number.;
28 const struct xrt_fovcxx . . $ xrt_fov# fovscxx . . $ fov_entry#fovs.[2];
29 };
30
31 static const struct fov_entrycxx . . $ fov_entry# fovscxx . . $ fovs.[] = {
32 {
33 .device_serial_number = "LHR-4DC3ADD6",
34 .fovs =
35 {
36 {
37 .angle_left = -0.907983,
38 .angle_right = 0.897738,
39 .angle_up = 0.954823,
40 .angle_down = -0.953044,
41 },
42 {
43
44 .angle_left = -0.897050,
45 .angle_right = 0.908661,
46 .angle_up = 0.954474,
47 .angle_down = -0.953057,
48 },
49 },
50 },
51 {
52 .device_serial_number = "LHR-C1BF2059", // @mateosss
53 .fovs =
54 {
55 {
56 .angle_left = -0.907341,
57 .angle_right = 0.897500,
58 .angle_up = 0.953644,
59 .angle_down = -0.953628,
60 },
61 {
62
63 .angle_left = -0.897566,
64 .angle_right = 0.907700,
65 .angle_up = 0.954293,
66 .angle_down = -0.952802,
67 },
68 },
69 },
70 };
71
72
73 /*
74 *
75 * 'Exported' functions.
76 *
77 */
78
79 void
80 vive_tweak_fovcxx . . $ vive_tweak_fov(3e4978d432203be5).(struct vive_configcxx . . $ vive_config# *config)
81 {
82 const char *device_serial_number = config->firmwarecxx . . $ vive_config#firmware..device_serial_numbercxx . . $ vive_config#$anonymous_type_4#device_serial_number.;
83
84 for (size_t i = 0; i < ARRAY_SIZEcxx . . $ `src/xrt/include/xrt/xrt_compiler.h:30:9`!(fovs); i++) {
85 const struct fov_entrycxx . . $ fov_entry# *e = &fovscxx . . $ fovs.[i];
86
87 if (strcmpcxx . . $ strcmp(5ae29d726ae57f88).(device_serial_number, e->device_serial_numbercxx . . $ fov_entry#device_serial_number.) != 0) {
88 continue;
89 }
90
91 U_LOG_Icxx . . $ `src/xrt/auxiliary/util/u_logging.h:298:9`!("Applying FoV tweaks to device serial '%s'", device_serial_number);
92
93 config->distortioncxx . . $ vive_config#distortion..fovcxx . . $ vive_config#$anonymous_type_5#fov.[0] = e->fovscxx . . $ fov_entry#fovs.[0];
94 config->distortioncxx . . $ vive_config#distortion..fovcxx . . $ vive_config#$anonymous_type_5#fov.[1] = e->fovscxx . . $ fov_entry#fovs.[1];
95 }
96 }