d/ohmd: Do not open External Device by default

This commit is contained in:
Jakob Bornecrantz 2020-01-25 14:35:42 +00:00
parent 356e4c18c1
commit d305f773ea
2 changed files with 14 additions and 2 deletions

View file

@ -1,4 +1,4 @@
// Copyright 2019, Collabora, Ltd. // Copyright 2019-2020, Collabora, Ltd.
// SPDX-License-Identifier: BSL-1.0 // SPDX-License-Identifier: BSL-1.0
/*! /*!
* @file * @file
@ -22,6 +22,7 @@
DEBUG_GET_ONCE_BOOL_OPTION(oh_spew, "OH_PRINT_SPEW", false) DEBUG_GET_ONCE_BOOL_OPTION(oh_spew, "OH_PRINT_SPEW", false)
DEBUG_GET_ONCE_BOOL_OPTION(oh_debug, "OH_PRINT_DEBUG", false) DEBUG_GET_ONCE_BOOL_OPTION(oh_debug, "OH_PRINT_DEBUG", false)
DEBUG_GET_ONCE_BOOL_OPTION(oh_external, "OH_EXTERNAL_DRIVER", false)
struct oh_prober struct oh_prober
{ {
@ -70,6 +71,7 @@ oh_prober_autoprobe(struct xrt_auto_prober *xap,
/* Then loop */ /* Then loop */
for (int i = 0; i < num_devices; i++) { for (int i = 0; i < num_devices; i++) {
int device_class = 0, device_flags = 0; int device_class = 0, device_flags = 0;
const char *prod = NULL;
ohmd_list_geti(ohp->ctx, i, OHMD_DEVICE_CLASS, &device_class); ohmd_list_geti(ohp->ctx, i, OHMD_DEVICE_CLASS, &device_class);
ohmd_list_geti(ohp->ctx, i, OHMD_DEVICE_FLAGS, &device_flags); ohmd_list_geti(ohp->ctx, i, OHMD_DEVICE_FLAGS, &device_flags);
@ -87,6 +89,16 @@ oh_prober_autoprobe(struct xrt_auto_prober *xap,
continue; continue;
} }
prod = ohmd_list_gets(ohp->ctx, i, OHMD_PRODUCT);
if (strcmp(prod, "External Device") == 0 &&
!debug_get_bool_option_oh_external()) {
OH_DEBUG(
ohp,
"Rejecting device idx %i, is a External device.",
i);
continue;
}
OH_DEBUG(ohp, "Selecting device idx %i", i); OH_DEBUG(ohp, "Selecting device idx %i", i);
device_idx = i; device_idx = i;
break; break;

View file

@ -89,7 +89,7 @@ xrt_auto_prober_creator target_auto_list[] = {
#endif #endif
#ifdef XRT_BUILD_DRIVER_OHMD #ifdef XRT_BUILD_DRIVER_OHMD
// OpenHMD last as we want to override it with native drivers. // OpenHMD second last as we want to override it with native drivers.
oh_create_auto_prober, oh_create_auto_prober,
#endif #endif