diff options
| author | Siarhei Vishniakou <svv@google.com> | 2025-11-11 15:45:19 -0800 |
|---|---|---|
| committer | Benjamin Tissoires <bentiss@kernel.org> | 2025-12-19 12:07:30 +0100 |
| commit | e9143268d259d98e111a649affa061acb8e13c5b (patch) | |
| tree | 4a363e87e5c2079fa09daf4a46680badf9f3ee13 /scripts/include/git@git.tavy.me:linux.git | |
| parent | f28beb69c51517aec7067dfb2074e7c751542384 (diff) | |
HID: playstation: Center initial joystick axes to prevent spurious events
When a new PlayStation gamepad (DualShock 4 or DualSense) is initialized,
the input subsystem sets the default value for its absolute axes (e.g.,
ABS_X, ABS_Y) to 0.
However, the hardware's actual neutral/resting state for these joysticks
is 128 (0x80). This creates a mismatch.
When the first HID report arrives from the device, the driver sees the
resting value of 128. The kernel compares this to its initial state of 0
and incorrectly interprets this as a delta (0 -> 128). Consequently, it
generates EV_ABS events for this initial, non-existent movement.
This behavior can fail userspace 'sanity check' tests (e.g., in
Android CTS) that correctly assert no motion events should be generated
from a device that is already at rest.
This patch fixes the issue by explicitly setting the initial value of the
main joystick axes (e.g., ABS_X, ABS_Y, ABS_RX, ABS_RY) to 128 (0x80)
in the common ps_gamepad_create() function.
This aligns the kernel's initial state with the hardware's expected
neutral state, ensuring that the first report (at 128) produces no
delta and thus, no spurious event.
Signed-off-by: Siarhei Vishniakou <svv@google.com>
Reviewed-by: Benjamin Tissoires <bentiss@kernel.org>
Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
Diffstat (limited to 'scripts/include/git@git.tavy.me:linux.git')
0 files changed, 0 insertions, 0 deletions
