Mirror forwarded input devices to uinput

Mirror the gamepad forwarded from the headset to a uinput device with the standard Xbox layout, so applications that do not read it through OpenXR, such as SDL and Steam Input, pick it up. This extends the existing hid-forwarding uinput path, which already covered keyboard and mouse.

The headset chooses which devices to forward (keyboard, mouse, gamepad), off by default. The hid-forwarding server option gates the uinput mirror only; the OpenXR gamepad is always exposed. The mirror needs the uinput module and write access to /dev/uinput.

Gamepad rumble written to the uinput device is read back and forwarded to the headset as OpenXR haptics.
This commit is contained in:
JR Lanteigne
2026-07-08 19:10:50 +02:00
committed by xytovl
parent aeecc857de
commit 91f6e69ffb
18 changed files with 385 additions and 54 deletions
+26
View File
@@ -784,6 +784,32 @@ void scenes::lobby::gui_settings()
ImGui::Unindent();
ImGui::EndDisabled();
}
{
// Virtual devices: a keyboard, mouse or gamepad connected to the headset is
// replicated on the server through uinput. The gamepad is also exposed through
// OpenXR, whether or not it is mirrored to a virtual device.
ImGui::Text("%s", _S("Virtual devices"));
if (ImGui::IsItemHovered())
imgui_ctx->tooltip(_("Input devices connected to the headset are replicated as virtual devices on the PC.\nThe server must allow forwarded input devices; this is not available when the server runs as Flatpak.\nA gamepad is also usable without a virtual device by applications that read it through OpenXR."));
ImGui::Indent();
if (ImGui::Checkbox(_S("Keyboard"), &config.forward_keyboard))
config.save();
imgui_ctx->vibrate_on_hover();
if (ImGui::Checkbox(_S("Mouse"), &config.forward_mouse))
config.save();
imgui_ctx->vibrate_on_hover();
if (ImGui::Checkbox(_S("Gamepad"), &config.forward_gamepad))
config.save();
imgui_ctx->vibrate_on_hover();
ImGui::Unindent();
if (server_hid_forwarding == false and (config.forward_keyboard or config.forward_mouse or config.forward_gamepad))
{
ImGui::TextColored(constants::style::warn, ICON_FA_TRIANGLE_EXCLAMATION);
ImGui::SameLine();
ImGui::Text("%s", _S("The server does not allow forwarded input devices"));
}
}
if (system.hand_tracking_supported())
{
bool enabled = config.check_feature(feature::hand_tracking);