From e29824451620abe00a90037e1f1960bcf2df953f Mon Sep 17 00:00:00 2001 From: Simon Zeni Date: Thu, 1 Aug 2024 16:31:11 -0400 Subject: [PATCH] xrt: use int64_t for timestamp in get_hand_tracking Part-of: --- src/xrt/drivers/ht/ht_driver.c | 4 ++-- src/xrt/drivers/ht_ctrl_emu/ht_ctrl_emu.cpp | 10 +++++----- src/xrt/drivers/multi_wrapper/multi.c | 4 ++-- src/xrt/drivers/opengloves/opengloves_device.c | 4 ++-- src/xrt/drivers/remote/r_device.c | 4 ++-- src/xrt/drivers/remote/r_hmd.c | 4 ++-- src/xrt/drivers/simulated/simulated_controller.c | 4 ++-- src/xrt/drivers/steamvr_lh/device.cpp | 4 ++-- src/xrt/drivers/steamvr_lh/device.hpp | 4 ++-- src/xrt/drivers/survive/survive_driver.c | 4 ++-- src/xrt/drivers/vive/vive_controller.c | 4 ++-- src/xrt/include/xrt/xrt_device.h | 8 ++++---- src/xrt/ipc/client/ipc_client_device.c | 4 ++-- src/xrt/ipc/server/ipc_server_handler.c | 4 ++-- src/xrt/ipc/shared/proto.json | 4 ++-- src/xrt/state_trackers/oxr/oxr_xdev.c | 4 ++-- src/xrt/state_trackers/steamvr_drv/ovrd_driver.cpp | 2 +- 17 files changed, 38 insertions(+), 38 deletions(-) diff --git a/src/xrt/drivers/ht/ht_driver.c b/src/xrt/drivers/ht/ht_driver.c index 2a4fff959..895975fb8 100644 --- a/src/xrt/drivers/ht/ht_driver.c +++ b/src/xrt/drivers/ht/ht_driver.c @@ -148,9 +148,9 @@ userConfigSetDefaults(struct ht_device *htd) static void ht_device_get_hand_tracking(struct xrt_device *xdev, enum xrt_input_name name, - uint64_t at_timestamp_ns, + int64_t at_timestamp_ns, struct xrt_hand_joint_set *out_value, - uint64_t *out_timestamp_ns) + int64_t *out_timestamp_ns) { struct ht_device *htd = ht_device(xdev); diff --git a/src/xrt/drivers/ht_ctrl_emu/ht_ctrl_emu.cpp b/src/xrt/drivers/ht_ctrl_emu/ht_ctrl_emu.cpp index ce96d419c..b35b9aad3 100644 --- a/src/xrt/drivers/ht_ctrl_emu/ht_ctrl_emu.cpp +++ b/src/xrt/drivers/ht_ctrl_emu/ht_ctrl_emu.cpp @@ -134,9 +134,9 @@ cemu_device_destroy(struct xrt_device *xdev) static void cemu_device_get_hand_tracking(struct xrt_device *xdev, enum xrt_input_name name, - uint64_t requested_timestamp_ns, + int64_t requested_timestamp_ns, struct xrt_hand_joint_set *out_value, - uint64_t *out_timestamp_ns) + int64_t *out_timestamp_ns) { // Shadows normal hand tracking - does nothing differently @@ -231,8 +231,8 @@ get_other_two(struct cemu_device *dev, } else { other = 0; } - uint64_t noop; + int64_t noop; xrt_device_get_hand_tracking(dev->sys->in_hand, dev->sys->out_hand[other]->ht_input_name, hand_timestamp_ns, out_secondary, &noop); } @@ -329,7 +329,7 @@ cemu_device_get_tracked_pose(struct xrt_device *xdev, CEMU_ERROR(dev, "unknown input name %d for controller pose", name); return; } - static uint64_t hand_timestamp_ns; + static int64_t hand_timestamp_ns; struct xrt_hand_joint_set joint_set; sys->in_hand->get_hand_tracking(sys->in_hand, dev->ht_input_name, at_timestamp_ns, &joint_set, @@ -384,7 +384,7 @@ cemu_device_update_inputs(struct xrt_device *xdev) struct cemu_device *dev = cemu_device(xdev); struct xrt_hand_joint_set joint_set; - uint64_t noop; + int64_t noop; xrt_device_get_hand_tracking(dev->sys->in_hand, dev->ht_input_name, os_monotonic_get_ns(), &joint_set, &noop); diff --git a/src/xrt/drivers/multi_wrapper/multi.c b/src/xrt/drivers/multi_wrapper/multi.c index 60e1b8d34..f433ef9fe 100644 --- a/src/xrt/drivers/multi_wrapper/multi.c +++ b/src/xrt/drivers/multi_wrapper/multi.c @@ -134,9 +134,9 @@ destroy(struct xrt_device *xdev) static void get_hand_tracking(struct xrt_device *xdev, enum xrt_input_name name, - uint64_t at_timestamp_ns, + int64_t at_timestamp_ns, struct xrt_hand_joint_set *out_value, - uint64_t *out_timestamp_ns) + int64_t *out_timestamp_ns) { struct multi_device *d = (struct multi_device *)xdev; struct xrt_device *target = d->tracking_override.target; diff --git a/src/xrt/drivers/opengloves/opengloves_device.c b/src/xrt/drivers/opengloves/opengloves_device.c index 7499c2cff..01ffffaad 100644 --- a/src/xrt/drivers/opengloves/opengloves_device.c +++ b/src/xrt/drivers/opengloves/opengloves_device.c @@ -89,9 +89,9 @@ opengloves_device(struct xrt_device *xdev) static void opengloves_device_get_hand_tracking(struct xrt_device *xdev, enum xrt_input_name name, - uint64_t requested_timestamp_ns, + int64_t requested_timestamp_ns, struct xrt_hand_joint_set *out_joint_set, - uint64_t *out_timestamp_ns) + int64_t *out_timestamp_ns) { struct opengloves_device *od = opengloves_device(xdev); diff --git a/src/xrt/drivers/remote/r_device.c b/src/xrt/drivers/remote/r_device.c index 03ed6a882..757925a40 100644 --- a/src/xrt/drivers/remote/r_device.c +++ b/src/xrt/drivers/remote/r_device.c @@ -135,9 +135,9 @@ r_device_get_tracked_pose(struct xrt_device *xdev, static void r_device_get_hand_tracking(struct xrt_device *xdev, enum xrt_input_name name, - uint64_t requested_timestamp_ns, + int64_t requested_timestamp_ns, struct xrt_hand_joint_set *out_value, - uint64_t *out_timestamp_ns) + int64_t *out_timestamp_ns) { struct r_device *rd = r_device(xdev); struct r_hub *r = rd->r; diff --git a/src/xrt/drivers/remote/r_hmd.c b/src/xrt/drivers/remote/r_hmd.c index fc341b4b7..c9976d822 100644 --- a/src/xrt/drivers/remote/r_hmd.c +++ b/src/xrt/drivers/remote/r_hmd.c @@ -73,9 +73,9 @@ r_hmd_get_tracked_pose(struct xrt_device *xdev, static void r_hmd_get_hand_tracking(struct xrt_device *xdev, enum xrt_input_name name, - uint64_t at_timestamp_ns, + int64_t at_timestamp_ns, struct xrt_hand_joint_set *out_value, - uint64_t *out_timestamp_ns) + int64_t *out_timestamp_ns) { struct r_hmd *rh = r_hmd(xdev); (void)rh; diff --git a/src/xrt/drivers/simulated/simulated_controller.c b/src/xrt/drivers/simulated/simulated_controller.c index e5fba51ba..1e81e1202 100644 --- a/src/xrt/drivers/simulated/simulated_controller.c +++ b/src/xrt/drivers/simulated/simulated_controller.c @@ -162,9 +162,9 @@ simulated_device_get_tracked_pose(struct xrt_device *xdev, static void simulated_device_get_hand_tracking(struct xrt_device *xdev, enum xrt_input_name name, - uint64_t requested_timestamp_ns, + int64_t requested_timestamp_ns, struct xrt_hand_joint_set *out_value, - uint64_t *out_timestamp_ns) + int64_t *out_timestamp_ns) { assert(false); } diff --git a/src/xrt/drivers/steamvr_lh/device.cpp b/src/xrt/drivers/steamvr_lh/device.cpp index eebc11052..d983dbbec 100644 --- a/src/xrt/drivers/steamvr_lh/device.cpp +++ b/src/xrt/drivers/steamvr_lh/device.cpp @@ -399,9 +399,9 @@ ControllerDevice::get_finger_from_name(const std::string_view name) void ControllerDevice::get_hand_tracking(enum xrt_input_name name, - uint64_t desired_timestamp_ns, + int64_t desired_timestamp_ns, struct xrt_hand_joint_set *out_value, - uint64_t *out_timestamp_ns) + int64_t *out_timestamp_ns) { if (!has_index_hand_tracking) return; diff --git a/src/xrt/drivers/steamvr_lh/device.hpp b/src/xrt/drivers/steamvr_lh/device.hpp index 70c5b68d2..312aafaa0 100644 --- a/src/xrt/drivers/steamvr_lh/device.hpp +++ b/src/xrt/drivers/steamvr_lh/device.hpp @@ -176,9 +176,9 @@ public: void get_hand_tracking(enum xrt_input_name name, - uint64_t desired_timestamp_ns, + int64_t desired_timestamp_ns, struct xrt_hand_joint_set *out_value, - uint64_t *out_timestamp_ns); + int64_t *out_timestamp_ns); xrt_hand get_xrt_hand(); diff --git a/src/xrt/drivers/survive/survive_driver.c b/src/xrt/drivers/survive/survive_driver.c index c4e200053..afaa0e9a4 100644 --- a/src/xrt/drivers/survive/survive_driver.c +++ b/src/xrt/drivers/survive/survive_driver.c @@ -458,9 +458,9 @@ struct Button buttons[255] = { static void survive_controller_get_hand_tracking(struct xrt_device *xdev, enum xrt_input_name name, - uint64_t at_timestamp_ns, + int64_t at_timestamp_ns, struct xrt_hand_joint_set *out_value, - uint64_t *out_timestamp_ns) + int64_t *out_timestamp_ns) { struct survive_device *survive = (struct survive_device *)xdev; diff --git a/src/xrt/drivers/vive/vive_controller.c b/src/xrt/drivers/vive/vive_controller.c index 8b457b449..3b0335b82 100644 --- a/src/xrt/drivers/vive/vive_controller.c +++ b/src/xrt/drivers/vive/vive_controller.c @@ -363,9 +363,9 @@ vive_controller_device_index_update_inputs(struct xrt_device *xdev) static void vive_controller_get_hand_tracking(struct xrt_device *xdev, enum xrt_input_name name, - uint64_t requested_timestamp_ns, + int64_t requested_timestamp_ns, struct xrt_hand_joint_set *out_value, - uint64_t *out_timestamp_ns) + int64_t *out_timestamp_ns) { XRT_TRACE_MARKER(); diff --git a/src/xrt/include/xrt/xrt_device.h b/src/xrt/include/xrt/xrt_device.h index a13ee2344..ce44700d6 100644 --- a/src/xrt/include/xrt/xrt_device.h +++ b/src/xrt/include/xrt/xrt_device.h @@ -338,9 +338,9 @@ struct xrt_device */ void (*get_hand_tracking)(struct xrt_device *xdev, enum xrt_input_name name, - uint64_t desired_timestamp_ns, + int64_t desired_timestamp_ns, struct xrt_hand_joint_set *out_value, - uint64_t *out_timestamp_ns); + int64_t *out_timestamp_ns); /*! * @brief Get the requested blend shape properties & weights for a face tracker @@ -563,9 +563,9 @@ xrt_device_get_tracked_pose(struct xrt_device *xdev, static inline void xrt_device_get_hand_tracking(struct xrt_device *xdev, enum xrt_input_name name, - uint64_t desired_timestamp_ns, + int64_t desired_timestamp_ns, struct xrt_hand_joint_set *out_value, - uint64_t *out_timestamp_ns) + int64_t *out_timestamp_ns) { xdev->get_hand_tracking(xdev, name, desired_timestamp_ns, out_value, out_timestamp_ns); } diff --git a/src/xrt/ipc/client/ipc_client_device.c b/src/xrt/ipc/client/ipc_client_device.c index 656d8847d..5d53a2726 100644 --- a/src/xrt/ipc/client/ipc_client_device.c +++ b/src/xrt/ipc/client/ipc_client_device.c @@ -102,9 +102,9 @@ ipc_client_device_get_tracked_pose(struct xrt_device *xdev, static void ipc_client_device_get_hand_tracking(struct xrt_device *xdev, enum xrt_input_name name, - uint64_t at_timestamp_ns, + int64_t at_timestamp_ns, struct xrt_hand_joint_set *out_value, - uint64_t *out_timestamp_ns) + int64_t *out_timestamp_ns) { ipc_client_device_t *icd = ipc_client_device(xdev); diff --git a/src/xrt/ipc/server/ipc_server_handler.c b/src/xrt/ipc/server/ipc_server_handler.c index 0826b9d40..f07e5e7db 100644 --- a/src/xrt/ipc/server/ipc_server_handler.c +++ b/src/xrt/ipc/server/ipc_server_handler.c @@ -1892,9 +1892,9 @@ xrt_result_t ipc_handle_device_get_hand_tracking(volatile struct ipc_client_state *ics, uint32_t id, enum xrt_input_name name, - uint64_t at_timestamp, + int64_t at_timestamp, struct xrt_hand_joint_set *out_value, - uint64_t *out_timestamp) + int64_t *out_timestamp) { // To make the code a bit more readable. diff --git a/src/xrt/ipc/shared/proto.json b/src/xrt/ipc/shared/proto.json index 2d84f2eb8..04e5edca5 100644 --- a/src/xrt/ipc/shared/proto.json +++ b/src/xrt/ipc/shared/proto.json @@ -406,11 +406,11 @@ "in": [ {"name": "id", "type": "uint32_t"}, {"name": "name", "type": "enum xrt_input_name"}, - {"name": "at_timestamp", "type": "uint64_t"} + {"name": "at_timestamp", "type": "int64_t"} ], "out": [ {"name": "value", "type": "struct xrt_hand_joint_set"}, - {"name": "timestamp", "type": "uint64_t"} + {"name": "timestamp", "type": "int64_t"} ] }, diff --git a/src/xrt/state_trackers/oxr/oxr_xdev.c b/src/xrt/state_trackers/oxr/oxr_xdev.c index 7619b6fa6..07de36573 100644 --- a/src/xrt/state_trackers/oxr/oxr_xdev.c +++ b/src/xrt/state_trackers/oxr/oxr_xdev.c @@ -122,11 +122,11 @@ oxr_xdev_get_hand_tracking_at(struct oxr_logger *log, struct xrt_hand_joint_set *out_value) { //! Convert at_time to monotonic and give to device. - uint64_t at_timestamp_ns = time_state_ts_to_monotonic_ns(inst->timekeeping, at_time); + int64_t at_timestamp_ns = time_state_ts_to_monotonic_ns(inst->timekeeping, at_time); struct xrt_hand_joint_set value; - uint64_t ignored; + int64_t ignored; xrt_device_get_hand_tracking(xdev, name, at_timestamp_ns, &value, &ignored); diff --git a/src/xrt/state_trackers/steamvr_drv/ovrd_driver.cpp b/src/xrt/state_trackers/steamvr_drv/ovrd_driver.cpp index 5d9b07884..642660345 100644 --- a/src/xrt/state_trackers/steamvr_drv/ovrd_driver.cpp +++ b/src/xrt/state_trackers/steamvr_drv/ovrd_driver.cpp @@ -970,7 +970,7 @@ public: timepoint_ns now_ns = os_monotonic_get_ns(); struct xrt_hand_joint_set out_joint_set_value; - uint64_t out_timestamp_ns; + int64_t out_timestamp_ns; m_xdev->get_hand_tracking(m_xdev, m_hand == XRT_HAND_LEFT ? XRT_INPUT_GENERIC_HAND_TRACKING_LEFT