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:
@@ -32,6 +32,7 @@
|
||||
#include "wivrn_packets.h"
|
||||
#include "xr/space.h"
|
||||
#include <mutex>
|
||||
#include <optional>
|
||||
#include <queue>
|
||||
#include <shared_mutex>
|
||||
#include <thread>
|
||||
@@ -188,7 +189,7 @@ private:
|
||||
|
||||
stream(std::string server_name, scene & parent_scene);
|
||||
|
||||
bool forward_hid_input(from_headset::hid::input_t);
|
||||
bool forward_hid_input(from_headset::hid::input_t, bool device_enabled);
|
||||
|
||||
public:
|
||||
~stream();
|
||||
@@ -239,6 +240,13 @@ public:
|
||||
return state_;
|
||||
}
|
||||
|
||||
// Whether the server mirrors forwarded input devices to uinput. The gamepad is also exposed
|
||||
// through OpenXR regardless, so this only affects forwarded keyboard and mouse.
|
||||
bool hid_forwarding_enabled() const
|
||||
{
|
||||
return hid_forwarding;
|
||||
}
|
||||
|
||||
void exit();
|
||||
void start_application(std::string appid);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user