The open source OpenXR runtime

d/vive/prober: Prettify logging. rename methods.

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