d/wmr: fix controller activation in SteamVR

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 <linus.luessing@c0d3.blue>
This commit is contained in:
Linus Lüssing 2023-06-03 04:30:16 +02:00 committed by Ryan Pavlik
parent 948d78fb61
commit 7e14d7eb76

View file

@ -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;