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:
@@ -19,10 +19,8 @@
|
||||
|
||||
#include "stream.h"
|
||||
|
||||
#ifdef __ANDROID__
|
||||
#include "application.h"
|
||||
#endif
|
||||
|
||||
#include "utils/i18n.h"
|
||||
#include "utils/named_thread.h"
|
||||
|
||||
#include <spdlog/spdlog.h>
|
||||
@@ -87,6 +85,12 @@ void scenes::stream::operator()(to_headset::feature_control && control)
|
||||
{
|
||||
case wivrn::to_headset::feature_control::hid_input:
|
||||
hid_forwarding = control.state;
|
||||
if (not control.state and (application::get_config().forward_keyboard or application::get_config().forward_mouse or application::get_config().forward_gamepad))
|
||||
{
|
||||
auto toast = gui_toast.lock();
|
||||
toast->emplace(_("The server does not allow forwarded input devices"), true);
|
||||
gui_status_last_change = instance.now();
|
||||
}
|
||||
return;
|
||||
case wivrn::to_headset::feature_control::microphone:
|
||||
if (audio_handle)
|
||||
@@ -94,6 +98,7 @@ void scenes::stream::operator()(to_headset::feature_control && control)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void scenes::stream::operator()(to_headset::audio_stream_description && desc)
|
||||
{
|
||||
audio_handle.emplace(desc, *network_session, instance);
|
||||
|
||||
Reference in New Issue
Block a user