• Matt Reynolds's avatar
    Support gamepad buttons with HID Consumer usages · 8f51909b
    Matt Reynolds authored
    Most gamepads report their button state in a HID output report that
    associates HID usages with the state of each button. For most gamepads,
    the HID usages associated with buttons come from the Button
    usage page.
    
    For some gamepads, particularly those designed to work on Android
    devices, the Back and Home buttons are associated with usages outside
    the normal set of gamepad usages. For instance, the Xbox One S
    gamepad, when connected over Bluetooth, sends a SystemMainMenu usage
    for the Home button. The same gamepad, after receiving a firmware
    update to improve Android compatibility, reports the Home and Back
    buttons as Home and Back usages on the Consumer usage page.
    
    On Linux, we use the joydev input driver to enumerate connected gamepads
    and fetch the current gamepad state. However, HID buttons outside the
    normal set of gamepad usages are not reported through joydev and must
    be read through evdev instead.
    
    This CL allows these extra buttons to be detected and mapped by Chrome.
    
    BUG=824871
    
    Change-Id: Ib873948c6632edb36675f45c948190cb99ce126e
    Reviewed-on: https://chromium-review.googlesource.com/1091464Reviewed-by: default avatarBrandon Jones <bajones@chromium.org>
    Commit-Queue: Matt Reynolds <mattreynolds@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#569439}
    8f51909b
gamepad_device_linux.cc 17 KB