From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4B8CF2750E6; Mon, 9 Feb 2026 14:55:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770648954; cv=none; b=aGawM7rNGdjqnDZiXk4PfjGm5Q0pYvY1Vxq8Q6sNcWfu3cvpTOkF/mWOeDr1mYDScgTg+5J3JI20WvfkPX41QSrxdkzpU9E1UEehrlAot5JPZzEmf7DNp546xGCQFwltZqcLgmf/R6w8+kZLpilVAouaNFyz/EDN405Kwn0lDFk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770648954; c=relaxed/simple; bh=9xcwIQoA5RPPoDj7+us9BKQQFz5dx0GqP2fx9jN1yN0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SucYl1qWVRaFDdWZHWBKeysgYHaLXwpNQr/oVpyLD7hVxMQRAOWWmU6GF4vkq5cjuh85QLif3sRjxDDj98ODIPswekM+UvzfFqn60+JwqCGUzeC0VelgX7abmNRTwtSq4FuxrTZmxhULCk4VCuO1qXo6tWRRNiA1ew9H9tOEvaM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=V83xmRkQ; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="V83xmRkQ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 78D7CC116C6; Mon, 9 Feb 2026 14:55:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1770648953; bh=9xcwIQoA5RPPoDj7+us9BKQQFz5dx0GqP2fx9jN1yN0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=V83xmRkQVW9LsuOhFbI/XrOS+2gVoAjQbnDAClWnBagVBs1e/VCKty4FxTfzjo4kC 8HRLqBEF71Bnm2zgq1ijQ8UumFcYdJ+U3vix4toymvLWswUkJlnoms+ohOq8qLcZCj zWen4R2mH5G0M572y6fSPAklsc/83j1gtcAR2md4= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Siarhei Vishniakou , Benjamin Tissoires , Sasha Levin Subject: [PATCH 5.15 31/75] HID: playstation: Center initial joystick axes to prevent spurious events Date: Mon, 9 Feb 2026 15:24:28 +0100 Message-ID: <20260209142302.968275689@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260209142301.830618238@linuxfoundation.org> References: <20260209142301.830618238@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Siarhei Vishniakou [ Upstream commit e9143268d259d98e111a649affa061acb8e13c5b ] 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 Reviewed-by: Benjamin Tissoires Signed-off-by: Benjamin Tissoires Signed-off-by: Sasha Levin --- 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 944e5e5ff1348..69c16c9b8c5c9 100644 --- a/drivers/hid/hid-playstation.c +++ b/drivers/hid/hid-playstation.c @@ -463,11 +463,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.0