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.
This commit is contained in:
Christoph Haag 2021-07-14 02:43:54 +02:00 committed by Jakob Bornecrantz
parent c6b5c5322c
commit 162915f022

View file

@ -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;