ValveSoftware / openvr

OpenVR SDK
http://steamvr.com
BSD 3-Clause "New" or "Revised" License
6.02k stars 1.27k forks source link

Combination of openvr.h and openvr_driver.h #823

Open tomassykora opened 6 years ago

tomassykora commented 6 years ago

I'm building an application based on openvr.h. In the application I need to exit the whole steamVR app. I found here 473 how to do it:

vr::VREvent_Reserved_t data = { 0, 0 };
vr::VRServerDriverHost()->VendorSpecificEvent(m_unObjectId, vr::VREvent_DriverRequestedQuit, (VREvent_Data_t&)data, 0);

The problem is, that this function is from openvr_driver.h and my project won't build with it because there are lots of redefinitions in the header. Is there a way how to solve this? Is there a different way of exitting steamVR?

By exitting the steamVR I'm solving a situation, when my application is running with let's say 2 connected Vive trackers, then I close the application and start it with only 1 tracker. But in steamVR (which was still running when my application wasn't) there are still two trackers present, which I don't want to. I need the steamVR application to be clean like it is when I newly start it. That's why I want to exit steamVR. So if you know about another solution for this situation, I'd really appreciate it.

TheDeveloperGuy commented 6 years ago

The driver header is for drivers, so you won't be able to use it. You could make a trivial "do nothing" driver that your app can talk to via the debugRequest() API to get it to send the event. Or, if that's too complicated you can go for something like "AdvancedSettings" is doing (download the source and explore).

tomassykora commented 6 years ago

@TheDeveloperGuy What do you mean by "AdvancedSettings"? I searched the code and I'm not still sure what that should be.

TheDeveloperGuy commented 6 years ago

https://github.com/matzman666/OpenVR-AdvancedSettings

farabiahmed commented 5 years ago

I am having similar issue. I created my own driver through openvr_driver.h.

Now, I need to know total number of controller devices in the system. Which can be easly done via VRInit through openvr.h. But, due to the redefinitions I didnt manage it.

I also tried to create another DLL project that returns the number of connected controllers. If I trigger the DLL through my driver, VRInit returning error.

I understand that it is not possible. My intention is to keep my controller as the third device always since it doesnt have enough functionality to control my avatar. I want to have HTC controllers to be the controllers the first and second.

Is there a way to get my controller as third device in the system Or wait until first two controllers linked?

Kanken6174 commented 2 years ago

I've encountered this issue too, the fact that we can get the pose from other devices with their handle from openvr-driver.h but not any information about them that could help us identify what they are is mind-boggling to me. The fact that we can't include both openvr_driver.h and openvr.h locks us in a situation where we can get the data but we're compeltely blind...