Skip to content

Commit

Permalink
Set OpenVR gamepad.id to 'htc-vive' if the model string contains 'Vive'.
Browse files Browse the repository at this point in the history
OpenVR reports different model strings for developer vs released versions
of Vive controllers. In the future, there could be additional iterations
of the Vive controller that we also want to catch here. That's why we
check if the model string contains "Vive" instead of doing an exact match
against specific string(s).

Bug: 961862
Change-Id: I18892434c58e396a3f60f239d645e96226f4b498
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1622465
Reviewed-by: Bill Orr <billorr@chromium.org>
Commit-Queue: Jacob DeWitt <jacde@chromium.org>
Cr-Commit-Position: refs/heads/master@{#661818}
  • Loading branch information
Jacob DeWitt authored and Commit Bot committed May 21, 2019
1 parent 593809b commit 0b0313e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion device/vr/openvr/openvr_gamepad_helper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,13 @@ class OpenVRGamepadBuilder : public GamepadBuilder {
GetOpenVRString(vr_system, vr::Prop_ModelNumber_String, controller_id);
std::string manufacturer = GetOpenVRString(
vr_system, vr::Prop_ManufacturerName_String, controller_id);
return (model == "Vive Controller MV") && (manufacturer == "HTC");

// OpenVR reports different model strings for developer vs released versions
// of Vive controllers. In the future, there could be additional iterations
// of the Vive controller that we also want to catch here. That's why we
// check if the model string contains "Vive" instead of doing an exact match
// against specific string(s).
return (manufacturer == "HTC") && (model.find("Vive") != std::string::npos);
}

// TODO(https://crbug.com/942201): Get correct ID string once WebXR spec issue
Expand Down

0 comments on commit 0b0313e

Please sign in to comment.