Closed Bug 1356421 Opened 7 years ago Closed 7 years ago

OpenVR controllers enumeration is not reliable

Categories

(Core :: WebVR, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla55
Tracking Status
firefox55 --- fixed

People

(Reporter: dmarcos, Assigned: daoshengmu)

Details

Attachments

(2 files)

I have not found a consistent set of steps to reproduce the problems. Calling navigator.getGamepads() is not reliable on page reloads, or when controllers go on / off in the same session or across page reloads. These are the inconsistencies I observed:

- Sometimes when loading a page with a single Vive controller active the id of the gamepad is empty string "" (https://d3vv6lp55qjaqc.cloudfront.net/items/113p2847093n3z242x22/Image%202017-04-13%20at%201.23.47%20PM.png?X-CloudApp-Visitor-Id=3fb0ea5496d108de857ec2934e3b9ba7&v=226d5202)

- Sometimes when loading a page (https://aframe.io/aframe/examples/showcase/tracked-controls/) with two controllers and reloading the same page with just one controller active makes navigator.getGamepads() return an array of two elements where one is null: [Gamepad, null]

- With one tracker and two Vive controllers active navigator.getGamepads() returns an array of three gamepads but the gamepad.id of all of them is  "OpenVR Tracker" where I would expect to see two "OpenVR Gamepad" and one "OpenVR Tracker"

I spend several hours investigating this and I have not found yet a consistent series of steps that reproduce the problems above. I tried restarting Nightly, closing SteamVR, reloading the same page several times, switching on/off controllers. I end up in the bogus steps above often but not with a consistent series of actions.
Assignee: nobody → dmu
An easy way to reproduce:
- On Nightly go to https://aframe.io/examples/showcase/tracked-controllers
- Enter VR and press the button on the controllers, they should show up, but they don't
- Go to http://html5gamepad.com and see how the gamepad are enumerated but they don't show any ID next to the controller number.

- Do the same on Chrome, and notice how in html5gamepad it shows 1. OpenVR Gamepad and 2. OpenVR Gamepad.

As we're using the ID to detect the kind of controller available, all the demos using vive are broken right now :(
Well. This is my mistake for implementing OpenVR Tracker support. After putting `deviceType` inside the loop will resolve the problem.
Comment on attachment 8860796 [details]
Bug 1356421 - Part 1: Fix for making OpenVR get correct device types for Gamepad id;

https://reviewboard.mozilla.org/r/132760/#review136534

LGTM, Thanks!
Attachment #8860796 - Flags: review?(kgilbert) → review+
Comment on attachment 8860811 [details]
Bug 1356421 - Part 2: Notify GamepadManager when controllers are removed in VR manager;

https://reviewboard.mozilla.org/r/132788/#review136536

LGTM
Attachment #8860811 - Flags: review?(kgilbert) → review+
Pushed by dmu@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/0b7e38e69bab
Part 1: Fix for making OpenVR get correct device types for Gamepad id; r=kip
https://hg.mozilla.org/integration/autoland/rev/5e53e3f11012
Part 2: Notify GamepadManager when controllers are removed in VR manager; r=kip
https://hg.mozilla.org/mozilla-central/rev/0b7e38e69bab
https://hg.mozilla.org/mozilla-central/rev/5e53e3f11012
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: