From db2ce6237bd7dce0960ca61f9bd6758de1e19eb3 Mon Sep 17 00:00:00 2001 From: Beyley Cardellio Date: Mon, 24 Mar 2025 22:35:34 -0700 Subject: [PATCH] t/constellation: More descriptive device types Make the device description in the logs more useful by recognising other tracked devices than just left/right controllers --- .../constellation/t_constellation_tracking.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/xrt/tracking/constellation/t_constellation_tracking.c b/src/xrt/tracking/constellation/t_constellation_tracking.c index b5f881776..e813bc7b3 100644 --- a/src/xrt/tracking/constellation/t_constellation_tracking.c +++ b/src/xrt/tracking/constellation/t_constellation_tracking.c @@ -1144,9 +1144,18 @@ t_constellation_tracker_add_device(struct t_constellation_tracker *ct, device->last_matched_cam = -1; ct->num_devices++; + const char *device_type; + switch (xdev->device_type) { + case XRT_DEVICE_TYPE_HMD: device_type = "HMD"; break; + case XRT_DEVICE_TYPE_RIGHT_HAND_CONTROLLER: device_type = "Right"; break; + case XRT_DEVICE_TYPE_LEFT_HAND_CONTROLLER: device_type = "Left"; break; + case XRT_DEVICE_TYPE_ANY_HAND_CONTROLLER: device_type = "Any"; break; + case XRT_DEVICE_TYPE_GENERIC_TRACKER: device_type = "Tracker"; break; + default: device_type = "Unknown"; break; + } + char dev_name[64]; - sprintf(dev_name, "Device %u - %s", ct->num_devices, - xdev->device_type == XRT_DEVICE_TYPE_LEFT_HAND_CONTROLLER ? "Left" : "Right"); + sprintf(dev_name, "Device %u - %s", ct->num_devices, device_type); u_var_add_ro_text(ct, "Device", dev_name); u_var_add_pose(ct, &device->last_seen_pose, "Last observed global pose"); u_var_add_u64(ct, &device->last_seen_pose_ts, "Last observed pose");