Fix buttons on Shield and Xbox One S gamepads

Nvidia Shield gamepads report some buttons using usage numbers
from the Consumer usage page instead of the Button usage page
which is typical for gamepads. This CL adds logic to check for
several common usages outside the Button page and append them to
the end of the gamepad button array.

It also fixes the Xbox One S gamepad mappings to add these buttons.
The names of the mapping functions for the original firmware and
updated firmware were previously reversed; this is also fixed.

Fixed in this CL:
* [Mac/Linux] Xbox One S Guide button, original FW, Bluetooth
* [Mac/Linux] Xbox One S Guide/Back buttons, 2016 FW, Bluetooth
    (These devices are already well-supported on Windows.)
* [Mac/Win/Linux] Nvidia Shield 2015 Guide/Back/Extra buttons, USB
* [Win/Linux] Nvidia Shield 2017 mapper added, USB/Bluetooth

A mapper for Nvidia Shield 2017 was not added on Mac. The gamepad
is not recognized as a HID gamepad over USB and does not stay
connected over Bluetooth.

Note that some Consumer key codes have other meanings on some
platforms that may cause Chrome to navigate away from the current


Change-Id: I4edafc0507c553ebdc4daac0b5a6f1ecfeb7c1ed
Reviewed-by: Brandon Jones <>
Commit-Queue: Matt Reynolds <>
Cr-Commit-Position: refs/heads/master@{#575710}
3 files changed