From b710127fadbb4a6f2a9c09858024ea67c36f7a65 Mon Sep 17 00:00:00 2001
From: Daniel Willmott <web@dan-w.com>
Date: Fri, 9 Sep 2022 13:48:22 +0100
Subject: [PATCH] xrt/device: Add force feedback role

---
 src/xrt/include/xrt/xrt_device.h        | 1 +
 src/xrt/ipc/client/ipc_client_device.c  | 1 +
 src/xrt/ipc/client/ipc_client_hmd.c     | 1 +
 src/xrt/ipc/server/ipc_server_process.c | 1 +
 src/xrt/ipc/shared/ipc_protocol.h       | 1 +
 5 files changed, 5 insertions(+)

diff --git a/src/xrt/include/xrt/xrt_device.h b/src/xrt/include/xrt/xrt_device.h
index 598bd63dc..399998243 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 force_feedback_supported;
 
 	/*!
 	 * Update any attached inputs.
diff --git a/src/xrt/ipc/client/ipc_client_device.c b/src/xrt/ipc/client/ipc_client_device.c
index 179b17912..c70f70c4c 100644
--- a/src/xrt/ipc/client/ipc_client_device.c
+++ b/src/xrt/ipc/client/ipc_client_device.c
@@ -214,6 +214,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.force_feedback_supported = isdev->force_feedback_supported;
 
 	icd->base.device_type = isdev->device_type;
 	return &icd->base;
diff --git a/src/xrt/ipc/client/ipc_client_hmd.c b/src/xrt/ipc/client/ipc_client_hmd.c
index b2fef750e..52d82e28b 100644
--- a/src/xrt/ipc/client/ipc_client_hmd.c
+++ b/src/xrt/ipc/client/ipc_client_hmd.c
@@ -212,6 +212,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.force_feedback_supported = isdev->force_feedback_supported;
 
 	return &ich->base;
 }
diff --git a/src/xrt/ipc/server/ipc_server_process.c b/src/xrt/ipc/server/ipc_server_process.c
index 283dc8f4b..f982168c0 100644
--- a/src/xrt/ipc/server/ipc_server_process.c
+++ b/src/xrt/ipc/server/ipc_server_process.c
@@ -290,6 +290,7 @@ init_shm(struct ipc_server *s)
 		isdev->position_tracking_supported = xdev->position_tracking_supported;
 		isdev->device_type = xdev->device_type;
 		isdev->hand_tracking_supported = xdev->hand_tracking_supported;
+		isdev->force_feedback_supported = xdev->force_feedback_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 38dad7e1d..7bad07012 100644
--- a/src/xrt/ipc/shared/ipc_protocol.h
+++ b/src/xrt/ipc/shared/ipc_protocol.h
@@ -119,6 +119,7 @@ struct ipc_shared_device
 	bool orientation_tracking_supported;
 	bool position_tracking_supported;
 	bool hand_tracking_supported;
+	bool force_feedback_supported;
 };
 
 /*!