tangled
alpha
login
or
join now
matrixfurry.com
/
monado
The open source OpenXR runtime
0
fork
atom
overview
issues
pulls
pipelines
d/vive/prober: Prettify logging. rename methods.
Lubosz Sarnecki
5 years ago
7be5efbe
eaea6888
+20
-22
1 changed file
expand all
collapse all
unified
split
src
xrt
drivers
vive
vive_prober.c
+20
-22
src/xrt/drivers/vive/vive_prober.c
···
25
25
DEBUG_GET_ONCE_LOG_OPTION(vive_log, "VIVE_LOG", U_LOGGING_WARN)
26
26
27
27
static int
28
28
-
_print_prober_string(struct xrt_prober *xp,
29
29
-
struct xrt_prober_device *dev,
30
30
-
enum xrt_prober_string type)
28
28
+
log_vive_string(struct xrt_prober *xp,
29
29
+
struct xrt_prober_device *dev,
30
30
+
enum xrt_prober_string type)
31
31
{
32
32
unsigned char s[256] = {0};
33
33
int len = xrt_prober_get_string_descriptor(xp, dev, type, s, sizeof(s));
···
37
37
}
38
38
39
39
static void
40
40
-
_print_device_info(enum u_logging_level log_level,
41
41
-
struct xrt_prober *xp,
42
42
-
struct xrt_prober_device *dev)
40
40
+
log_vive_device(enum u_logging_level log_level,
41
41
+
struct xrt_prober *xp,
42
42
+
struct xrt_prober_device *dev)
43
43
{
44
44
if (log_level > U_LOGGING_INFO)
45
45
return;
46
46
47
47
-
U_LOG_I("========================");
48
48
-
U_LOG_I("vive: Probing Device");
49
49
-
U_LOG_I("vive: Vendor %04x", dev->vendor_id);
50
50
-
U_LOG_I("vive: Product %04x", dev->product_id);
51
51
-
U_LOG_I("vive: Class %d", dev->usb_dev_class);
52
52
-
U_LOG_I("vive: %s", xrt_bus_type_to_string(dev->bus));
53
53
-
_print_prober_string(xp, dev, XRT_PROBER_STRING_MANUFACTURER);
54
54
-
_print_prober_string(xp, dev, XRT_PROBER_STRING_PRODUCT);
55
55
-
_print_prober_string(xp, dev, XRT_PROBER_STRING_SERIAL_NUMBER);
56
56
-
U_LOG_I("========================");
47
47
+
U_LOG_I("====== vive device ======");
48
48
+
U_LOG_I("Vendor: %04x", dev->vendor_id);
49
49
+
U_LOG_I("Product: %04x", dev->product_id);
50
50
+
U_LOG_I("Class: %d", dev->usb_dev_class);
51
51
+
U_LOG_I("Bus type: %s", xrt_bus_type_to_string(dev->bus));
52
52
+
log_vive_string(xp, dev, XRT_PROBER_STRING_MANUFACTURER);
53
53
+
log_vive_string(xp, dev, XRT_PROBER_STRING_PRODUCT);
54
54
+
log_vive_string(xp, dev, XRT_PROBER_STRING_SERIAL_NUMBER);
57
55
}
58
56
59
57
static int
···
64
62
enum u_logging_level ll,
65
63
struct xrt_device **out_xdev)
66
64
{
67
67
-
_print_device_info(ll, xp, dev);
65
65
+
log_vive_device(ll, xp, dev);
68
66
69
67
if (!xrt_prober_match_string(xp, dev, XRT_PROBER_STRING_MANUFACTURER,
70
68
VIVE_MANUFACTURER_STRING) ||
···
81
79
d->product_id != VIVE_LIGHTHOUSE_FPGA_RX)
82
80
continue;
83
81
84
84
-
_print_device_info(ll, xp, d);
82
82
+
log_vive_device(ll, xp, d);
85
83
86
84
int result =
87
85
xrt_prober_open_hid_interface(xp, d, 0, &sensors_dev);
···
126
124
enum u_logging_level ll,
127
125
struct xrt_device **out_xdev)
128
126
{
129
129
-
_print_device_info(ll, xp, dev);
127
127
+
log_vive_device(ll, xp, dev);
130
128
131
129
if (!xrt_prober_match_string(xp, dev, XRT_PROBER_STRING_MANUFACTURER,
132
130
VIVE_MANUFACTURER_STRING) ||
···
144
142
d->product_id != VIVE_PRO_LHR_PID)
145
143
continue;
146
144
147
147
-
_print_device_info(ll, xp, d);
145
145
+
log_vive_device(ll, xp, d);
148
146
149
147
int result =
150
148
xrt_prober_open_hid_interface(xp, d, 0, &sensors_dev);
···
189
187
enum u_logging_level ll,
190
188
struct xrt_device **out_xdev)
191
189
{
192
192
-
_print_device_info(ll, xp, dev);
190
190
+
log_vive_device(ll, xp, dev);
193
191
194
192
if (!xrt_prober_match_string(xp, dev, XRT_PROBER_STRING_MANUFACTURER,
195
193
VALVE_INDEX_MANUFACTURER_STRING) ||
···
228
226
229
227
enum u_logging_level ll = debug_get_log_option_vive_log();
230
228
231
231
-
_print_device_info(ll, xp, dev);
229
229
+
log_vive_device(ll, xp, dev);
232
230
233
231
if (!xrt_prober_can_open(xp, dev)) {
234
232
U_LOG_E("Could not open Vive device.");