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 4786A125B2; Mon, 9 Feb 2026 14:37:26 +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=1770647846; cv=none; b=lPnH7d8ubKtHVfxAm4YNU8SRriYckqnNsBanTJsJZbmNGBdoSqUxSgMg7MkQaKY7F2ILQobwReNma0cFcR+TKuLlkF00ikDikqgK3FtWyZMvFAG741WKI5ay8ddrfadVt86W/FxXX85jF9zfAkSWDD9bjdwAaA+z7By1+RAKdPY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770647846; c=relaxed/simple; bh=qTNYo6dGsWAV3Lkk1EhEcAekzIwy+5Wr9GPiCeceoyU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=NzP8TuIou9OgjWetiHcVz9Uu/n1weGe1+GWnRPzMlaKG7+4+e++vqvIk0yKnAqPgNBI3t+O2koF1FnunqIdL6sF33XwoAb3HJhEIZ+7j//hFEO9CHEFfRUFZmOc1sisVtD9BG1Md7Sh89DbZNABFPlOj+Du9qA3uCWnYYY1keog= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=tiWQTdG1; 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="tiWQTdG1" Received: by smtp.kernel.org (Postfix) with ESMTPSA id BFDDBC116C6; Mon, 9 Feb 2026 14:37:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1770647846; bh=qTNYo6dGsWAV3Lkk1EhEcAekzIwy+5Wr9GPiCeceoyU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tiWQTdG1mS6FkCKiC+PVUjkjCap+GfEZtMDJ73uT6VF9f7NTmc2tMiooXKZrxPOAf mLR/haxGMmVGpWSZn6TfK8rlkRqr4tB4Rc6FfObVo22NPCQdDvXqniw4sxyqZdfTsm 5RLA6cSpgn7U8RsUW7i/Ycqy6xGdn8x0y1JzjZvo= 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 6.12 045/113] HID: playstation: Center initial joystick axes to prevent spurious events Date: Mon, 9 Feb 2026 15:23:14 +0100 Message-ID: <20260209142311.824233485@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260209142310.204833231@linuxfoundation.org> References: <20260209142310.204833231@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 6.12-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 657e9ae1be1ee..71a8d4ec9913b 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.0