How to get battery status for peripherals?

I’m working on an OpenXR app for a Meta Quest 3 and would like to obtain some status information about the controllers (battery status, connected state, etc.) Does OpenXR specify a way to do that, or are there any extensions that enable that functionality? I can’t seem to find an answer in the docs.

I’m also interested in controller battery but could not find it in OpenXR spec nor FB extensions.

AFAIK the headset battery itself you can only get through Android API already :frowning:
I don’t know if maybe there is such API for bluetooth devices as well?

The only thing I see from the Android API is the BluetoothDevice class, but unfortunately I don’t see a way to use it to get battery info.

I am able to read the controller’s battery states from my laptop when connected with QuestLink using ‘adb shell dumpsys OVRRemoteService’ but again I don’t think I can run that command programmatically on the Quest and capture those results in the app :confused:

I’ll keep digging!

Oh interesting.

In theory if the tool can read it, then it should be possible to write code to do the same

https://android.googlesource.com/platform/frameworks/native/+/master/cmds/dumpsys/dumpsys.cpp

Controller battery status has been identified as something that the runtime manages in its system UI. In addition, it’s challenging to provide a useful, cross-device indicator of battery levels (what’s the “transfer function” and interpretation of a float if you give back a float, etc) I would be OK with a 2 level thing (good or low), or an optional event (“battery low”) in an extension, but I haven’t seen such an extension proposed.

I know it’s a bit weird to not have it since previous vendor-specific APIs tended to provide access to this and more, but we definitely have talked about it a lot.

1 Like