Welcome to the Oculus Developer Forums!

Your participation on the forum is subject to the Oculus Code of Conduct.

In general, please be respectful and kind. If you violate the Oculus Code of Conduct, your access to the developer forums may be revoked at the discretion of Oculus staff.

Raw input events rather than polling for tracking data

I have been trying to monitor when new tracking data may be available via RAW INPUT via WM_INPUT.  By trying to connect to the HID that has usage page 3, and usage 5, dwFlags as 0 in the RAWINPUTDEVICE struct, as I assumed this is the rift.

Firstly for whatever reason that makes my program hang for a while on startup which isn't good.  Then while running there are no WM_INPUT's seemingly from the headset?

Note I am simply trying to efficiently get the availability of new tracking data which I timestamp with queryperfcounter - that is used for additional control input, _NOT_ the actual rendering of the view (which I do the way Oculus intended so don't worry about that).

The idea being if I detect a WM_INPUT for the Rift that I would call ovr_GetTrackingState() as there is likely new data available.  Doing similar works for the mouse and keyboard, and I can also do the same for XINPUT to decide when to sample the gamepad via those WM_INPUT messages.  This works well and efficiently as I can use the nicely blocking GetMessage() in the message pump loop.

It all gives me much more responsive movement control in games.  So how do I get that to work for the Rift to?  As otherwise I have to spin up another thread and do lots of hacky stuff with sleep()'s when I should just be able to use raw input to listen in instead for the actual events.

If I list the HID devices on that machine I get:

page: 3 usage: 5 IS THIS NOT THE RIFT?

page: 13 usage: 1

page: 65280 usage: 10

page: 12 usage: 1

page: 12 usage: 1

page: 65280 usage: 2

page: 65280 usage: 1

page: 12 usage: 1

page: 1 usage: 5 GAMEPAD

page: 1 usage: 5 GAMEPAD

Again just so no one gets confused what I am asking for:  I want to be able to listen on the WM_INPUT messages from the Rift sensors to decide when to sample tracking data.  I am ok with not actually parsing the raw input data - just knowing that there is an update should be enough to notify me to call the Oculus SDK to get updated tracking state.

I would much prefer to get this notification via WM_INPUT listening than any kind of new SDK callback, as it would unify and simplify the whole thing efficiently in the way that ideally it should be done.
Sign In or Register to comment.