From 7e14d7eb768117b7d48f345a31bfd51b85ff7c1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Linus=20L=C3=BCssing?= Date: Sat, 3 Jun 2023 04:30:16 +0200 Subject: [PATCH] d/wmr: fix controller activation in SteamVR MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit SteamVR requires the serial number to be set. Otherwise after creating the controller it will fail to activate it. Before: ... monado: Creating Controller WMR Left Controller monado: Using Monado Controller profile monado: Render model based on Monado: locator_one_sided monado: get controller serial number: Driver 'monado' attempted to add tracked device with no serial number monado: Added left Controller: WMR Left Controller monado: Creating Controller WMR Right Controller monado: Using Monado Controller profile monado: Render model based on Monado: locator_one_sided monado: get controller serial number: Driver 'monado' attempted to add tracked device with no serial number monado: Added right Controller: WMR Right Controller ... After: monado: Creating Controller WMR Left Controller monado: Using Monado Controller profile monado: Render model based on Monado: locator_one_sided monado: get controller serial number: Left Controller Driver 'monado' started activation of tracked device with serial number 'Left Controller' monado: Added left Controller: WMR Left Controller monado: Creating Controller WMR Right Controller monado: Using Monado Controller profile monado: Render model based on Monado: locator_one_sided monado: get controller serial number: Right Controller Driver 'monado' started activation of tracked device with serial number 'Right Controller' monado: Added right Controller: WMR Right Controller With this change the HP Reverb G2 controller is recognized and activated fine in SteamVR for me. "Active Controller" nows says: "monado_hp_mixed_reality_controller". The SteamVR controller test page now works and recognizes button presses. The controllers can also (kind of) be used in the home environment. Several issues still exist to be fully useable: * middle finger button not recognized in the SteamVR test page (all other buttons seem to work) * high gyro drift * no positional tracking The serial is set to "Left Controller" and "Right Controller" for now, just like for the Rift S controller. This should probably be updated to a proper serial number once read_controller_config() can parse it from the firmware. Signed-off-by: Linus Lüssing --- src/xrt/drivers/wmr/wmr_controller_base.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/xrt/drivers/wmr/wmr_controller_base.c b/src/xrt/drivers/wmr/wmr_controller_base.c index 5c2079d73..8d0087204 100644 --- a/src/xrt/drivers/wmr/wmr_controller_base.c +++ b/src/xrt/drivers/wmr/wmr_controller_base.c @@ -535,8 +535,12 @@ wmr_controller_base_init(struct wmr_controller_base *wcb, if (controller_type == XRT_DEVICE_TYPE_LEFT_HAND_CONTROLLER) { snprintf(wcb->base.str, ARRAY_SIZE(wcb->base.str), "WMR Left Controller"); + /* TODO: use proper serial from read_controller_config()? */ + snprintf(wcb->base.serial, XRT_DEVICE_NAME_LEN, "Left Controller"); } else { snprintf(wcb->base.str, ARRAY_SIZE(wcb->base.str), "WMR Right Controller"); + /* TODO: use proper serial from read_controller_config()? */ + snprintf(wcb->base.serial, XRT_DEVICE_NAME_LEN, "Right Controller"); } wcb->base.get_tracked_pose = wmr_controller_base_get_tracked_pose;