No description
This repository has been archived on 2025-06-21. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
Find a file
Tobias Frisch 2b38861b70 Merge branch 'improve_udev_rules' into 'main'
Udev rules cover most (all?) of the mounted devices now and README reflects this.

See merge request TheJackiMonster/nrealAirLinuxDriver!6
2024-01-21 05:39:22 +00:00
examples Use proper type for euler angles 2023-11-30 02:14:41 +01:00
interface_lib Calling hid_init only once 2023-12-19 09:30:39 +01:00
src Correct units of biases and improve calibration 2023-11-30 14:41:01 +01:00
udev Udev rules cover most (all?) of the mounted devices now and README reflects this. 2024-01-20 12:28:09 -08:00
.gitignore Switch from libusb to hidapi 2023-04-30 12:59:34 +02:00
.gitmodules Update submodules usage 2023-09-07 23:30:42 +02:00
CMakeLists.txt Remove Fusion library inclusion from the top-level CMakeLists 2023-09-07 13:08:14 -07:00
LICENSE.md Initial commit 2023-03-31 15:15:04 +02:00
README.md Udev rules cover most (all?) of the mounted devices now and README reflects this. 2024-01-20 12:28:09 -08:00

Custom user-space driver for the nreal Air to use it on Linux

Information before use

The code is provided as is and it's free to use. However the contributors can neither guarantee that it will work or that it won't damage your device since all of it is based on reverse-engineering instead of public documentation. The contributors are not responsible for proper or even official support. So use it at your own risk!

Inspiration and motivation

Because I've written a user-space driver before for a graphics tablet, I thought I might look into it. To my surprise video output, audio output (stereo) and audio input (microphone) already worked using drivers from the Linux kernel. So the only piece missing for full use was the IMU sensor data in theory.

A big help for implementing this piece of software was the source code and feedback from a custom driver for Windows here. Without that I would have needed to find out payloads my own. So big thanks to such projects being open-source!

Another huge help was the reverse engineering here to send different payloads to the device and even read calibration data from the local storage. Without that calibrating would be quite a hassle for end-users as well as efforts from developers tweaking the values manually. So big thanks as well!

Features

The driver will read, parse and interpret sensor data from two HID interfaces to feed custom event callbacks with data which can be used in user-space applications (for example whether buttons have been pressed, the current brightness level and the orientation quaternion/matrix/euler angles).

It's still a work-in-progress project since the goal would be to wire such events up into a compositor to render whole screens virtually depending on your 6-DoF orientation (without position).

Also keep in mind that this software will only run on Linux including devices like the Steam Deck, Pinephone or other mobile Linux devices.

Dependencies

You can build the binary using cmake and there are only three dependencies for now:

Fusion is a sensor fusion library which is integrated as git submodule. So when you checkout the repository, just update the submodules to get it. The libraries hidapi and json-c should be pretty common in most Linux distributions repositories.

Build

The build process should be straight forward:

mkdir build
cd build
cmake ..
make

Run

It's easiest to run the software with root privileges.

sudo nrealAirLinuxDriver

Alternatively, you can copy the nreal_air.rules to /etc/udev/rules.d:

sudo cp udev/nreal_air.rules /etc/udev/rules.d/xreal_air.rules