The open source OpenXR runtime
at main 72 lines 1.8 kB view raw
1// Copyright 2019-2021, Collabora, Ltd. 2// SPDX-License-Identifier: BSL-1.0 3/*! 4 * @file 5 * @brief A cli program to configure and test Monado. 6 * @author Jakob Bornecrantz <jakob@collabora.com> 7 */ 8 9#include "cli_common.h" 10 11#include "xrt/xrt_config_os.h" 12 13#include <string.h> 14#include <stdio.h> 15 16 17#define P(...) fprintf(stderr, __VA_ARGS__) 18 19static int 20cli_print_help(int argc, const char **argv) 21{ 22 if (argc >= 2) { 23 P("Unknown command '%s'\n\n", argv[1]); 24 } 25 26 P("Monado-CLI 0.0.1\n"); 27 P("Usage: %s command [options] [file]\n", argv[0]); 28 P("\n"); 29 P("Commands:\n"); 30 P(" info - Print information about Monado and the system, for bug reporting.\n"); 31 P(" test - List found devices, for prober testing.\n"); 32 P(" probe - Just probe and then exit.\n"); 33 P(" lighthouse - Control the power of lighthouses [on|off].\n"); 34 P(" calibrate - Calibrate a camera and save config (not implemented yet).\n"); 35 P(" calib-dump - Load and dump a calibration to stdout.\n"); 36 P(" slambatch - Runs a sequence of EuRoC datasets with the SLAM tracker.\n"); 37 38 return 1; 39} 40 41int 42main(int argc, const char **argv) 43{ 44 if (argc <= 1) { 45 return cli_print_help(argc, argv); 46 } 47 48 if (strcmp(argv[1], "info") == 0) { 49 return cli_cmd_info(argc, argv); 50 } 51 if (strcmp(argv[1], "test") == 0) { 52 return cli_cmd_test(argc, argv); 53 } 54 if (strcmp(argv[1], "probe") == 0) { 55 return cli_cmd_probe(argc, argv); 56 } 57#ifndef XRT_OS_WINDOWS 58 if (strcmp(argv[1], "calibrate") == 0) { 59 return cli_cmd_calibrate(argc, argv); 60 } 61#endif // !XRT_OS_WINDOWS 62 if (strcmp(argv[1], "calib-dump") == 0) { 63 return cli_cmd_calibration_dump(argc, argv); 64 } 65 if (strcmp(argv[1], "lighthouse") == 0) { 66 return cli_cmd_lighthouse(argc, argv); 67 } 68 if (strcmp(argv[1], "slambatch") == 0) { 69 return cli_cmd_slambatch(argc, argv); 70 } 71 return cli_print_help(argc, argv); 72}