mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-01-01 12:46:12 +00:00
xrt: Make sure that auto probers can add non-HMD devices after a HMD has been found
This commit is contained in:
parent
c2560ae6d2
commit
b3e84f9041
|
@ -51,10 +51,17 @@ oh_prober_destroy(struct xrt_auto_prober *p)
|
|||
}
|
||||
|
||||
static struct xrt_device *
|
||||
oh_prober_autoprobe(struct xrt_auto_prober *xap, struct xrt_prober *xp)
|
||||
oh_prober_autoprobe(struct xrt_auto_prober *xap,
|
||||
bool no_hmds,
|
||||
struct xrt_prober *xp)
|
||||
{
|
||||
struct oh_prober *ohp = oh_prober(xap);
|
||||
|
||||
// Do not use OpenHMD if we are not looking for HMDs.
|
||||
if (no_hmds) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int device_idx = -1;
|
||||
|
||||
/* Probe for devices */
|
||||
|
|
|
@ -69,7 +69,9 @@ psvr_prober_destroy(struct xrt_auto_prober *p)
|
|||
}
|
||||
|
||||
static struct xrt_device *
|
||||
psvr_prober_autoprobe(struct xrt_auto_prober *xap, struct xrt_prober *xp)
|
||||
psvr_prober_autoprobe(struct xrt_auto_prober *xap,
|
||||
bool no_hmds,
|
||||
struct xrt_prober *xp)
|
||||
{
|
||||
struct psvr_prober *ppsvr = psvr_prober(xap);
|
||||
struct hid_device_info *info_control = NULL;
|
||||
|
@ -78,6 +80,11 @@ psvr_prober_autoprobe(struct xrt_auto_prober *xap, struct xrt_prober *xp)
|
|||
struct hid_device_info *devs = NULL;
|
||||
struct xrt_device *dev = NULL;
|
||||
|
||||
// Do not look for the PSVR if we are not looking for HMDs.
|
||||
if (no_hmds) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
devs = hid_enumerate(PSVR_VID, PSVR_PID);
|
||||
cur_dev = devs;
|
||||
|
||||
|
|
|
@ -333,6 +333,7 @@ xrt_prober_match_string(struct xrt_prober *xp,
|
|||
struct xrt_auto_prober
|
||||
{
|
||||
struct xrt_device *(*lelo_dallas_autoprobe)(struct xrt_auto_prober *xap,
|
||||
bool no_hmds,
|
||||
struct xrt_prober *xp);
|
||||
void (*destroy)(struct xrt_auto_prober *xdev);
|
||||
};
|
||||
|
|
|
@ -592,16 +592,15 @@ select_device(struct xrt_prober *xp,
|
|||
for (int i = 0; i < MAX_AUTO_PROBERS && p->auto_probers[i]; i++) {
|
||||
|
||||
/*
|
||||
* If we have found a HMD stop checking the auto probers. This
|
||||
* is mostly to stop OpenHMD and Monado fighting over devices.
|
||||
* If we have found a HMD, tell the auto probers not to open
|
||||
* any more HMDs. This is mostly to stop OpenHMD and Monado
|
||||
* fighting over devices.
|
||||
*/
|
||||
if (xdevs[0] != NULL) {
|
||||
break;
|
||||
}
|
||||
bool no_hmds = xdevs[0] != NULL;
|
||||
|
||||
struct xrt_device *xdev =
|
||||
p->auto_probers[i]->lelo_dallas_autoprobe(
|
||||
p->auto_probers[i], xp);
|
||||
p->auto_probers[i], no_hmds, xp);
|
||||
if (xdev == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue