Skip to content
Commit 2e474129 authored by Matt Reynolds's avatar Matt Reynolds Committed by Commit Bot
Browse files

[Win] Avoid overwriting axis elements for HID gamepads

The button and axis count for HID gamepads is determined by querying
the device for its input report descriptor and then iterating through
it to find elements with usage pages and usage numbers that are
appropriate for gamepad buttons and axes.

In some cases, this heuristic incorrectly includes inputs from other
usage pages that happen to have usage numbers that make them look like
axes. In general this is acceptable and these fake axes will be ignored
when the inputs are mapped to the standard gamepad. However, if the fake
axis has the same usage number as an already-discovered axis, it will
overwrite that axis and render it unusable.

To fix this, the HID report descriptor logic will prefer the first axis
it finds with a given usage number and ignore the rest.

BUG=814504

Change-Id: I2369849ebee825760c954b948c3a650f42478bee
Reviewed-on: https://chromium-review.googlesource.com/935622


Reviewed-by: default avatarReilly Grant <reillyg@chromium.org>
Commit-Queue: Matt Reynolds <mattreynolds@chromium.org>
Cr-Commit-Position: refs/heads/master@{#539605}
parent c91915a7
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment