From 162915f0222619337954d42f22864b5b20a6d908 Mon Sep 17 00:00:00 2001 From: Christoph Haag Date: Wed, 14 Jul 2021 02:43:54 +0200 Subject: [PATCH] p/prober: disable all drivers when qwerty is enabled qwerty is auto probed, making HMDs that are not auto probed always take precedence. When setting QWERTY_ENABLE=1 the intent is usually to exclusively use qwerty. Therefore we default to disabling all other drivers when this variable is set. To make the old behavior of adding qwerty devices with lower priority than actual devices, the variable QWERTY_COMBINE=1 is introduced. --- src/xrt/state_trackers/prober/p_prober.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/xrt/state_trackers/prober/p_prober.c b/src/xrt/state_trackers/prober/p_prober.c index 9906e8890..dc86d621f 100644 --- a/src/xrt/state_trackers/prober/p_prober.c +++ b/src/xrt/state_trackers/prober/p_prober.c @@ -42,6 +42,8 @@ */ DEBUG_GET_ONCE_LOG_OPTION(prober_log, "PROBER_LOG", U_LOGGING_INFO) +DEBUG_GET_ONCE_BOOL_OPTION(qwerty_enable, "QWERTY_ENABLE", false) +DEBUG_GET_ONCE_BOOL_OPTION(qwerty_combine, "QWERTY_COMBINE", false) static void add_device(struct prober *p, struct prober_device **out_dev); @@ -315,6 +317,18 @@ char *driver_conflicts[num_driver_conflicts][2] = {{"survive", "vive"}}; static void disable_drivers_from_conflicts(struct prober *p) { + if (debug_get_bool_option_qwerty_enable() && !debug_get_bool_option_qwerty_combine()) { + for (size_t entry = 0; entry < p->num_entries; entry++) { + if (strcmp(p->entries[entry]->driver_name, "Qwerty") != 0) { + P_INFO(p, "Disabling %s because we have %s", p->entries[entry]->driver_name, "Qwerty"); + size_t index = p->num_disabled_drivers++; + U_ARRAY_REALLOC_OR_FREE(p->disabled_drivers, char *, p->num_disabled_drivers); + p->disabled_drivers[index] = (char *)p->entries[entry]->driver_name; + } + } + return; + } + for (size_t i = 0; i < num_driver_conflicts; i++) { bool have_first = false; bool have_second = false;