st/oxr: fix finding profiles for device

fixes 6627049af3
This commit is contained in:
Christoph Haag 2021-11-24 00:28:14 +01:00
parent 821c7f0f7a
commit 22d9d97e61

View file

@ -287,6 +287,10 @@ get_profile_for_device_name(struct oxr_logger *log,
enum xrt_device_name name,
struct oxr_interaction_profile **out_p)
{
/*
* Map xrt_device_name to an interaction profile XrPath.
* Set *out_p to an oxr_interaction_profile if bindings for that interaction profile XrPath have been suggested.
*/
#define FIND_PROFILE(PATH) interaction_profile_find(log, inst, inst->path_cache.PATH, out_p)
switch (name) {
@ -332,13 +336,19 @@ oxr_find_profile_for_device(struct oxr_logger *log,
return;
}
// Does the device directly have a binding profile.
// Have bindings for this device's interaction profile been suggested?
get_profile_for_device_name(log, inst, xdev->name, out_p);
if (*out_p != NULL) {
return;
}
// Find all other binding profile for all device provided profiles.
// Check if bindings for any of this device's alternative interaction profiles have been suggested.
for (size_t i = 0; i < xdev->binding_profile_count; i++) {
struct xrt_binding_profile *xbp = &xdev->binding_profiles[i];
get_profile_for_device_name(log, inst, xbp->name, out_p);
if (*out_p != NULL) {
return;
}
}
}