New issue
Advanced search Search tips

Issue 731311 link

Starred by 4 users

Issue metadata

Status: Fixed
Owner:
Closed: Sep 2017
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux
Pri: 2
Type: Bug


Show other hotlists

Hotlists containing this issue:
Gamepad


Sign in to add a comment

Dualshock 3 and 4 not correctly mapped on Linux kernel 4.10+

Reported by koride...@gmail.com, Jun 8 2017

Issue description

UserAgent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36

Steps to reproduce the problem:
1. Connect a PS4 Controller via USB
2. Move the right analog stick

What is the expected behavior?
In the gamepad object, the corresponding axis should change its value

What went wrong?
Instead, the right analog stick is mapped as a button.
The stick appears as an entry in the button array of the gamepad. This "button" is constantly pressed and has a value of 0.5 if the stick is in neutral position.

Did this work before? N/A 

Does this work in other browsers? N/A

Chrome version: 58.0.3029.110  Channel: n/a
OS Version: 
Flash Version:
 
error_report_gamepad.png
89.0 KB View Download
Labels: TE-Hardware-Dependency
As mentioned in the issue, we don't have PS4 controller. Hence, adding the label 'TE-Hardware-Dependency'.

I couldn't repro this with my gamepad (Model CUH-ZCT1U, 054c:05c4) on Linux (Ubuntu 14.04), the mappings are correct for all buttons and axes. We should have correct mappings for 054c:05c4 and 054c:09cc.

Please check html5gamepad.com to get the Vendor and Product ID codes, and to see whether the mapping is "standard".

It may also matter what version of Linux you're running. Dualshock 4 support was added to the Linux kernel in version 3.15, but newer revisions of the gamepad may require >=4.10.

Comment 3 by koride...@gmail.com, Sep 13 2017

According to html5gamepad.com:
Vendor: 054c 
Product: 09cc
mapping: standard

On html5gamepad.com:
When I use the left stick, the values of Axis 0 and Axis 1 are changing.
When I use the right stick, the values of B6 and B7 are changing.



I'm using Antergos with a Linux kernel in version 4.12.12-1-ARCH
Owner: mattreynolds@chromium.org
Status: Started (was: Unconfirmed)
Thanks! I've ordered a 09cc device (model CUH-ZCT2) so I can verify the mapping.
I tested both CUH-ZCT1U and CUH-ZCT2U on Ubuntu 14.04, all buttons and axes are mapped correctly.

$ uname -a
Linux ubuntu 3.16.0-30-generic #40~14.04.1-Ubuntu SMP Thu Jan 15 17:43:14 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

Tested again on Antergos 17.9, I confirmed that the right stick, the triggers, and several buttons are mapped incorrectly for both gamepads.

$ uname -a
Linux ant-17.9 4.12.8-2-ARCH #1 SMP PREEMPT Fri Aug 18 14:08:02 UTC 2017 x86_64 GNU/Linux

Looks like it's a kernel change, probably this one:

https://github.com/torvalds/linux/commit/9131f8cc2b4eaf7c08d402243429e0bfba9aa0d6
Summary: Dualshock4 not correctly mapped on Linux kernel 4.10+ (was: PS4 controller not correctly mapped)
From the patch, they set the high bit in the version number to help SDL2 distinguish the old buggy mapping from the new mapping. We should check the device version and do the same so we don't have to compare against the kernel's version.

/* Patch the hw version on DS4 compatible devices, so applications can
 * distinguish between the default HID mappings and the mappings defined
 * by the Linux game controller spec. This is important for the SDL2
 * library, which has a game controller database, which uses device ids
 * in combination with version as a key.
 */
if (sc->quirks & DUALSHOCK4_CONTROLLER)
	hdev->version |= 0x8000;
Summary: Dualshock 3 and 4 not correctly mapped on Linux kernel 4.10+ (was: Dualshock4 not correctly mapped on Linux kernel 4.10+)
This also affects the SIXAXIS/Dualshock 3, which similarly had its mapping fixed in 4.10.
Project Member

Comment 9 by bugdroid1@chromium.org, Sep 22 2017

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

commit cc8089ccaaf0b312f863331ddf7b71576020b4a4
Author: Matt Reynolds <mattreynolds@google.com>
Date: Fri Sep 22 21:17:08 2017

Fix Dualshock 3 and 4 mappings for Linux kernel 4.10+

In newer versions of the Linux kernel, the hid-sony driver has been
updated to more closely match the Linux gamepad spec. To allow downstream
users to distinguish between the old mappings and the new ones, the
driver patches the hardware version.

Currently, Chrome uses the vendor_id/product_id pair to pick which mapping
function to use. This CL adds the version number as a third item and
selects the updated Dualshock 3 and 4 mappings when the patched version is
detected.

BUG= 731311 

Change-Id: I6d151ffedfd11e8ec38db62ecbdb9351e7b9a540
Reviewed-on: https://chromium-review.googlesource.com/678257
Reviewed-by: Brandon Jones <bajones@chromium.org>
Commit-Queue: Matt Reynolds <mattreynolds@chromium.org>
Cr-Commit-Position: refs/heads/master@{#503856}
[modify] https://crrev.com/cc8089ccaaf0b312f863331ddf7b71576020b4a4/device/gamepad/gamepad_platform_data_fetcher_linux.cc
[modify] https://crrev.com/cc8089ccaaf0b312f863331ddf7b71576020b4a4/device/gamepad/gamepad_platform_data_fetcher_mac.mm
[modify] https://crrev.com/cc8089ccaaf0b312f863331ddf7b71576020b4a4/device/gamepad/gamepad_standard_mappings.h
[modify] https://crrev.com/cc8089ccaaf0b312f863331ddf7b71576020b4a4/device/gamepad/gamepad_standard_mappings_linux.cc
[modify] https://crrev.com/cc8089ccaaf0b312f863331ddf7b71576020b4a4/device/gamepad/gamepad_standard_mappings_mac.mm
[modify] https://crrev.com/cc8089ccaaf0b312f863331ddf7b71576020b4a4/device/gamepad/gamepad_standard_mappings_win.cc
[modify] https://crrev.com/cc8089ccaaf0b312f863331ddf7b71576020b4a4/device/gamepad/raw_input_data_fetcher_win.cc
[modify] https://crrev.com/cc8089ccaaf0b312f863331ddf7b71576020b4a4/device/gamepad/raw_input_data_fetcher_win.h

Status: Fixed (was: Started)

Sign in to add a comment