Skip to content

Commit

Permalink
Fix a couple build issues, add a package script, add a README
Browse files Browse the repository at this point in the history
  • Loading branch information
wheaney committed Jun 8, 2023
1 parent 71b6dab commit 3ca328e
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 3 deletions.
2 changes: 0 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,6 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY $<1:${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME
add_library(${DRIVER_NAME} SHARED
src/driver_air_glasses.h
src/driver_air_glasses.cpp
src/driverlog.cpp
src/driverlog.h
)

target_link_libraries(${DRIVER_NAME} PRIVATE ${OPENVR_LIBRARIES})
Expand Down
35 changes: 35 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# About
I wanted to see if I could experience any VR games using a standard controller and the xReal Air glasses with head
tracking. I came across an [OpenVR HMD library](https://github.com/r57zone/OpenVR-ArduinoHMD) that build out the basic
HMD integration that would work with SteamVR and a
[Linux USB driver](https://gitlab.com/TheJackiMonster/nrealAirLinuxDriver) that provided the necessary outputs to plug
into the former. I'm not a C++ developer, so it took many days of tinkering and fighting with CMake to get this to work
(I'm sure my CMake setup could be greatly cleaned up and simplified, so I welcome some PRs here) and many more days of
tinkering to link to two libraries together and get the compiled driver working in SteamVR.

So far I've only gotten this to work as a HMD in SteamVR Home. I don't have any SteamVR compatible controllers, so I
haven't been able to move around, only use the head tracking to look around. My only testing has been on a Steam Deck
which fails to launch any other applications that are supposedly SteamVR capable. I have Subnautica and two other
SteamVR compatible games, but they all launch in non-VR mode despite changing their Launch Options in the game
properties prior to launching, this might be due to missing a VR compatible controller.

# Build
Building requires cmake 3.21 or later.

To build, just run `bin/package.sh`.

# Installing
You'll need to install [SteamVR](https://store.steampowered.com/app/250820/SteamVR/) before you can install this driver.

From there:
1. Run the build instructions above or download the latest build
2. Extract the resulting tar gzip file to your SteamVR drivers directory. This should be something like
`~/.steam/steam/steamapps/common/SteamVR/drivers/`. Be sure this extracts as the directory `air_glasses`, which should
contain the file `driver_air_glasses.so`.
3. Copy the `nreal_air.rules` file from the `udev` directory to `/etc/udev/rules.d/`
4. Restart Steam (not usually necessary)

# Using xReal Air glasses as a HMD VR device
If you're on the Steam Deck, switch to desktop mode. Launch SteamVR. Run the room configuration and set it up for
sitting mode, with a non-zero height (e.g. 60 inches or a reasonable height). You can hold the brightness up button on
your glasses for a few seconds to enable side-by-side 3d.
40 changes: 40 additions & 0 deletions bin/package.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/usr/bin/env bash

# exit when any command fails
set -e

# check out submodules, recusively for nested ones
git submodule update --init --recursive

# build the xrealAir library
XREAL_LIB_BUILD_PATH=modules/xrealAirLinuxDriver/build
if [ ! -d "$XREAL_LIB_BUILD_PATH" ]; then
mkdir $XREAL_LIB_BUILD_PATH
fi

pushd $XREAL_LIB_BUILD_PATH
cmake ..
make

cd "$(dirs -l -0)" && dirs -c

# build the OpenVR driver
OPENVR_BUILD_PATH=build
if [ ! -d "$OPENVR_BUILD_PATH" ]; then
mkdir $OPENVR_BUILD_PATH
fi

pushd $OPENVR_BUILD_PATH
cmake ..
make

# move and rename the compiled driver to the driver directory
mv libdriver_air_glasses.so air_glasses/driver_air_glasses.so

# copy the udev rule that's needed for the USB integration
cp -r ../modules/xrealAirLinuxDriver/udev air_glasses/

# bundle up the driver directory
tar -zcvf driver_air_glasses.tar.gz air_glasses

popd
2 changes: 1 addition & 1 deletion src/driver_air_glasses.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <thread>
#include <chrono>
#include <algorithm>
#include "../modules/nrealAirLinuxDriver/interface_lib/include/device3.h"
#include "../modules/xrealAirLinuxDriver/interface_lib/include/device3.h"
#include <math.h>
#include <string.h>

Expand Down

0 comments on commit 3ca328e

Please sign in to comment.