Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp4638473rdb; Tue, 12 Dec 2023 05:32:21 -0800 (PST) X-Google-Smtp-Source: AGHT+IH8tVnjRehXG26PtmYAsZsQcLEoMad2wkV1a19gUTRPTMmx66jlsq4PUib7WsyoiqBY5aBi X-Received: by 2002:a17:902:ea12:b0:1d3:3881:c50f with SMTP id s18-20020a170902ea1200b001d33881c50fmr1146574plg.45.1702387941028; Tue, 12 Dec 2023 05:32:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702387941; cv=none; d=google.com; s=arc-20160816; b=XmSch1GXfDuu6q/lngu3+Ke5tmyu8f0RrnsFlSb1sG+AutgsYUAoT/z11Peq6YDqus m8RKxxXsWw+F2M31se7TzebR+bS4QWQXgApsNtSbZO8tWQfvLBlG1HWUf4ztPSBV7Vla xK1GXReLWGbhOEu6GXLBTYX/spIimuRry9eFnw/8j4u165UMDIfNDjQ7H6R2F2KmReVA ImvcjhEFf84zoAzydNVVVidkPsF/HmA/G6tsTVtcVqVImz1GuK8AfasDYyNv5sZyEsYt XJbzGYA5WPD/JSAMh/2iyCeLKn+BHVhgJx5pVtwpDNuZrJ+wm3UnELvHxSHdjSQY5UJj 423g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=PXAhQZ0roT0HhZ8FiISTuzSlJjQHAHO6VIdmzHaVr70=; fh=KqTYi6CxWwi+D30Ou5+kwmcQ87kZ78nNrdqvK9IcrVI=; b=dUSuMbs0Z9Hw74UfW5oz6NxLJxdMrXVtMV6ewZgz1vlTpu9x4x4wOcX9GxwpYPty3F CC91d2Re6rC75luALjU1QZ8RJIlRN6gwPI/HQioSGjgVntjHkuRqCv08Sno6gtE4uN5C 5DdhOjIGebTBE0NflcjwYuoTfyApQsFd/p9DucgT2ZycWH4wac4Gqsab1novl4ANXxUX dbOv6vJjZT9gTsAkWJEFiFeL6DOVxem57PxiaiuvJGqMY9KfIfJi9tyr4Z8sSyMnOcvr XeRIkt+3K3rh2cWoGo8lgGBr7NVN8GASY8exLK6SOOy9FDdukNNegw2s9/LfnysTJHeW zWzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@khvoinitsky.org header.s=key1 header.b=rInq+Ktz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=khvoinitsky.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id i18-20020a17090332d200b001bb8c4279f5si7999273plr.148.2023.12.12.05.32.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 05:32:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@khvoinitsky.org header.s=key1 header.b=rInq+Ktz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=khvoinitsky.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 268D18051AAE; Tue, 12 Dec 2023 05:32:16 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346519AbjLLNb4 (ORCPT + 99 others); Tue, 12 Dec 2023 08:31:56 -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: 8bit X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Tue, 12 Dec 2023 05:32:16 -0800 (PST) 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=2135468#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 == 1 && + if (hdev->product == USB_DEVICE_ID_LENOVO_CUSBKBD && + cptkbd_data->middlebutton_state == 1 && usage->type == EV_REL && (usage->code == REL_X || usage->code == REL_Y)) { cptkbd_data->middlebutton_state = 3; -- 2.43.0