ValveSoftware / openvr

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

Turning off the controllers through OpenVR #1554

Closed kpbg closed 3 years ago

kpbg commented 3 years ago

Hi Guys,

I can't find an option to send a PowerOff signal to a controller.

Normally when our users stop using our app, they have to manually turn off the controllers, but sometimes they forget, which drains the battery. Will be great if I can do that on their behalf..

Thank you in advance!

badaaim commented 3 years ago

From my understanding, Valve needs to manually include your device to their library of supported controllers or VR devices to implement this feature.

So in such scenario you will have to contact them directly? I don't think there's an available code for you to do that on your own.

kpbg commented 3 years ago

We have an overlay app and not a device. The goal is to just turn off the controllers whatever they are - Index, Wands, etc. There is an OpenVR option to check if the controllers support remote shutting down, but I can't see how to actually send the shut down signal. As an example, if SteamVR is turned off, the controllers are immediately powered off. I'm looking for the same, but without the need to shut down SteamVR.

JoeLudwig commented 3 years ago

This is not a feature we support from applications. Lighthouse controllers (Vive wands and Index Controllers) will turn of automatically after some period of inactivity. The user can set that timeout if they prefer them to turn off more or less aggressively.

kpbg commented 3 years ago

The main issue is the controllers sometimes just refuse to automatically turn off due to inactivity. Otherwise, as you suggested, this would be good enough.

JoeLudwig commented 3 years ago

If that's happening, it's most likely a bug in SteamVR itself, which we can work on. Do the controllers in question have very jittery tracking wherever they're resting?

kpbg commented 3 years ago

It's not just a single pair of controllers, but I have seen this happening for years with Wand/Index controllers. At the same time, shutting off SteamVR always turns them off. They light in green in SteamVR, so it's not about getting out of the reach of the base stations. However, thinking about it, after the use end, if the controllers are put in a place (let say a drawer) outside of the base stations reach, would they still shut off upon reaching the inactivity period? In a commercial environment, the better option still seems to be able to shut off the controllers upon factors different than inactivity. Looking on some old vrserver logs, there seems to be:

Sun Apr 17 2016 19:13:54.788 - Processing message VRMsg_PowerOffTrackedDevice from vrmonitor (4268) took 0.00129 seconds

Having this exposed to OpenVR sounds like the best solution for our use case.

BeMacized commented 2 years ago

I too have been looking for a way to power off controllers / trackers programatically via OpenVR. There are other use cases where turning off devices is desirable, even when they are not inactive. I would really like to see this functionality exposed.

EDIT: I ran into an acceptable workaround (source):

  1. Get the serial number of the connected wireless dongle using the Prop_ConnectedWirelessDongle_String property.
  2. Call the lighthouse_console binary with arguments /serial %serialNumber% poweroff.