The open source OpenXR runtime
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

t/cli: Add info command for problem reporting

+163
+1
src/xrt/targets/cli/CMakeLists.txt
··· 7 7 add_executable( 8 8 cli 9 9 cli_cmd_calibration_dump.c 10 + cli_cmd_info.c 10 11 cli_cmd_lighthouse.c 11 12 cli_cmd_probe.c 12 13 cli_cmd_slambatch.c
+155
src/xrt/targets/cli/cli_cmd_info.c
··· 1 + // Copyright 2019-2023, Collabora, Ltd. 2 + // SPDX-License-Identifier: BSL-1.0 3 + /*! 4 + * @file 5 + * @brief Prints information about the system. 6 + * @author Jakob Bornecrantz <jakob@collabora.com> 7 + */ 8 + 9 + #include "xrt/xrt_space.h" 10 + #include "xrt/xrt_system.h" 11 + #include "xrt/xrt_device.h" 12 + #include "xrt/xrt_prober.h" 13 + #include "xrt/xrt_instance.h" 14 + #include "xrt/xrt_config_drivers.h" 15 + 16 + #include "util/u_git_tag.h" 17 + 18 + #include "cli_common.h" 19 + 20 + #include <string.h> 21 + #include <stdio.h> 22 + 23 + #define P(...) printf(__VA_ARGS__) 24 + #define PT(...) printf("\t" __VA_ARGS__) 25 + #define PTT(...) printf("\t\t" __VA_ARGS__) 26 + 27 + 28 + 29 + static int 30 + do_exit(struct xrt_instance **xi_ptr, int ret) 31 + { 32 + xrt_instance_destroy(xi_ptr); 33 + 34 + printf(" :: Exiting '%i'\n", ret); 35 + 36 + return ret; 37 + } 38 + 39 + int 40 + cli_cmd_info(int argc, const char **argv) 41 + { 42 + struct xrt_instance *xi = NULL; 43 + xrt_result_t xret = XRT_SUCCESS; 44 + int ret = 0; 45 + 46 + P(" :: Basic info\n"); 47 + PT("runtime: '%s'\n", u_runtime_description); 48 + PT("git-tag: '%s'\n", u_git_tag); 49 + 50 + 51 + /* 52 + * Initialize the instance and prober. 53 + */ 54 + 55 + P(" :: Creating instance and prober\n"); 56 + 57 + ret = xrt_instance_create(NULL, &xi); 58 + if (ret != 0) { 59 + PT("Failed to create instance!"); 60 + return do_exit(&xi, 0); 61 + } 62 + 63 + PT("instance: Ok\n"); 64 + 65 + struct xrt_prober *xp = NULL; 66 + xret = xrt_instance_get_prober(xi, &xp); 67 + if (xret != XRT_SUCCESS) { 68 + PT("No xrt_prober could be created!\n"); 69 + return do_exit(&xi, -1); 70 + } 71 + 72 + PT("prober: Ok\n"); 73 + 74 + 75 + /* 76 + * List builders, drivers and any modules. 77 + */ 78 + 79 + P(" :: Built builders\n"); 80 + 81 + size_t builder_count; 82 + struct xrt_builder **builders; 83 + size_t num_entries; 84 + struct xrt_prober_entry **entries; 85 + struct xrt_auto_prober **auto_probers; 86 + ret = xrt_prober_get_builders(xp, &builder_count, &builders, &num_entries, &entries, &auto_probers); 87 + if (ret != 0) { 88 + PT("Failed to get builders!"); 89 + do_exit(&xi, ret); 90 + } 91 + 92 + for (size_t i = 0; i < builder_count; i++) { 93 + struct xrt_builder *builder = builders[i]; 94 + if (builder == NULL) { 95 + continue; 96 + } 97 + 98 + PT("%s: %s\n", builder->identifier, builder->name); 99 + 100 + for (uint32_t k = 0; k < builder->driver_identifier_count; k++) { 101 + PTT("%s\n", builder->driver_identifiers[k]); 102 + } 103 + } 104 + 105 + P(" :: Built auto probers\n"); 106 + for (size_t i = 0; i < XRT_MAX_AUTO_PROBERS; i++) { 107 + if (auto_probers[i] == NULL) { 108 + continue; 109 + } 110 + 111 + PT("%s\n", auto_probers[i]->name); 112 + } 113 + 114 + P(" :: Built modules and drivers\n"); 115 + 116 + #ifdef XRT_BUILD_DRIVER_HANDTRACKING 117 + PT("ht\n"); 118 + #endif 119 + 120 + #ifdef XRT_BUILD_DRIVER_DEPTHAI 121 + PT("depthai\n"); 122 + #endif 123 + 124 + #ifdef XRT_BUILD_DRIVER_V4L2 125 + PT("v4l2\n"); 126 + #endif 127 + 128 + #ifdef XRT_BUILD_DRIVER_VF 129 + PT("vf\n"); 130 + #endif 131 + 132 + 133 + /* 134 + * Dump hardware devices connected. 135 + */ 136 + 137 + P(" :: Dumping devices\n"); 138 + 139 + // Need to first probe for devices. 140 + xrt_prober_probe(xp); 141 + 142 + // Then we can dump then. 143 + xrt_prober_dump(xp, true); 144 + 145 + 146 + /* 147 + * Done. 148 + */ 149 + 150 + // End of program 151 + P(" :: All ok, shutting down.\n"); 152 + 153 + // Finally done 154 + return do_exit(&xi, 0); 155 + }
+3
src/xrt/targets/cli/cli_common.h
··· 21 21 cli_cmd_calibration_dump(int argc, const char **argv); 22 22 23 23 int 24 + cli_cmd_info(int argc, const char **argv); 25 + 26 + int 24 27 cli_cmd_lighthouse(int argc, const char **argv); 25 28 26 29 int
+4
src/xrt/targets/cli/cli_main.c
··· 27 27 P("Usage: %s command [options] [file]\n", argv[0]); 28 28 P("\n"); 29 29 P("Commands:\n"); 30 + P(" info - Print information about Monado and the system, for bug reporting.\n"); 30 31 P(" test - List found devices, for prober testing.\n"); 31 32 P(" probe - Just probe and then exit.\n"); 32 33 P(" lighthouse - Control the power of lighthouses [on|off].\n"); ··· 44 45 return cli_print_help(argc, argv); 45 46 } 46 47 48 + if (strcmp(argv[1], "info") == 0) { 49 + return cli_cmd_info(argc, argv); 50 + } 47 51 if (strcmp(argv[1], "test") == 0) { 48 52 return cli_cmd_test(argc, argv); 49 53 }