Git Product home page Git Product logo

riftdriverpi's Introduction

riftDriverPi

Small USB HID driver to activate Oculus Rift CV1 as extended display on Raspberry Pi 4

How to compile the driver

  • Start RPi 4 and open a terminal
  • Execute the following commands
sudo apt-get install libusb-1.0
git clone --recurse-submodules https://github.com/OhioIon/riftDriverPi
cd riftDriverPi
make

How to make Raspbian recognize the Oculus Rift CV1 as screen

Step 1 - Hardware connection

  • Connect your normal screen to HDMI0
  • Connect the Oculus Rift CV1 to HDMI1 and USB 3.0 port of the RPi 4

Step 2 - Rebuilding the kernel with increased framerate support

sudo apt install git bc bison flex libssl-dev make
cd ~
git clone --depth=1 https://github.com/raspberrypi/linux
cd linux

sed -i 's/if (drm_mode_vrefresh(mode) > 85)/if (drm_mode_vrefresh(mode) > 90)/g' drivers/gpu/drm/vc4/vc4_firmware_kms.c

KERNEL=kernel7l
make bcm2711_defconfig
make -j4 zImage modules dtbs
sudo make modules_install
sudo cp arch/arm/boot/dts/*.dtb /boot/
sudo cp arch/arm/boot/dts/overlays/*.dtb* /boot/overlays/
sudo cp arch/arm/boot/dts/overlays/README /boot/overlays/
sudo cp arch/arm/boot/zImage /boot/$KERNEL.img
sudo reboot

Step 3 - Configure screen resolution manually via RPi config.txt

  • The Rift CV1 does not function like a normal screen
  • It will only send hotplug over HDMI if it is enabled via a USB driver (which is too late for RPi)
  • Also the EDID does not contain a standard timing information but only a single detailed timing descriptor
  • In order to make it work, we need to explicitly apply the detailed timing spec in config.txt and force the hotplug
  • The following lines need to be set in /boot/config.txt
hdmi_force_hotplug:1=1
hdmi_group:1=2
hdmi_mode:1=87
hdmi_timings:1=2160 1  8  32  40 1200 0  50 2 220 0 0 0 90 0 296750000 3

You can also use the config.txt provided as reference and copy it with:

sudo cp ~/riftDriverPi/config.txt /boot
sudo reboot

Now there is a second screen in the RPi 4 Screen Layout Editor (Preferences -> Screen Configuration) with resolution "FIXEDMODE".

Configure linux to use hidapi via libusb for Oculus Rift

  • This will avoid having to run the application as root to access the USB device
  • Execute the following commands in a terminal
echo 'SUBSYSTEM=="usb", ATTR{idVendor}=="2833", MODE="0666", GROUP="plugdev"' | sudo tee --append /etc/udev/rules.d/83-hmd.rules
sudo udevadm control --reload-rules
sudo reboot

Enable the Oculus Rift CV1 screen

  • If the previous configuration steps have been completed, there is no need to repeat them
  • In order to activate the Oculus Rift CV1 screen, just execute the riftDriverPi app
  • The driver will enable the screen and send the keep-alive message cyclically
~/riftDriverPi/riftDriverPi
  • You should see that the orange LED on the Rift turns white
  • You should see the extended desktop through the Rift (but not nice since left and right eye see different parts)
  • Test stereo view by watching a side-by-side video in full-screen on YouTube (https://www.youtube.com/results?search_query=3D+side+by+side)

Hint: Hitting return in the terminal will stop the application.

riftdriverpi's People

Contributors

ohioion avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.