lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAKF84v2DzfOLzsZ8eMeVVTXa_uKiyj-LUjchW1StcBXVt_HXhA@mail.gmail.com>
Date: Mon, 1 Dec 2025 10:30:31 -0800
From: Siarhei Vishniakou <svv@...gle.com>
To: Jiri Kosina <jikos@...nel.org>, Benjamin Tissoires <bentiss@...nel.org>, 
	Roderick Colenbrander <roderick.colenbrander@...y.com>, linux-input@...r.kernel.org, 
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] HID: playstation: Center initial joystick axes to
 prevent spurious events

вт, 11 нояб. 2025 г. в 15:45, Siarhei Vishniakou <svv@...gle.com>:
>
> 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@...gle.com>
> ---
>  drivers/hid/hid-playstation.c | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/drivers/hid/hid-playstation.c b/drivers/hid/hid-playstation.c
> index 1468fb11e39d..a145b5ea4405 100644
> --- a/drivers/hid/hid-playstation.c
> +++ b/drivers/hid/hid-playstation.c
> @@ -718,11 +718,16 @@ static struct input_dev *ps_gamepad_create(struct hid_device *hdev,
>         if (IS_ERR(gamepad))
>                 return ERR_CAST(gamepad);
>
> +       /* Set initial resting state for joysticks to 128 (center) */
>         input_set_abs_params(gamepad, ABS_X, 0, 255, 0, 0);
> +       gamepad->absinfo[ABS_X].value = 128;
>         input_set_abs_params(gamepad, ABS_Y, 0, 255, 0, 0);
> +       gamepad->absinfo[ABS_Y].value = 128;
>         input_set_abs_params(gamepad, ABS_Z, 0, 255, 0, 0);
>         input_set_abs_params(gamepad, ABS_RX, 0, 255, 0, 0);
> +       gamepad->absinfo[ABS_RX].value = 128;
>         input_set_abs_params(gamepad, ABS_RY, 0, 255, 0, 0);
> +       gamepad->absinfo[ABS_RY].value = 128;
>         input_set_abs_params(gamepad, ABS_RZ, 0, 255, 0, 0);
>
>         input_set_abs_params(gamepad, ABS_HAT0X, -1, 1, 0, 0);
> --
> 2.51.2.1041.gc1ab5b90ca-goog
>

Hey Jiri,

Do you mind taking a look at this one?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ