New issue
Advanced search Search tips

Issue 801717 link

Starred by 11 users

Issue metadata

Status: Assigned
Owner:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Android , Windows , Chrome , Mac
Pri: 2
Type: Feature



Sign in to add a comment

Add a mapping for the Nintendo Switch Pro Controller

Project Member Reported by mattreynolds@chromium.org, Jan 12 2018

Issue description

The Nintendo Switch Pro Controller can be paired over Bluetooth and used as a standard gamepad on desktop OSes. It is currently enumerated in Chrome but is unusable due to incorrect mappings for the D-pad and analog axes. Chrome should add a mapping for this popular device.

html5gamepad.com on Windows reports it as "Wireless Gamepad (Vendor: 057e Product: 2009)" with 10 axes and 16 buttons.
 
Project Member

Comment 1 by bugdroid1@chromium.org, Jan 31 2018

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

commit f04d6f40983400fe21b9a73ffba7cd3efba645ef
Author: Matt Reynolds <mattreynolds@chromium.org>
Date: Wed Jan 31 02:42:17 2018

Add a base Switch Pro controller implementation

The Switch Pro controller is usable when connected by USB or Bluetooth,
but defaults to a Bluetooth-only mode. This CL adds methods for
recognizing Switch Pro controllers, sending the vendor-specific packets
used for USB initialization and haptics, and reading controller data
reports.

BUG=801717

Change-Id: I076b001c5eda3c9e4900cb2a0ab19b78ef94d0da
Reviewed-on: https://chromium-review.googlesource.com/891621
Reviewed-by: Brandon Jones <bajones@chromium.org>
Commit-Queue: Matt Reynolds <mattreynolds@chromium.org>
Cr-Commit-Position: refs/heads/master@{#533173}
[modify] https://crrev.com/f04d6f40983400fe21b9a73ffba7cd3efba645ef/device/gamepad/BUILD.gn
[add] https://crrev.com/f04d6f40983400fe21b9a73ffba7cd3efba645ef/device/gamepad/switch_pro_controller_base.cc
[add] https://crrev.com/f04d6f40983400fe21b9a73ffba7cd3efba645ef/device/gamepad/switch_pro_controller_base.h

Project Member

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

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

commit bb1fbd0aedd1483b2735aed4e3a1749a88e05247
Author: Matt Reynolds <mattreynolds@chromium.org>
Date: Fri Feb 09 22:47:48 2018

Add support for Switch Pro Controller on Linux

The Nintendo Switch Pro Controller supports Bluetooth and USB modes,
but defaults to Bluetooth and requires a vendor-specific initialization
sequence to read controller inputs over USB.

This CL adds the logic to initialize the Pro controller for either
Bluetooth or USB depending on how it is connected. It also adds mappers
for both modes, and renormalizes axis values so they are centered and
cover the full analog range.

BUG=801717

Change-Id: I3ca031dcffc6a7e6d5cba2e378fe293de78b5309
Reviewed-on: https://chromium-review.googlesource.com/908048
Reviewed-by: Brandon Jones <bajones@chromium.org>
Commit-Queue: Matt Reynolds <mattreynolds@chromium.org>
Cr-Commit-Position: refs/heads/master@{#535863}
[modify] https://crrev.com/bb1fbd0aedd1483b2735aed4e3a1749a88e05247/device/gamepad/BUILD.gn
[modify] https://crrev.com/bb1fbd0aedd1483b2735aed4e3a1749a88e05247/device/gamepad/gamepad_device_linux.cc
[modify] https://crrev.com/bb1fbd0aedd1483b2735aed4e3a1749a88e05247/device/gamepad/gamepad_device_linux.h
[modify] https://crrev.com/bb1fbd0aedd1483b2735aed4e3a1749a88e05247/device/gamepad/gamepad_platform_data_fetcher_linux.cc
[modify] https://crrev.com/bb1fbd0aedd1483b2735aed4e3a1749a88e05247/device/gamepad/gamepad_platform_data_fetcher_linux.h
[modify] https://crrev.com/bb1fbd0aedd1483b2735aed4e3a1749a88e05247/device/gamepad/gamepad_standard_mappings.cc
[modify] https://crrev.com/bb1fbd0aedd1483b2735aed4e3a1749a88e05247/device/gamepad/gamepad_standard_mappings.h
[modify] https://crrev.com/bb1fbd0aedd1483b2735aed4e3a1749a88e05247/device/gamepad/gamepad_standard_mappings_linux.cc
[modify] https://crrev.com/bb1fbd0aedd1483b2735aed4e3a1749a88e05247/device/gamepad/switch_pro_controller_base.cc
[modify] https://crrev.com/bb1fbd0aedd1483b2735aed4e3a1749a88e05247/device/gamepad/switch_pro_controller_base.h
[add] https://crrev.com/bb1fbd0aedd1483b2735aed4e3a1749a88e05247/device/gamepad/switch_pro_controller_linux.cc
[add] https://crrev.com/bb1fbd0aedd1483b2735aed4e3a1749a88e05247/device/gamepad/switch_pro_controller_linux.h

Fully supporting Switch Pro will be more complex than just adding a mapping. We need to:

* Set 3Mbit baud rate
* Read joystick calibration data
* Handle dual-connection (Bluetooth + USB)

Optionally:

* Enable IMU data
* Improve rumble emulation
Project Member

Comment 4 by bugdroid1@chromium.org, Dec 7

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

commit 6c0755abaf31714d101f8ecc83c9d7bba05efe26
Author: Matt Reynolds <mattreynolds@google.com>
Date: Thu Dec 06 20:12:57 2018

Initialize GamepadService in BrowserThreadsStarted

The gamepad service needs a service manager connector in order
to connect to the device service. This CL adds a startup step in
BrowserThreadsStarted to provide the service manager connector.
This connector should only be used from the polling thread.

BUG=801717

Change-Id: Ia56479fb9e300f0b52b682bd7a905e9271efa7a9
Reviewed-on: https://chromium-review.googlesource.com/c/1362102
Reviewed-by: Ovidio Henriquez <odejesush@chromium.org>
Reviewed-by: Antoine Labour <piman@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Matt Reynolds <mattreynolds@chromium.org>
Cr-Commit-Position: refs/heads/master@{#614472}
[modify] https://crrev.com/6c0755abaf31714d101f8ecc83c9d7bba05efe26/content/browser/browser_main_loop.cc
[modify] https://crrev.com/6c0755abaf31714d101f8ecc83c9d7bba05efe26/device/gamepad/BUILD.gn
[modify] https://crrev.com/6c0755abaf31714d101f8ecc83c9d7bba05efe26/device/gamepad/gamepad_service.cc
[modify] https://crrev.com/6c0755abaf31714d101f8ecc83c9d7bba05efe26/device/gamepad/gamepad_service.h
[modify] https://crrev.com/6c0755abaf31714d101f8ecc83c9d7bba05efe26/device/gamepad/public/mojom/BUILD.gn

Project Member

Comment 5 by bugdroid1@chromium.org, Dec 13

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

commit 57e7834a27d40cf0ee6df24c7751451a2d0fc1df
Author: Matt Reynolds <mattreynolds@google.com>
Date: Thu Dec 13 17:32:01 2018

Fix threading and ordering issues for vibration effects

This CL addresses a threading issue where the vibration effect completion
callback was called on the polling thread instead of the thread that
requested the effect. Now a SequencedTaskRunner is passed along with the
callback to ensure the callback is run on the correct thread.

It also addresses an ordering issue when effects are queued using
Promises. Previously, if an effect completed successfully and triggered
another effect from its completion callback, the gamepad service would
still send a StopVibration command before starting the second effect. On
most gamepads, this is not noticeable due to the inertia of the vibration
actuator. However, on devices with more responsive actuators it may cause
short hiccups in vibration playback.

This CL fixes the ordering issue by scheduling a StopVibration task to
occur after all microtasks associated with the Promise callback are
completed. The scheduled task will only stop vibration if no other
vibration commands were sent to the actuator since the task was queued.

BUG=801717

Change-Id: I6507a409e6004bbe411210217b9873f29788ef7c
Reviewed-on: https://chromium-review.googlesource.com/c/1354483
Reviewed-by: Ovidio Henriquez <odejesush@chromium.org>
Commit-Queue: Matt Reynolds <mattreynolds@chromium.org>
Cr-Commit-Position: refs/heads/master@{#616353}
[modify] https://crrev.com/57e7834a27d40cf0ee6df24c7751451a2d0fc1df/device/gamepad/abstract_haptic_gamepad.cc
[modify] https://crrev.com/57e7834a27d40cf0ee6df24c7751451a2d0fc1df/device/gamepad/abstract_haptic_gamepad.h
[modify] https://crrev.com/57e7834a27d40cf0ee6df24c7751451a2d0fc1df/device/gamepad/abstract_haptic_gamepad_unittest.cc
[modify] https://crrev.com/57e7834a27d40cf0ee6df24c7751451a2d0fc1df/device/gamepad/gamepad_data_fetcher.cc
[modify] https://crrev.com/57e7834a27d40cf0ee6df24c7751451a2d0fc1df/device/gamepad/gamepad_data_fetcher.h
[modify] https://crrev.com/57e7834a27d40cf0ee6df24c7751451a2d0fc1df/device/gamepad/gamepad_platform_data_fetcher_linux.cc
[modify] https://crrev.com/57e7834a27d40cf0ee6df24c7751451a2d0fc1df/device/gamepad/gamepad_platform_data_fetcher_linux.h
[modify] https://crrev.com/57e7834a27d40cf0ee6df24c7751451a2d0fc1df/device/gamepad/gamepad_platform_data_fetcher_mac.h
[modify] https://crrev.com/57e7834a27d40cf0ee6df24c7751451a2d0fc1df/device/gamepad/gamepad_platform_data_fetcher_mac.mm
[modify] https://crrev.com/57e7834a27d40cf0ee6df24c7751451a2d0fc1df/device/gamepad/gamepad_platform_data_fetcher_win.cc
[modify] https://crrev.com/57e7834a27d40cf0ee6df24c7751451a2d0fc1df/device/gamepad/gamepad_platform_data_fetcher_win.h
[modify] https://crrev.com/57e7834a27d40cf0ee6df24c7751451a2d0fc1df/device/gamepad/gamepad_provider.cc
[modify] https://crrev.com/57e7834a27d40cf0ee6df24c7751451a2d0fc1df/device/gamepad/gamepad_provider.h
[modify] https://crrev.com/57e7834a27d40cf0ee6df24c7751451a2d0fc1df/device/gamepad/hid_haptic_gamepad_base_unittest.cc
[modify] https://crrev.com/57e7834a27d40cf0ee6df24c7751451a2d0fc1df/device/gamepad/raw_input_data_fetcher_win.cc
[modify] https://crrev.com/57e7834a27d40cf0ee6df24c7751451a2d0fc1df/device/gamepad/raw_input_data_fetcher_win.h
[modify] https://crrev.com/57e7834a27d40cf0ee6df24c7751451a2d0fc1df/device/gamepad/xbox_controller_mac.h
[modify] https://crrev.com/57e7834a27d40cf0ee6df24c7751451a2d0fc1df/device/gamepad/xbox_controller_mac.mm
[modify] https://crrev.com/57e7834a27d40cf0ee6df24c7751451a2d0fc1df/device/gamepad/xbox_data_fetcher_mac.cc
[modify] https://crrev.com/57e7834a27d40cf0ee6df24c7751451a2d0fc1df/device/gamepad/xbox_data_fetcher_mac.h
[modify] https://crrev.com/57e7834a27d40cf0ee6df24c7751451a2d0fc1df/third_party/blink/renderer/modules/gamepad/gamepad.cc
[modify] https://crrev.com/57e7834a27d40cf0ee6df24c7751451a2d0fc1df/third_party/blink/renderer/modules/gamepad/gamepad.h
[modify] https://crrev.com/57e7834a27d40cf0ee6df24c7751451a2d0fc1df/third_party/blink/renderer/modules/gamepad/gamepad_haptic_actuator.cc
[modify] https://crrev.com/57e7834a27d40cf0ee6df24c7751451a2d0fc1df/third_party/blink/renderer/modules/gamepad/gamepad_haptic_actuator.h
[modify] https://crrev.com/57e7834a27d40cf0ee6df24c7751451a2d0fc1df/third_party/blink/renderer/modules/gamepad/navigator_gamepad.cc

Sign in to add a comment