From nobody Sun Dec 28 04:40:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ABA27C4332F for ; Tue, 12 Dec 2023 13:32:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346516AbjLLNb6 (ORCPT ); Tue, 12 Dec 2023 08:31:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46646 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346514AbjLLNbw (ORCPT ); Tue, 12 Dec 2023 08:31:52 -0500 Received: from out-173.mta1.migadu.com (out-173.mta1.migadu.com [95.215.58.173]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5CB5811A for ; Tue, 12 Dec 2023 05:31:54 -0800 (PST) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=khvoinitsky.org; s=key1; t=1702387912; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PXAhQZ0roT0HhZ8FiISTuzSlJjQHAHO6VIdmzHaVr70=; b=rInq+KtzNwrnM3BEJr2zWfuKzXTIftzXOconMaB73TgGqogIhWMZ+CGyzQpcyJn8qgfH9m ynGym7jiaCzxfgcN2JlKHp+DGEcjsZjmuM3Uga5gGaQeHCzr2W3cz1GnvSH7J4J5cgUayU S3Mx9Qtml32rmhAkkJh+RjruIdxAHJY= From: Mikhail Khvainitski To: jikos@kernel.org, benjamin.tissoires@redhat.com Cc: me@khvoinitsky.org, iam@valdikss.org.ru, jekhor@gmail.com, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] HID: lenovo: Restrict detection of patched firmware only to USB cptkbd Date: Tue, 12 Dec 2023 15:31:48 +0200 Message-ID: <20231212133148.1000761-1-me@khvoinitsky.org> In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Commit 46a0a2c96f0f ("HID: lenovo: Detect quirk-free fw on cptkbd and stop applying workaround") introduced a regression for ThinkPad TrackPoint Keyboard II which has similar quirks to cptkbd (so it uses the same workarounds) but slightly different so that there are false-positives during detecting well-behaving firmware. This commit restricts detecting well-behaving firmware to the only model which known to have one and have stable enough quirks to not cause false-positives. Fixes: 46a0a2c96f0f ("HID: lenovo: Detect quirk-free fw on cptkbd and stop = applying workaround") Link: https://lore.kernel.org/linux-input/ZXRiiPsBKNasioqH@jekhomev/ Link: https://bbs.archlinux.org/viewtopic.php?pid=3D2135468#p2135468 Signed-off-by: Mikhail Khvainitski Tested-by: Yauhen Kharuzhy --- drivers/hid/hid-lenovo.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/hid/hid-lenovo.c b/drivers/hid/hid-lenovo.c index 7c1b33be9d13..149a3c74346b 100644 --- a/drivers/hid/hid-lenovo.c +++ b/drivers/hid/hid-lenovo.c @@ -692,7 +692,8 @@ static int lenovo_event_cptkbd(struct hid_device *hdev, * so set middlebutton_state to 3 * to never apply workaround anymore */ - if (cptkbd_data->middlebutton_state =3D=3D 1 && + if (hdev->product =3D=3D USB_DEVICE_ID_LENOVO_CUSBKBD && + cptkbd_data->middlebutton_state =3D=3D 1 && usage->type =3D=3D EV_REL && (usage->code =3D=3D REL_X || usage->code =3D=3D REL_Y)) { cptkbd_data->middlebutton_state =3D 3; --=20 2.43.0