New issue
Advanced search Search tips

Issue 814504 link

Starred by 2 users

Issue metadata

Status: Started
Owner:
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows , Mac
Pri: 3
Type: Bug



Sign in to add a comment

Dualshock4 uses wrong mapping over Bluetooth

Project Member Reported by mattreynolds@chromium.org, Feb 21 2018

Issue description

Tested on 65.0.3325.51 (Official Build) beta (64-bit)

When connected over Bluetooth, DS4 controllers sometimes use the wrong mapping.

On Mac, a newer-model DS4 connected over Bluetooth maps the left analog stick incorrectly as well as the primary and quaternary buttons (button[0] and button[3]).

On Windows, both older and newer model DS4s map the left analog stick incorrectly.

I didn't notice any issues on Linux.
 
The Mac mapping error is caused by our logic for generically enumerating HID gamepad axes. We query the device for its input report descriptor and then iterate through its elements to collect the ones that look like gamepad axes based on the usage page and usage number of the element and its parents.

This heuristic was failing for DS4 because the report descriptor includes other elements that have the correct usage page and usage number to look like axes, even though they are not. The left analog X axis is correctly discovered as axis 0, but is later overwritten by the invalid axes which also happen to have usage numbers corresponding to axis 0. We can work around this by modifying the heuristic to prefer the first axis it discovers at a particular index and ignores the rest.
Project Member

Comment 2 by bugdroid1@chromium.org, Feb 22 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/777011e8c109d8d5b6a37e0c5865744a9acb52d7

commit 777011e8c109d8d5b6a37e0c5865744a9acb52d7
Author: Matt Reynolds <mattreynolds@google.com>
Date: Thu Feb 22 19:23:21 2018

[Mac] 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: Ie601fa5d381f7a875b166ff51f658850042f5fa7
Reviewed-on: https://chromium-review.googlesource.com/930485
Reviewed-by: Reilly Grant <reillyg@chromium.org>
Commit-Queue: Matt Reynolds <mattreynolds@chromium.org>
Cr-Commit-Position: refs/heads/master@{#538519}
[modify] https://crrev.com/777011e8c109d8d5b6a37e0c5865744a9acb52d7/device/gamepad/gamepad_device_mac.mm

Project Member

Comment 3 by bugdroid1@chromium.org, Feb 28 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/2e47412909456a46e9c03b79214b0d44990addcd

commit 2e47412909456a46e9c03b79214b0d44990addcd
Author: Matt Reynolds <mattreynolds@chromium.org>
Date: Wed Feb 28 01:11:15 2018

[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: Reilly Grant <reillyg@chromium.org>
Commit-Queue: Matt Reynolds <mattreynolds@chromium.org>
Cr-Commit-Position: refs/heads/master@{#539605}
[modify] https://crrev.com/2e47412909456a46e9c03b79214b0d44990addcd/device/gamepad/raw_input_gamepad_device_win.cc

Sign in to add a comment