The open source OpenXR runtime
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

d/steamvr_lh: Fix haptic pulse being set to 1 Hz when XR_FREQUENCY_UNSPECIFIED is used

The steamvr_lh driver haptic pulse was being set to 1 Hz when the haptic frequency sent from a OpenXR client was set to XR_FREQUENCY_UNSPECIFIED (0.0f), which is far too weak for games such as Beat Saber that rely completely on haptic feedback as core mechanism, now the code is adjusted to set the frequency to 200 Hz when it's 0 which is comparable to what SteamVR sets on its OpenXR runtime.

Part-of: <https://gitlab.freedesktop.org/monado/monado/-/merge_requests/2449>

authored by

Nyabsi and committed by
Marge Bot
146ee8c2 2e8edcda

+7 -2
+7 -2
src/xrt/drivers/steamvr_lh/device.cpp
··· 471 471 event.componentHandle = haptic_handle; 472 472 event.fDurationSeconds = (float)vib.duration_ns / 1e9f; 473 473 // 0.0f in OpenXR means let the driver determine a frequency, but 474 - // in OpenVR means no haptic. 475 - event.fFrequency = std::max(vib.frequency, 1.0f); 474 + // in OpenVR means no haptic, so let's set a reasonable default. 475 + float frequency = vib.frequency; 476 + if (frequency == 0.0) { 477 + frequency = 200.0f; 478 + } 479 + 480 + event.fFrequency = frequency; 476 481 event.fAmplitude = vib.amplitude; 477 482 478 483 ctx->add_haptic_event(event);