Skip to content

Driver Documentation

Nathan Nuber edited this page Apr 5, 2022 · 21 revisions

This is an overview of the steps to write a new OpenVR driver. In the examples, the driver is simply called "mydriver".

It is advisable to use the built-in SteamVR drivers as references. For example, the Oculus driver is maintained by Valve and demonstrates nearly all of the below features (excluding driver registration). The built-in drivers can be found in your Steam install directory in the sub-path 'Steam\steamapps\common\SteamVR\drivers'.

  1. Put all the files for your driver under a directory. Let's say that directory is "/mydriver"
  2. Add a new DLL to "mydriver/bin/win64/driver_mydriver.dll" (For Linux use the appropriate platform directory and the appropriate shared library extension.)
  3. Implement the driver factory function in that DLL.
  4. Add an implementation of vr::IClientTrackedDeviceProvider to the DLL and return it from the factory. This provider will be phased out in the next SDK udpate, but for now you need it. This was removed in OpenVR version 1.0.6.
  5. Add an implementation of vr::IServerTrackedDeviceProvider and have that return implementations of vr::ITrackedDeviceServerDriver for each tracked device.
  6. Add a driver manifest file to "/mydriver"
  7. Add and remove your driver to SteamVR's config file using vrpathreg.
  8. If you are deploying your driver through Steam and do not have an executable to put in your Steam launch options, you can use a Steam URL to launch SteamVR. This way, if a user launches your driver through Steam, it will automatically start SteamVR. The launch option is: steam://run/250820

For drivers with status icons, you can add icons files to 'mydriver/resources/icons'. These metadata to map hardware status to the appropriate icon belongs in 'mydriver/resources/driver.vrresources'.

For drivers with custom artwork in the input binding UI, add SVG files to the same folder, 'mydriver/resources/icons'.

For drivers with localized strings, add localization for all languages to 'mydriver/resources/localization/localization.json'. This will affect the strings that are displayed in the UI related to your hardware, for example, in the input binding UI. Generally, you only need to provide translations for the names of your hardware and input paths. If localization is working for some, but not all of your devices, then you may need to explicitly tell OpenVR to use a certain resource namespace. To do this, add a line to the input profile for the device that is not working, "resource_root" : "", where the is replaced with the driver's name as written in the .vrdrivermanifest.

For devices with buttons, triggers, joysticks, and other kinds of input controls, please refer to the vr::IVRDriverInput API.

For devices that wish to provide animation data through the Skeletal Input system, please refer to the Skeletal Input Driver documentation.

The source code for a sample driver is available here. The sample implements these interfaces and includes an example HMD/controller.

Other driver documentation:

Clone this wiki locally