d/all: Use u_device_noop_update_inputs helper

This commit is contained in:
Jakob Bornecrantz 2023-11-15 16:25:27 +00:00
parent 45f1a2d230
commit 1254e5041c
18 changed files with 31 additions and 139 deletions

View file

@ -1,7 +1,7 @@
// Copyright 2013, Fredrik Hultin.
// Copyright 2013, Jakob Bornecrantz.
// Copyright 2015, Joey Ferwerda.
// Copyright 2020, Collabora, Ltd.
// Copyright 2020-2023, Collabora, Ltd.
// SPDX-License-Identifier: BSL-1.0
/*!
* @file
@ -169,12 +169,6 @@ android_device_destroy(struct xrt_device *xdev)
free(android);
}
static void
android_device_update_inputs(struct xrt_device *xdev)
{
// Empty
}
static void
android_device_get_tracked_pose(struct xrt_device *xdev,
enum xrt_input_name name,
@ -229,7 +223,7 @@ android_device_create()
d->base.name = XRT_DEVICE_GENERIC_HMD;
d->base.destroy = android_device_destroy;
d->base.update_inputs = android_device_update_inputs;
d->base.update_inputs = u_device_noop_update_inputs;
d->base.get_tracked_pose = android_device_get_tracked_pose;
d->base.get_view_poses = android_device_get_view_poses;
d->base.compute_distortion = android_device_compute_distortion;

View file

@ -101,10 +101,6 @@ euroc_device(struct xrt_device *xdev)
return (struct euroc_device *)xdev;
}
static void
euroc_device_update_inputs(struct xrt_device *xdev)
{}
//! Corrections specific for original euroc datasets and Kimera.
//! If your datasets comes from a different camera you should probably
//! use a different pose correction function.
@ -247,7 +243,7 @@ euroc_device_create(struct xrt_prober *xp)
xd->inputs[0].name = XRT_INPUT_SIMPLE_GRIP_POSE;
}
xd->update_inputs = euroc_device_update_inputs;
xd->update_inputs = u_device_noop_update_inputs;
xd->get_tracked_pose = euroc_device_get_tracked_pose;
xd->destroy = euroc_device_destroy;
if (is_hmd) {

View file

@ -1,4 +1,4 @@
// Copyright 2019, Collabora, Ltd.
// Copyright 2019-2023, Collabora, Ltd.
// Copyright 2014, Kevin M. Godby
// Copyright 2014-2018, Sensics, Inc.
// SPDX-License-Identifier: BSL-1.0
@ -110,12 +110,6 @@ hdk_device_destroy(struct xrt_device *xdev)
free(hd);
}
static void
hdk_device_update_inputs(struct xrt_device *xdev)
{
// Empty
}
static constexpr uint8_t MSG_LEN_LARGE = 32;
static constexpr uint8_t MSG_LEN_SMALL = 16;
@ -309,7 +303,7 @@ hdk_device_create(struct os_hid_device *dev, enum HDK_VARIANT variant)
hd->base.hmd->blend_modes[idx++] = XRT_BLEND_MODE_OPAQUE;
hd->base.hmd->blend_mode_count = idx;
hd->base.update_inputs = hdk_device_update_inputs;
hd->base.update_inputs = u_device_noop_update_inputs;
hd->base.get_tracked_pose = hdk_device_get_tracked_pose;
hd->base.get_view_poses = hdk_device_get_view_poses;
hd->base.destroy = hdk_device_destroy;

View file

@ -1,4 +1,4 @@
// Copyright 2021, Collabora, Ltd.
// Copyright 2021-2023, Collabora, Ltd.
// SPDX-License-Identifier: BSL-1.0
/*!
* @file
@ -145,12 +145,6 @@ userConfigSetDefaults(struct ht_device *htd)
* xrt_device function implementations
*/
static void
ht_device_update_inputs(struct xrt_device *xdev)
{
// Empty
}
static void
ht_device_get_hand_tracking(struct xrt_device *xdev,
enum xrt_input_name name,
@ -214,7 +208,7 @@ ht_device_create_common(struct t_stereo_camera_calibration *calib,
htd->base.tracking_origin->offset.position.z = 0.0f;
htd->base.tracking_origin->offset.orientation.w = 1.0f;
htd->base.update_inputs = ht_device_update_inputs;
htd->base.update_inputs = u_device_noop_update_inputs;
htd->base.get_hand_tracking = ht_device_get_hand_tracking;
htd->base.destroy = ht_device_destroy;

View file

@ -107,12 +107,6 @@ illixr_hmd_destroy(struct xrt_device *xdev)
u_device_free(&dh->base);
}
static void
illixr_hmd_update_inputs(struct xrt_device *xdev)
{
// Empty
}
static void
illixr_hmd_get_tracked_pose(struct xrt_device *xdev,
enum xrt_input_name name,
@ -173,7 +167,7 @@ illixr_hmd_create(const char *path_in, const char *comp_in)
enum u_device_alloc_flags flags =
(enum u_device_alloc_flags)(U_DEVICE_ALLOC_HMD | U_DEVICE_ALLOC_TRACKING_NONE);
dh = U_DEVICE_ALLOCATE(struct illixr_hmd, flags, 1, 0);
dh->base.update_inputs = illixr_hmd_update_inputs;
dh->base.update_inputs = u_device_noop_update_inputs;
dh->base.get_tracked_pose = illixr_hmd_get_tracked_pose;
dh->base.get_view_poses = illixr_hmd_get_view_poses;
dh->base.destroy = illixr_hmd_destroy;

View file

@ -1,4 +1,4 @@
// Copyright 2020, Collabora, Ltd.
// Copyright 2020-2023, Collabora, Ltd.
// Copyright 2020, Nova King.
// Copyright 2020, Moses Turner.
// SPDX-License-Identifier: BSL-1.0
@ -367,13 +367,6 @@ ns_hmd_destroy(struct xrt_device *xdev)
u_device_free(&ns->base);
}
static void
ns_hmd_update_inputs(struct xrt_device *xdev)
{
struct ns_hmd *ns = ns_hmd(xdev);
NS_DEBUG(ns, "Called!");
}
static void
ns_hmd_get_tracked_pose(struct xrt_device *xdev,
enum xrt_input_name name,
@ -471,7 +464,7 @@ ns_hmd_create(const cJSON *config_json)
ns->base.compute_distortion = ns_mesh_calc;
ns->base.update_inputs = ns_hmd_update_inputs;
ns->base.update_inputs = u_device_noop_update_inputs;
ns->base.get_tracked_pose = ns_hmd_get_tracked_pose;
ns->base.get_view_poses = ns_hmd_get_view_poses;
ns->base.destroy = ns_hmd_destroy;

View file

@ -1,4 +1,4 @@
// Copyright 2020, Collabora, Ltd.
// Copyright 2020-2023, Collabora, Ltd.
// Copyright 2020, Nova King.
// SPDX-License-Identifier: BSL-1.0
/*!
@ -389,12 +389,6 @@ load_config(struct rs_ddev *rs)
*
*/
static void
rs_ddev_update_inputs(struct xrt_device *xdev)
{
// Empty
}
static void
rs_ddev_get_tracked_pose(struct xrt_device *xdev,
enum xrt_input_name name,
@ -466,7 +460,7 @@ rs_ddev_create(int device_idx)
U_LOG_D("Realsense opts are %i %i %i %i %i\n", rs->enable_mapping, rs->enable_pose_jumping,
rs->enable_relocalization, rs->enable_pose_prediction, rs->enable_pose_filtering);
rs->base.update_inputs = rs_ddev_update_inputs;
rs->base.update_inputs = u_device_noop_update_inputs;
rs->base.get_tracked_pose = rs_ddev_get_tracked_pose;
rs->base.get_view_poses = rs_ddev_get_view_poses;
rs->base.destroy = rs_ddev_destroy;

View file

@ -217,12 +217,6 @@ rs_hdev_from_xdev(struct xrt_device *xdev)
return rh;
}
static void
rs_hdev_update_inputs(struct xrt_device *xdev)
{
return;
}
//! Specific pose corrections for Kimera and the D455 camera
XRT_MAYBE_UNUSED static inline struct xrt_pose
rs_hdev_correct_pose_from_kimera(struct xrt_pose pose)
@ -1013,7 +1007,7 @@ rs_hdev_create(struct xrt_prober *xp, int device_idx)
xd->orientation_tracking_supported = true;
xd->position_tracking_supported = true;
xd->update_inputs = rs_hdev_update_inputs;
xd->update_inputs = u_device_noop_update_inputs;
xd->get_tracked_pose = rs_hdev_get_tracked_pose;
xd->destroy = rs_hdev_destroy;

View file

@ -1,4 +1,4 @@
// Copyright 2020-2022, Collabora, Ltd.
// Copyright 2020-2023, Collabora, Ltd.
// SPDX-License-Identifier: BSL-1.0
/*!
* @file
@ -56,13 +56,6 @@ r_hmd_destroy(struct xrt_device *xdev)
u_device_free(&rh->base);
}
static void
r_hmd_update_inputs(struct xrt_device *xdev)
{
struct r_hmd *rh = r_hmd(xdev);
(void)rh;
}
static void
r_hmd_get_tracked_pose(struct xrt_device *xdev,
enum xrt_input_name name,
@ -148,7 +141,7 @@ r_hmd_create(struct r_hub *r)
struct r_hmd, flags, input_count, output_count);
// Setup the basics.
rh->base.update_inputs = r_hmd_update_inputs;
rh->base.update_inputs = u_device_noop_update_inputs;
rh->base.get_tracked_pose = r_hmd_get_tracked_pose;
rh->base.get_hand_tracking = r_hmd_get_hand_tracking;
rh->base.get_view_poses = r_hmd_get_view_poses;

View file

@ -43,9 +43,6 @@
#define DEG_TO_RAD(D) ((D)*M_PI / 180.)
static void
rift_s_update_inputs(struct xrt_device *xdev)
{}
static void
rift_s_get_tracked_pose(struct xrt_device *xdev,
@ -228,7 +225,7 @@ rift_s_hmd_create(struct rift_s_system *sys, const unsigned char *hmd_serial_no,
hmd->base.tracking_origin = &sys->base;
hmd->base.update_inputs = rift_s_update_inputs;
hmd->base.update_inputs = u_device_noop_update_inputs;
hmd->base.get_tracked_pose = rift_s_get_tracked_pose;
hmd->base.get_view_poses = rift_s_get_view_poses;
hmd->base.destroy = rift_s_hmd_destroy;

View file

@ -430,12 +430,6 @@ rokid_hmd_destroy(struct xrt_device *xdev)
u_device_free(&rokid->base);
}
static void
rokid_hmd_update_inputs(struct xrt_device *xdev)
{
// Empty, everything is done in the USB thread
}
static void
rokid_hmd_get_tracked_pose(struct xrt_device *xdev,
enum xrt_input_name name,
@ -498,7 +492,7 @@ rokid_hmd_create(struct xrt_prober_device *prober_device)
rokid->base.hmd->blend_modes[idx++] = XRT_BLEND_MODE_OPAQUE;
rokid->base.hmd->blend_mode_count = idx;
rokid->base.update_inputs = rokid_hmd_update_inputs;
rokid->base.update_inputs = u_device_noop_update_inputs;
rokid->base.get_tracked_pose = rokid_hmd_get_tracked_pose;
rokid->base.get_view_poses = rokid_hmd_get_view_poses;
rokid->base.destroy = rokid_hmd_destroy;

View file

@ -1,4 +1,4 @@
// Copyright 2020, Collabora, Ltd.
// Copyright 2020-2023, Collabora, Ltd.
// Copyright 2020, Moses Turner.
// SPDX-License-Identifier: BSL-1.0
/*!
@ -71,10 +71,6 @@ svr_hmd_destroy(struct xrt_device *xdev)
u_device_free(&ns->base);
}
//
static void
svr_hmd_update_inputs(struct xrt_device *xdev)
{}
static void
svr_hmd_get_tracked_pose(struct xrt_device *xdev,
@ -224,7 +220,7 @@ svr_hmd_create(struct svr_two_displays_distortion *distortion)
svr->base.update_inputs = svr_hmd_update_inputs;
svr->base.update_inputs = u_device_noop_update_inputs;
svr->base.get_tracked_pose = svr_hmd_get_tracked_pose;
svr->base.get_view_poses = svr_hmd_get_view_poses;
svr->base.destroy = svr_hmd_destroy;

View file

@ -84,12 +84,6 @@ simulated_hmd_destroy(struct xrt_device *xdev)
u_device_free(&dh->base);
}
static void
simulated_hmd_update_inputs(struct xrt_device *xdev)
{
// Empty, you should put code to update the attached inputs fields.
}
static void
simulated_hmd_get_tracked_pose(struct xrt_device *xdev,
enum xrt_input_name name,
@ -209,7 +203,7 @@ simulated_hmd_create(enum simulated_movement movement, const struct xrt_pose *ce
enum u_device_alloc_flags flags =
(enum u_device_alloc_flags)(U_DEVICE_ALLOC_HMD | U_DEVICE_ALLOC_TRACKING_NONE);
struct simulated_hmd *dh = U_DEVICE_ALLOCATE(struct simulated_hmd, flags, 1, 0);
dh->base.update_inputs = simulated_hmd_update_inputs;
dh->base.update_inputs = u_device_noop_update_inputs;
dh->base.get_tracked_pose = simulated_hmd_get_tracked_pose;
dh->base.get_view_poses = simulated_hmd_get_view_poses;
dh->base.ref_space_usage = simulated_ref_space_usage;

View file

@ -70,12 +70,6 @@ slam_device(struct xrt_device *xdev)
return (struct slam_device *)xdev;
}
static void
twrap_slam_update_inputs(struct xrt_device *xdev)
{
// Empty
}
static void
twrap_slam_get_tracked_pose(struct xrt_device *xdev,
enum xrt_input_name name,
@ -158,7 +152,7 @@ twrap_slam_create_device(struct xrt_frame_context *xfctx,
dx->base.update_inputs = twrap_slam_update_inputs;
dx->base.update_inputs = u_device_noop_update_inputs;
dx->base.get_tracked_pose = twrap_slam_get_tracked_pose;
dx->base.get_view_poses = twrap_slam_get_view_poses;
dx->base.destroy = twrap_slam_destroy;

View file

@ -1,4 +1,4 @@
// Copyright 2020-2021, Collabora, Ltd.
// Copyright 2020-2023, Collabora, Ltd.
// Copyright 2020-2021, Moses Turner
// SPDX-License-Identifier: BSL-1.0
/*!
@ -322,13 +322,6 @@ cleanup_leap_loop:
pthread_exit(NULL);
}
static void
ulv2_device_update_inputs(struct xrt_device *xdev)
{
// Empty
}
static void
ulv2_device_get_hand_tracking(struct xrt_device *xdev,
enum xrt_input_name name,
@ -398,7 +391,7 @@ ulv2_create_device(struct xrt_device **out_xdev)
ulv2d->log_level = debug_get_log_option_ulv2_log();
ulv2d->base.update_inputs = ulv2_device_update_inputs;
ulv2d->base.update_inputs = u_device_noop_update_inputs;
ulv2d->base.get_hand_tracking = ulv2_device_get_hand_tracking;
ulv2d->base.destroy = ulv2_device_destroy;

View file

@ -1,5 +1,5 @@
// Copyright 2016 Philipp Zabel
// Copyright 2020-2021, Collabora, Ltd.
// Copyright 2020-2023, Collabora, Ltd.
// SPDX-License-Identifier: BSL-1.0
/*!
* @file
@ -360,13 +360,6 @@ vive_controller_device_index_update_inputs(struct xrt_device *xdev)
os_mutex_unlock(&d->lock);
}
static void
_update_tracker_inputs(struct xrt_device *xdev)
{
// Nothing to do here as the device does not send button reports.
}
static void
vive_controller_get_hand_tracking(struct xrt_device *xdev,
enum xrt_input_name name,
@ -1190,22 +1183,22 @@ vive_controller_create(struct os_hid_device *controller_hid, enum watchman_gen w
}
} else if (d->config.variant == CONTROLLER_TRACKER_GEN1) {
d->base.name = XRT_DEVICE_VIVE_TRACKER_GEN1;
d->base.update_inputs = _update_tracker_inputs;
d->base.update_inputs = u_device_noop_update_inputs;
d->base.device_type = XRT_DEVICE_TYPE_GENERIC_TRACKER;
snprintf(d->base.str, XRT_DEVICE_NAME_LEN, "Vive Tracker Gen1 (vive)");
} else if (d->config.variant == CONTROLLER_TRACKER_GEN2) {
d->base.name = XRT_DEVICE_VIVE_TRACKER_GEN2;
d->base.update_inputs = _update_tracker_inputs;
d->base.update_inputs = u_device_noop_update_inputs;
d->base.device_type = XRT_DEVICE_TYPE_GENERIC_TRACKER;
snprintf(d->base.str, XRT_DEVICE_NAME_LEN, "Vive Tracker Gen2 (vive)");
} else if (d->config.variant == CONTROLLER_TRACKER_GEN3) {
d->base.name = XRT_DEVICE_VIVE_TRACKER_GEN3;
d->base.update_inputs = _update_tracker_inputs;
d->base.update_inputs = u_device_noop_update_inputs;
d->base.device_type = XRT_DEVICE_TYPE_GENERIC_TRACKER;
snprintf(d->base.str, XRT_DEVICE_NAME_LEN, "Vive Tracker Gen3 (vive)");
} else if (d->config.variant == CONTROLLER_TRACKER_TUNDRA) {
d->base.name = XRT_DEVICE_VIVE_TRACKER_TUNDRA;
d->base.update_inputs = _update_tracker_inputs;
d->base.update_inputs = u_device_noop_update_inputs;
d->base.device_type = XRT_DEVICE_TYPE_GENERIC_TRACKER;
snprintf(d->base.str, XRT_DEVICE_NAME_LEN, "Tundra Tracker Gen3 (vive)");
} else {

View file

@ -1067,15 +1067,6 @@ wmr_read_config(struct wmr_hmd *wh)
*
*/
static void
wmr_hmd_update_inputs(struct xrt_device *xdev)
{
DRV_TRACE_MARKER();
struct wmr_hmd *wh = wmr_hmd(xdev);
(void)wh;
}
static void
wmr_hmd_get_3dof_tracked_pose(struct xrt_device *xdev,
enum xrt_input_name name,
@ -1896,7 +1887,7 @@ wmr_hmd_create(enum wmr_headset_type hmd_type,
}
// Populate the base members.
wh->base.update_inputs = wmr_hmd_update_inputs;
wh->base.update_inputs = u_device_noop_update_inputs;
wh->base.get_tracked_pose = wmr_hmd_get_tracked_pose;
wh->base.get_view_poses = wmr_hmd_get_view_poses;
wh->base.destroy = wmr_hmd_destroy;

View file

@ -1,4 +1,4 @@
// Copyright 2020-2022, Collabora, Ltd.
// Copyright 2020-2023, Collabora, Ltd.
// SPDX-License-Identifier: BSL-1.0
/*!
* @file
@ -14,12 +14,6 @@
#include "util/u_distortion_mesh.h"
static void
sdl_hmd_update_inputs(struct xrt_device *xdev)
{
// Empty, you should put code to update the attached inputs fields.
}
static void
sdl_hmd_get_tracked_pose(struct xrt_device *xdev,
enum xrt_input_name name,
@ -113,7 +107,7 @@ sdl_device_init(struct sdl_program *sp)
xdev->inputs[0].active = true;
// Function pointers.
xdev->update_inputs = sdl_hmd_update_inputs;
xdev->update_inputs = u_device_noop_update_inputs;
xdev->get_tracked_pose = sdl_hmd_get_tracked_pose;
xdev->get_view_poses = sdl_hmd_get_view_poses;
xdev->destroy = sdl_hmd_destroy;