diff --git a/src/xrt/ipc/client/ipc_client_hmd.c b/src/xrt/ipc/client/ipc_client_hmd.c index 07b484eae..df0d3bb92 100644 --- a/src/xrt/ipc/client/ipc_client_hmd.c +++ b/src/xrt/ipc/client/ipc_client_hmd.c @@ -139,6 +139,17 @@ ipc_client_hmd_get_view_poses(struct xrt_device *xdev, } } +static bool +ipc_client_hmd_is_form_factor_available(struct xrt_device *xdev, enum xrt_form_factor form_factor) +{ + struct ipc_client_hmd *ich = ipc_client_hmd(xdev); + bool available = false; + xrt_result_t r = ipc_call_device_is_form_factor_available(ich->ipc_c, ich->device_id, form_factor, &available); + if (r != XRT_SUCCESS) { + IPC_ERROR(ich->ipc_c, "Error calling is available!"); + } + return available; +} /*! * @public @memberof ipc_client_hmd @@ -159,6 +170,7 @@ ipc_client_hmd_create(struct ipc_connection *ipc_c, struct xrt_tracking_origin * ich->base.get_tracked_pose = ipc_client_hmd_get_tracked_pose; ich->base.get_view_poses = ipc_client_hmd_get_view_poses; ich->base.destroy = ipc_client_hmd_destroy; + ich->base.is_form_factor_available = ipc_client_hmd_is_form_factor_available; // Start copying the information from the isdev. ich->base.tracking_origin = xtrack; @@ -213,6 +225,7 @@ ipc_client_hmd_create(struct ipc_connection *ipc_c, struct xrt_tracking_origin * ich->base.device_type = isdev->device_type; ich->base.hand_tracking_supported = isdev->hand_tracking_supported; ich->base.force_feedback_supported = isdev->force_feedback_supported; + ich->base.form_factor_check_supported = isdev->form_factor_check_supported; return &ich->base; } diff --git a/src/xrt/ipc/server/ipc_server_handler.c b/src/xrt/ipc/server/ipc_server_handler.c index 28b117b01..b869465cd 100644 --- a/src/xrt/ipc/server/ipc_server_handler.c +++ b/src/xrt/ipc/server/ipc_server_handler.c @@ -1155,3 +1155,16 @@ ipc_handle_device_set_output(volatile struct ipc_client_state *ics, return XRT_SUCCESS; } + +xrt_result_t +ipc_handle_device_is_form_factor_available(volatile struct ipc_client_state *ics, + uint32_t id, + enum xrt_form_factor form_factor, + bool *out_available) +{ + // To make the code a bit more readable. + uint32_t device_id = id; + struct xrt_device *xdev = get_xdev(ics, device_id); + *out_available = xrt_device_is_form_factor_available(xdev, form_factor); + return XRT_SUCCESS; +} diff --git a/src/xrt/ipc/server/ipc_server_process.c b/src/xrt/ipc/server/ipc_server_process.c index ce031ce91..482dc65ee 100644 --- a/src/xrt/ipc/server/ipc_server_process.c +++ b/src/xrt/ipc/server/ipc_server_process.c @@ -288,6 +288,7 @@ init_shm(struct ipc_server *s) isdev->device_type = xdev->device_type; 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; // Is this a HMD? if (xdev->hmd != NULL) { diff --git a/src/xrt/ipc/shared/ipc_protocol.h b/src/xrt/ipc/shared/ipc_protocol.h index e3a8bad97..8f7079c35 100644 --- a/src/xrt/ipc/shared/ipc_protocol.h +++ b/src/xrt/ipc/shared/ipc_protocol.h @@ -125,6 +125,7 @@ struct ipc_shared_device bool position_tracking_supported; bool hand_tracking_supported; bool force_feedback_supported; + bool form_factor_check_supported; }; /*! diff --git a/src/xrt/ipc/shared/proto.json b/src/xrt/ipc/shared/proto.json index c312f2b4e..a6dbf5de9 100644 --- a/src/xrt/ipc/shared/proto.json +++ b/src/xrt/ipc/shared/proto.json @@ -252,5 +252,15 @@ {"name": "name", "type": "enum xrt_output_name"}, {"name": "value", "type": "union xrt_output_value"} ] + }, + + "device_is_form_factor_available": { + "in": [ + {"name": "id", "type": "uint32_t"}, + {"name": "form_factor", "type": "enum xrt_form_factor"} + ], + "out": [ + {"name": "available", "type": "bool"} + ] } }