Commit 5f7fba25 authored by Tetsui Ohkubo's avatar Tetsui Ohkubo Committed by Commit Bot

exo: gamepad: Send correct axis code

In the previous CL https://crrev.com/c/1624385 I forwarded wrong axis
indices to ARC. In order to forward correct evdev ABS_CNT axis indices,
you have to also keep raw indices in ui::GamepadDevice::Axis.

This is a part of the effort to improve ARC gamepad compatibility.
Design doc: go/arc-improved-gamepad

TEST=manual(--enable-features=ExoRawGamepadInfo to /etc/chrome_dev.conf)
BUG=b:130597086

Change-Id: I997b262749b413cee38af40cc498ea2b399e2904
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1631150Reviewed-by: default avatarSadrul Chowdhury <sadrul@chromium.org>
Reviewed-by: default avatarMitsuru Oshima (OOO 5/28) <oshima@chromium.org>
Commit-Queue: Tetsui Ohkubo <tetsui@chromium.org>
Cr-Commit-Position: refs/heads/master@{#664082}
parent d78892ec
...@@ -164,11 +164,10 @@ class WaylandGamingSeatDelegate : public GamingSeatDelegate { ...@@ -164,11 +164,10 @@ class WaylandGamingSeatDelegate : public GamingSeatDelegate {
GetGamepadBusType(device.type), device.vendor_id, device.product_id, GetGamepadBusType(device.type), device.vendor_id, device.product_id,
device.version); device.version);
for (size_t i = 0; i < device.axes.size(); ++i) { for (const auto& axis : device.axes) {
const auto& axis = device.axes[i]; zcr_gamepad_v2_send_axis_added(gamepad_resource, axis.code,
zcr_gamepad_v2_send_axis_added(gamepad_resource, i, axis.min_value, axis.min_value, axis.max_value,
axis.max_value, axis.flat, axis.fuzz, axis.flat, axis.fuzz, axis.resolution);
axis.resolution);
} }
zcr_gamepad_v2_send_activated(gamepad_resource); zcr_gamepad_v2_send_activated(gamepad_resource);
} else { } else {
......
...@@ -16,6 +16,9 @@ namespace ui { ...@@ -16,6 +16,9 @@ namespace ui {
struct EVENTS_DEVICES_EXPORT GamepadDevice : public InputDevice { struct EVENTS_DEVICES_EXPORT GamepadDevice : public InputDevice {
// Represents an axis of a gamepad e.g. an analog thumb stick. // Represents an axis of a gamepad e.g. an analog thumb stick.
struct Axis { struct Axis {
// Gamepad axis index. Corresponds to |raw_code_| of GamepadEvent.
uint16_t code = 0;
// See input_absinfo for the definition of these variables. // See input_absinfo for the definition of these variables.
int32_t min_value = 0; int32_t min_value = 0;
int32_t max_value = 0; int32_t max_value = 0;
......
...@@ -135,6 +135,7 @@ GamepadEventConverterEvdev::GamepadEventConverterEvdev( ...@@ -135,6 +135,7 @@ GamepadEventConverterEvdev::GamepadEventConverterEvdev(
abs_info = devinfo.GetAbsInfoByCode(code); abs_info = devinfo.GetAbsInfoByCode(code);
if (devinfo.HasAbsEvent(code)) { if (devinfo.HasAbsEvent(code)) {
ui::GamepadDevice::Axis axis; ui::GamepadDevice::Axis axis;
axis.code = code;
axis.min_value = abs_info.minimum; axis.min_value = abs_info.minimum;
axis.max_value = abs_info.maximum; axis.max_value = abs_info.maximum;
axis.flat = abs_info.flat; axis.flat = abs_info.flat;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment