From 96c88f488e73b08601177424ee0a884469579041 Mon Sep 17 00:00:00 2001 From: "Drew Chien (Te-Ju)" Date: Mon, 22 May 2023 17:53:11 +0800 Subject: [PATCH] xrt: Add eye gaze defines and role --- src/xrt/auxiliary/util/u_pretty_print.c | 1 + src/xrt/include/xrt/xrt_defines.h | 4 ++++ src/xrt/include/xrt/xrt_device.h | 1 + src/xrt/include/xrt/xrt_system.h | 1 + src/xrt/ipc/client/ipc_client_device.c | 1 + src/xrt/ipc/client/ipc_client_hmd.c | 1 + src/xrt/ipc/client/ipc_client_instance.c | 1 + src/xrt/ipc/server/ipc_server_process.c | 2 ++ src/xrt/ipc/shared/ipc_protocol.h | 2 ++ src/xrt/state_trackers/oxr/oxr_instance.c | 4 +++- src/xrt/state_trackers/prober/p_prober.c | 1 + 11 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/xrt/auxiliary/util/u_pretty_print.c b/src/xrt/auxiliary/util/u_pretty_print.c index 09f41a676..85c4727e0 100644 --- a/src/xrt/auxiliary/util/u_pretty_print.c +++ b/src/xrt/auxiliary/util/u_pretty_print.c @@ -114,6 +114,7 @@ u_pp_xrt_input_name(struct u_pp_delegate dg, enum xrt_input_name name) case XRT_INPUT_GENERIC_HAND_TRACKING_LEFT: DG("XRT_INPUT_GENERIC_HAND_TRACKING_LEFT"); return; case XRT_INPUT_GENERIC_HAND_TRACKING_RIGHT: DG("XRT_INPUT_GENERIC_HAND_TRACKING_RIGHT"); return; case XRT_INPUT_GENERIC_TRACKER_POSE: DG("XRT_INPUT_GENERIC_TRACKER_POSE"); return; + case XRT_INPUT_GENERIC_EYE_GAZE_POSE: DG("XRT_INPUT_GENERIC_EYE_GAZE_POSE"); return; case XRT_INPUT_SIMPLE_SELECT_CLICK: DG("XRT_INPUT_SIMPLE_SELECT_CLICK"); return; case XRT_INPUT_SIMPLE_MENU_CLICK: DG("XRT_INPUT_SIMPLE_MENU_CLICK"); return; case XRT_INPUT_SIMPLE_GRIP_POSE: DG("XRT_INPUT_SIMPLE_GRIP_POSE"); return; diff --git a/src/xrt/include/xrt/xrt_defines.h b/src/xrt/include/xrt/xrt_defines.h index 37f5256cb..14c406ca6 100644 --- a/src/xrt/include/xrt/xrt_defines.h +++ b/src/xrt/include/xrt/xrt_defines.h @@ -628,6 +628,8 @@ enum xrt_device_name XRT_DEVICE_HAND_INTERACTION, + XRT_DEVICE_EYE_GAZE_INTERACTION, + XRT_DEVICE_PSMV, XRT_DEVICE_PSSENSE, XRT_DEVICE_HYDRA, @@ -652,6 +654,7 @@ enum xrt_device_type XRT_DEVICE_TYPE_ANY_HAND_CONTROLLER, XRT_DEVICE_TYPE_GENERIC_TRACKER, XRT_DEVICE_TYPE_HAND_TRACKER, + XRT_DEVICE_TYPE_EYE_TRACKER }; /*! @@ -748,6 +751,7 @@ enum xrt_input_name XRT_INPUT_GENERIC_TRACKER_POSE = XRT_INPUT_NAME(0x0005, POSE), XRT_INPUT_GENERIC_STAGE_SPACE_POSE = XRT_INPUT_NAME(0x0006, POSE), XRT_INPUT_GENERIC_LOCAL_SPACE_POSE = XRT_INPUT_NAME(0x0007, POSE), + XRT_INPUT_GENERIC_EYE_GAZE_POSE = XRT_INPUT_NAME(0x0008, POSE), XRT_INPUT_SIMPLE_SELECT_CLICK = XRT_INPUT_NAME(0x0010, BOOLEAN), XRT_INPUT_SIMPLE_MENU_CLICK = XRT_INPUT_NAME(0x0011, BOOLEAN), diff --git a/src/xrt/include/xrt/xrt_device.h b/src/xrt/include/xrt/xrt_device.h index 75a1915d8..f902be00e 100644 --- a/src/xrt/include/xrt/xrt_device.h +++ b/src/xrt/include/xrt/xrt_device.h @@ -259,6 +259,7 @@ struct xrt_device bool orientation_tracking_supported; bool position_tracking_supported; bool hand_tracking_supported; + bool eye_gaze_supported; bool force_feedback_supported; bool form_factor_check_supported; diff --git a/src/xrt/include/xrt/xrt_system.h b/src/xrt/include/xrt/xrt_system.h index 6f540cfa4..514a763b0 100644 --- a/src/xrt/include/xrt/xrt_system.h +++ b/src/xrt/include/xrt/xrt_system.h @@ -31,6 +31,7 @@ struct xrt_system_devices struct xrt_device *left; struct xrt_device *right; struct xrt_device *gamepad; + struct xrt_device *eyes; struct { diff --git a/src/xrt/ipc/client/ipc_client_device.c b/src/xrt/ipc/client/ipc_client_device.c index 4351e9278..0fa33f3ee 100644 --- a/src/xrt/ipc/client/ipc_client_device.c +++ b/src/xrt/ipc/client/ipc_client_device.c @@ -209,6 +209,7 @@ ipc_client_device_create(struct ipc_connection *ipc_c, struct xrt_tracking_origi icd->base.orientation_tracking_supported = isdev->orientation_tracking_supported; icd->base.position_tracking_supported = isdev->position_tracking_supported; icd->base.hand_tracking_supported = isdev->hand_tracking_supported; + icd->base.eye_gaze_supported = isdev->eye_gaze_supported; icd->base.force_feedback_supported = isdev->force_feedback_supported; icd->base.device_type = isdev->device_type; diff --git a/src/xrt/ipc/client/ipc_client_hmd.c b/src/xrt/ipc/client/ipc_client_hmd.c index bfaba4256..c5416e622 100644 --- a/src/xrt/ipc/client/ipc_client_hmd.c +++ b/src/xrt/ipc/client/ipc_client_hmd.c @@ -244,6 +244,7 @@ ipc_client_hmd_create(struct ipc_connection *ipc_c, struct xrt_tracking_origin * ich->base.position_tracking_supported = isdev->position_tracking_supported; ich->base.device_type = isdev->device_type; ich->base.hand_tracking_supported = isdev->hand_tracking_supported; + ich->base.eye_gaze_supported = isdev->eye_gaze_supported; ich->base.force_feedback_supported = isdev->force_feedback_supported; ich->base.form_factor_check_supported = isdev->form_factor_check_supported; diff --git a/src/xrt/ipc/client/ipc_client_instance.c b/src/xrt/ipc/client/ipc_client_instance.c index cf25a6230..b8046410b 100644 --- a/src/xrt/ipc/client/ipc_client_instance.c +++ b/src/xrt/ipc/client/ipc_client_instance.c @@ -345,6 +345,7 @@ ipc_client_instance_create_system(struct xrt_instance *xinst, SET_ROLE(left); SET_ROLE(right); SET_ROLE(gamepad); + SET_ROLE(eyes); SET_ROLE(hand_tracking.left); SET_ROLE(hand_tracking.right); diff --git a/src/xrt/ipc/server/ipc_server_process.c b/src/xrt/ipc/server/ipc_server_process.c index b3b3bb5a6..ccf63fa1c 100644 --- a/src/xrt/ipc/server/ipc_server_process.c +++ b/src/xrt/ipc/server/ipc_server_process.c @@ -279,6 +279,7 @@ init_shm(struct ipc_server *s) isdev->hand_tracking_supported = xdev->hand_tracking_supported; isdev->force_feedback_supported = xdev->force_feedback_supported; isdev->form_factor_check_supported = xdev->form_factor_check_supported; + isdev->eye_gaze_supported = xdev->eye_gaze_supported; // Is this a HMD? if (xdev->hmd != NULL) { @@ -359,6 +360,7 @@ init_shm(struct ipc_server *s) ism->roles.gamepad = find_xdev_index(s, s->xsysd->roles.gamepad); ism->roles.hand_tracking.left = find_xdev_index(s, s->xsysd->roles.hand_tracking.left); ism->roles.hand_tracking.right = find_xdev_index(s, s->xsysd->roles.hand_tracking.right); + ism->roles.eyes = find_xdev_index(s, s->xsysd->roles.eyes); // Fill out git version info. snprintf(s->ism->u_git_tag, IPC_VERSION_NAME_LEN, "%s", u_git_tag); diff --git a/src/xrt/ipc/shared/ipc_protocol.h b/src/xrt/ipc/shared/ipc_protocol.h index 4c70d6070..35c0c75f3 100644 --- a/src/xrt/ipc/shared/ipc_protocol.h +++ b/src/xrt/ipc/shared/ipc_protocol.h @@ -124,6 +124,7 @@ struct ipc_shared_device bool orientation_tracking_supported; bool position_tracking_supported; bool hand_tracking_supported; + bool eye_gaze_supported; bool force_feedback_supported; bool form_factor_check_supported; }; @@ -221,6 +222,7 @@ struct ipc_shared_memory int32_t left; int32_t right; int32_t gamepad; + int32_t eyes; struct { diff --git a/src/xrt/state_trackers/oxr/oxr_instance.c b/src/xrt/state_trackers/oxr/oxr_instance.c index 34848e653..b261ee50d 100644 --- a/src/xrt/state_trackers/oxr/oxr_instance.c +++ b/src/xrt/state_trackers/oxr/oxr_instance.c @@ -117,6 +117,7 @@ debug_print_devices(struct oxr_logger *log, struct oxr_system *sys) struct xrt_device *h = GET_XDEV_BY_ROLE(sys, head); struct xrt_device *l = GET_XDEV_BY_ROLE(sys, left); struct xrt_device *r = GET_XDEV_BY_ROLE(sys, right); + struct xrt_device *e = GET_XDEV_BY_ROLE(sys, eyes); struct xrt_device *hl = GET_XDEV_BY_ROLE(sys, hand_tracking.left); struct xrt_device *hr = GET_XDEV_BY_ROLE(sys, hand_tracking.right); @@ -127,9 +128,10 @@ debug_print_devices(struct oxr_logger *log, struct oxr_system *sys) "\n\tHead: '%s'" "\n\tLeft: '%s'" "\n\tRight: '%s'" + "\n\tEyes: '%s'" "\n\tHand-Tracking Left: '%s'" "\n\tHand-Tracking Right: '%s'", - P(h), P(l), P(r), P(hl), P(hr)); + P(h), P(l), P(r), P(e), P(hl), P(hr)); #undef P } diff --git a/src/xrt/state_trackers/prober/p_prober.c b/src/xrt/state_trackers/prober/p_prober.c index ec274331f..90637068f 100644 --- a/src/xrt/state_trackers/prober/p_prober.c +++ b/src/xrt/state_trackers/prober/p_prober.c @@ -848,6 +848,7 @@ print_system_devices(u_pp_delegate_t dg, struct xrt_system_devices *xsysd) P(left); P(right); P(gamepad); + P(eyes); P(hand_tracking.left); P(hand_tracking.right); #undef P