• Alex Cooper's avatar
    Ensure OpenVR controllers re-connect properly after suspend · ea496ec7
    Alex Cooper authored
    If a user suspends an OpenVR immersive session whether by dropping to
    a home environment (like the WMR home), or by pressing the "system"
    button on the controller to show the OpenVR/Vive menu, and then
    re-enters the session, the controllers would no longer be visualized.
    This appears to be occuring because while the controller stayed
    connected, the OpenVRRenderLoop was not able to query it's state, and
    therefore stopped reporting input information on the controller.
    When the controller re-connected, the RenderLoop would resume sending
    data about the controller back up, but did not send a new description
    because it thought it had been connected all along.
    
    In XRSession, when a new XRInputSource was created, it defaulted to
    being created as a "Gaze" source with no handedness. With no override
    from the description, it stayed that way; clicks would work on the gaze
    target, but no controllers/pointers would be rendered.
    
    The fix here is to simply mark the controller as inactive if it does
    not have state, thus ensuring that a new description is sent up when
    the controller is again tracked/has state.
    
    While updating this change, it was discovered that the tests report all
    devices as connected, and so connecting/disconnecting a controller on
    the test side would not prompt the device to be registered in product
    code as newly connected (where it's device type is updated), so it
    was always ignored if it was ever disconnected.  This change modifies
    the WaitGetPoses method (where GetInputSources gets it's data), to
    properly report the connected state of controllers.
    
    Bug: 934355
    Change-Id: Ia61c7568916cc9446366e085e74b55c413c5f6f2
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1648654Reviewed-by: default avatarBill Orr <billorr@chromium.org>
    Commit-Queue: Alexander Cooper <alcooper@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#667209}
    ea496ec7
fake_openvr_impl_api.cc 20.3 KB