lvra.gitlab.io/content/docs/fossvr/wivrn/_index.md
2025-05-06 08:03:18 +00:00

178 lines
7.2 KiB
Markdown

---
weight: 50
title: WiVRn
---
# WiVRn
- [WiVRn GitHub repository](https://github.com/WiVRn/WiVRn)
![The WiVRn mascot](https://github.com/WiVRn/WiVRn/blob/master/images/wivrn.svg?raw=true)
> WiVRn wirelessly connects a standalone VR headset to a Linux computer. You can then play PCVR games on the headset while processing is done on the computer.
WiVRn is based on [Monado](/docs/fossvr/monado/) and can be used with [OpenComposite](/docs/fossvr/opencomposite/) to support a majority of titles available for SteamVR. A wide range of standalone headsets are supported.
## Installing WiVRn
We recommend using distribution packages when available or the [WiVRn Flatpak](https://flathub.org/apps/io.github.wivrn.wivrn).
### Arch Linux
Packages are available on [AUR](https://wiki.archlinux.org/title/Arch_User_Repository), you will need the following packages:
* `wivrn-server` and `wivrn-dashboard` for base feature + GUI (latest release), or `wivrn-full-git` for development version
* `opencomposite-git` or `xrizer-git` for compatibility with OpenVR and proton
### Gentoo Linux
Packages are available on [Guru](https://wiki.gentoo.org/wiki/Project:GURU), you will need `media-libs/wivrn` and `media-libs/opencomposite`
### Flatpak (all distributions)
The [WiVRn Flatpak](https://flathub.org/apps/io.github.wivrn.wivrn) has the latest released version. For development releases, you can download the `wivrn-flatpak-x86_64` artifact from Github [Build](https://github.com/WiVRn/WiVRn/actions/workflows/Build.yml?query=branch%3Amaster) action
### Envision (guided build)
You can use [Envision](/docs/fossvr/envision/) to install and launch WiVRn & OpenComposite.
## General WiVRn Notes
WiVRn uses Avahi for network discovery. Ensure it is running with the following terminal command:
```bash
systemctl enable --now avahi-daemon
```
If Avahi is not available, `--no-publish-service` bypasses it, and the IP address of the server must be entered into the client.
If a firewall is installed, make sure ports 5353/UDP and 9757/UDP+TCP are open for Avahi and WiVRn itself, respectively.
If using Nvidia proprietary drivers older than 565, install the [Monado Vulkan Layers](https://gitlab.freedesktop.org/monado/utilities/vulkan-layers), otherwise games will crash with a segmentation fault.
For audio in WiVRn, you will need to assign applications, or the system as a whole, to output audio to the virtual output "WiVRn" which is created upon connection between the server and the headset.
It is possible to use WiVRn Flatpak with Steam Flatpak, though Steam Flatpak isn't generally recommended for VR. If you are using Steam Flatpak, you just need to grant it access to the relevant paths:
```bash
flatpak override --user --filesystem=xdg-config/openxr:ro com.valvesoftware.Steam
flatpak override --user --filesystem=xdg-config/openvr:ro com.valvesoftware.Steam
flatpak override --user --filesystem=xdg-run/wivrn com.valvesoftware.Steam
flatpak override --user --filesystem=/var/lib/flatpak/app/io.github.wivrn.wivrn:ro com.valvesoftware.Steam
```
As an added bonus to the above, this command will save you the effort of having to set launch options for every single VR game in your Steam library:
```bash
flatpak override --user --env=PRESSURE_VESSEL_FILESYSTEMS_RW=/run/user/1000/wivrn/comp_ipc:/var/lib/flatpak/app/io.github.wivrn.wivrn com.valvesoftware.Steam
```
## Wired WiVRn
You can use WiVRn with a cable instead of Wi-Fi. Use a 5Gbps cable & port at the very least.
Using Envision:
- Connect the headset via USB.
- In Envision, click the `Start WiVRn Client (Wired)` button.
- If it's not there, you may need to update Envision.
Manual steps:
- Connect the headset via USB.
- If WiVRn is running on the headset, close it now.
- While in the system lobby of the headset, run the following `adb` commands on the PC:
```bash
adb reverse tcp:9757 tcp:9757
adb shell am start -a android.intent.action.VIEW -d "wivrn+tcp://127.0.0.1" org.meumeu.wivrn
```
## WiVRn + SlimeVR trackers
To use SlimeVR trackers through WiVRn, you currently must use a [fork](https://github.com/notpeelz/WiVRn) of WiVRn:
### Usage with Envision
To use this fork within Envision, edit these fields in your profile:
- XR Service Repo: `https://github.com/notpeelz/WiVRn.git`
- XR Service Branch: `solarxr-patches`
- XR Service CMake Flags: Add `WIVRN_FEATURE_SOLARXR=ON`
Then save and clean build the profile.
### NixOS setup
Override the `wivrn` package from nixpkgs with something resembling the following, replacing `[COMMIT HASH HERE]` with the latest commit hash from https://github.com/notpeelz/WiVRn/commits/solarxr-patches and filling in the correct src hash. Do note you may need to adapt this depending on how you install WiVRn:
```nix
{ pkgs, lib, ... }:
{
services.wivrn = {
enable = true;
defaultRuntime = true;
package = pkgs.wivrn.overrideAttrs (old: rec {
version = "[COMMIT HASH HERE]";
src = lib.fetchFromGitHub {
owner = "notpeelz";
repo = "WiVRn";
rev = version;
# This will throw an error when evaluating and give you the correct hash - put that here
hash = "";
};
cmakeFlags = old.cmakeFlags ++ [
(lib.cmakeBool "WIVRN_FEATURE_SOLARXR" true)
];
});
};
}
```
## WiVRn + Lighthouse driver
This section covers using WiVRn 0.19 and newer with any Lighthouse-tracked device (such as Index/Vive controllers, Vive/Tundra trackers, etc.)
You must have SteamVR installed (no need to run it).
### Envision
Set WiVRn Profile as such:
- XR Service CMake Flags:
- `WIVRN_FEATURE_STEAMVR_LIGHTHOUSE=ON`
- Environment Variables:
- `WIVRN_USE_STEAMVR_LH=1`
- `LH_DISCOVER_WAIT_MS=6000`
Perform a **Clean Build** after changing the CMake flags!
### NixOS
Override the `wivrn` package and launch wivrn-server with the required environment variables:
```nix
{
services.wivrn = {
enable = true;
defaultRuntime = true;
package = pkgs.wivrn.overrideAttrs (old: {
cmakeFlags = old.cmakeFlags ++ [
(lib.cmakeBool "WIVRN_FEATURE_STEAMVR_LIGHTHOUSE" true)
];
});
monadoEnvironment = {
WIVRN_USE_STEAMVR_LH = "1";
LH_DISCOVER_WAIT_MS = "6000";
};
};
}
```
### Manual
Simply pass `-DWIVRN_FEATURE_STEAMVR_LIGHTHOUSE=ON` to CMake and export the above environment variables before starting `wivrn-server`.
### Usage tips
Discovery happens only on first connection, so be sure to **have all Lighthouse devices powered on and in line-of-sight of your base stations before connecting the headset!** Once a device is discovered, you may power it off and on at-will.
You can use [Motoc](/docs/fossvr/motoc/) to calibrate the two tracking technologies to work together.
Once video appears in the headset, check `motoc monitor` to make sure your devices all show up.
If one or more devices are missing, try:
- Spread the devices out more; Lighthouse devices get discovered quicker if they're not piled up on each other. Simply strapping them on is good, too.
- Increase `LH_DISCOVER_WAIT_MS`, though this delays the client on first connection.
To re-discover devices, restart WiVRn server.
At this point, your Lighthouse devices will be randomly floating about somewhere. To calibrate them, follow the guide in the [Motoc README](https://github.com/galister/motoc/blob/main/README.md).