Received: by 2002:ab2:3350:0:b0:1f4:6588:b3a7 with SMTP id o16csp1400399lqe; Mon, 8 Apr 2024 07:56:43 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUMvkKhIStIOIfUpFyPJSGy0MYppph8PTP2DlQlAc2JxpvJBxp05A4UZsfYOTALb9dE/T1zmYIN9fAwWRs/U2v7Zs1C1YmDzwofGulVVA== X-Google-Smtp-Source: AGHT+IEJd4iULmk/2ItcxFbKyTxhV3bRH8zMsSp4FYoUj3yvGztzA58rZLzLdK0p1d4FmrmwPKQD X-Received: by 2002:a17:902:f691:b0:1e4:31e9:83ba with SMTP id l17-20020a170902f69100b001e431e983bamr2759721plg.1.1712588203236; Mon, 08 Apr 2024 07:56:43 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712588203; cv=pass; d=google.com; s=arc-20160816; b=Rl7Minh4Sdh6anjoONpPRtHdNOiTZApHwFv0pdCNQuCty2qnnLnCzxCz7Gr+lq2CXN XNswNeIcQWeoPP2Pz4awei/dZ3SOT69dCqGgs7p6Pz46NkOfSIweoy29iRq7WUEPnQtK AUzWANN3znKfcomBXrS91mCfuJ/8eSsO1sGrZy94PdSYeTuYOksar3Ca4loIs9kPTUrk KviR5LdH11lCQbeBsMvvxBIrdqWzT0hjFa8BIrzQyzKrvvSuAo38lr0QZfAprTqPAlp7 94U5yLGuPlsj4h6nr7OplG9NGncuZNBAZF57XRBXasM0COswngOHwfpK9ePORRNFBX6R TyBA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=subject:cc:to:from:date:references:in-reply-to:message-id :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :user-agent:feedback-id:dkim-signature:dkim-signature; bh=bCWpPGV2vJYgZ3bq3vRrz3FGsmLszaLN5U7PO44bhCI=; fh=M1XVZd7eWHk/0MnNkPLuusM1F0pgXhMXW0L3qj4IcTw=; b=D3tQ4BR0lyOllQvBrxvWDGxKWgv59sKn/uTTuIODVQDKGn0oMybuSD9UfgbftvsY3n noHyohWLyc6D1pcGGS/sSV/W1bak7CviYestn1R2WErmgWT7RAmKayRc5WwUm44I747B vP6+Lz1I6O0cQnDzD8+OALeGNEOAbcdmJ9MolW72L7JDt6Z9MbxXrISUNq1Bhupjwg9j 44cpWEeApsRXE7xYCXcN2K5OhWus7agMBTQLEgyMn2pkHx74bMcbOXjMsJjLR2WNMuC4 TisVIiM9+apI4iSE6h+txDVivV9hZ1O5MPq4YbJ/jWkixgERJBxuMzFPFxyki9lFxCZK 4Kyg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@squebb.ca header.s=fm3 header.b=DLNhd8JY; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=e1TuCh66; arc=pass (i=1 spf=pass spfdomain=squebb.ca dkim=pass dkdomain=squebb.ca dkim=pass dkdomain=messagingengine.com); spf=pass (google.com: domain of linux-kernel+bounces-135563-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-135563-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id w15-20020a1709026f0f00b001e0abb2c775si6233335plk.474.2024.04.08.07.56.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Apr 2024 07:56:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-135563-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@squebb.ca header.s=fm3 header.b=DLNhd8JY; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=e1TuCh66; arc=pass (i=1 spf=pass spfdomain=squebb.ca dkim=pass dkdomain=squebb.ca dkim=pass dkdomain=messagingengine.com); spf=pass (google.com: domain of linux-kernel+bounces-135563-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-135563-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id DC050284A80 for ; Mon, 8 Apr 2024 14:56:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3F11B13F433; Mon, 8 Apr 2024 14:56:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=squebb.ca header.i=@squebb.ca header.b="DLNhd8JY"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="e1TuCh66" Received: from wfout4-smtp.messagingengine.com (wfout4-smtp.messagingengine.com [64.147.123.147]) (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 303F913F422; Mon, 8 Apr 2024 14:56:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=64.147.123.147 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712588187; cv=none; b=p9XGO6+lmmBkY8Zn/LWDDvE07Z51V2avQFEvEuYz21uPLph4xU/SCgaebFV34pvLTqtXHHKC1CjrT2ymgkvj4aG6XBxG6RmObHT6l4pADqhVmkUGgi0NxwPvPNZ/Dz12Mf9fBcDZXlr4qChBvano+8R5Ptqp15r39EaNumQSSxc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712588187; c=relaxed/simple; bh=uvf6TFwCLvpcgJnWKp+IqUvyxTwUo7A7wcFLgOftIvw=; h=MIME-Version:Message-Id:In-Reply-To:References:Date:From:To:Cc: Subject:Content-Type; b=ZOmtyNPLaxX2iTtMmntGfKfgzUWQ7j+rVIeK++hhXRkN2S5HIRpgGag+IJEj3fMTYvM2lSEPGHqpkcVbdDa9TvKjRzh9SYTlvODlBIWD4353okgHNeMoMP2I9EKulvrzvnQTmURQgCIlJ25ix6S71zxD1COEde+rFEoHo+cM08c= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=squebb.ca; spf=pass smtp.mailfrom=squebb.ca; dkim=pass (2048-bit key) header.d=squebb.ca header.i=@squebb.ca header.b=DLNhd8JY; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=e1TuCh66; arc=none smtp.client-ip=64.147.123.147 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=squebb.ca Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=squebb.ca Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailfout.west.internal (Postfix) with ESMTP id 52A501C000E1; Mon, 8 Apr 2024 10:56:23 -0400 (EDT) Received: from imap52 ([10.202.2.102]) by compute3.internal (MEProxy); Mon, 08 Apr 2024 10:56:24 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=squebb.ca; h=cc :cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm3; t=1712588182; x=1712674582; bh=bCWpPGV2vJ YgZ3bq3vRrz3FGsmLszaLN5U7PO44bhCI=; b=DLNhd8JYzB3+bRSSRNyvtjPFZy 7L2UummJ5c8SIg2vWVcF0DproH/wJmUPOz5bxXuGmNRLTYg07aW/mz74NUETTc2s wq9ke0TuZ6bFEmSBo1SJLRTqjDCzFmxXcsiAEtMKaCnupJxED31XGQIkcQ1zRJeC pgOuePuOOMoyic2bLNXVJs0Su3sUr2o00W2A0UikZEYaY59lLprY6UCTP1/q41q4 Y2IH8c/up11UvgRXPJmM4dXOEgWXvt3DETcd6I6x/y9lBppZKGsW48nrvZb9oRLE ahoKHsUbeSXJUzJRE8f5ieD0cKntYppt4lc4P/XNAA0w/8giBM3p6il2FWGw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; t=1712588182; x=1712674582; bh=bCWpPGV2vJYgZ3bq3vRrz3FGsmLs zaLN5U7PO44bhCI=; b=e1TuCh66ExaTJ5mMSci9uxjBSdh8YePTAdXxa/KFBQ+V wokLBtcCDb7TS30pwZMlMortskyCCUf3olQ6ENpBwfU990rVgEDfqREBFyTs9Dnn IjeeFZ2LVxZZFalnT58rGH08SZaJpich7pyBa8AlB5BBXNg90gYaXqoNBvp6I45I Xy2WZpOE+vy5n7M/QVUF8NJJvFsk0YxA1WzGx4YYOoYyGpVBswnwdwWBKpXbRZKk 7i5SBIH5z6KVCN0pcOr0zZ1Jb5l7pGfD21tFWlc1PkgznQ5UWtGA5xp8ldxqm+QT +xuxax0Ai3CJ8xX7nYGDThJzJYNYTMilpjcTjVf5yQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrudegiedgkedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvfevufgtsehttdertderredtnecuhfhrohhmpedfofgr rhhkucfrvggrrhhsohhnfdcuoehmphgvrghrshhonhdqlhgvnhhovhhosehsqhhuvggssg drtggrqeenucggtffrrghtthgvrhhnpeeiueefjeeiveetuddvkeetfeeltdevffevudeh ffefjedufedvieejgedugeekhfenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmh epmhgrihhlfhhrohhmpehmphgvrghrshhonhdqlhgvnhhovhhosehsqhhuvggssgdrtggr X-ME-Proxy: Feedback-ID: ibe194615:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 251DFC60097; Mon, 8 Apr 2024 10:56:22 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.11.0-alpha0-368-gc733b1d8df-fm-20240402.001-gc733b1d8 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: In-Reply-To: References: <20240324210817.192033-1-mpearson-lenovo@squebb.ca> <20240324210817.192033-3-mpearson-lenovo@squebb.ca> Date: Mon, 08 Apr 2024 10:56:25 -0400 From: "Mark Pearson" To: "Hans de Goede" Cc: dmitry.torokhov@gmail.com, linux-kernel@vger.kernel.org, "platform-driver-x86@vger.kernel.org" , "Vishnu Sankar" , ibm-acpi-devel@lists.sourceforge.net, "Henrique de Moraes Holschuh" , linux-input@vger.kernel.org, =?UTF-8?Q?Ilpo_J=C3=A4rvinen?= , "Peter Hutterer" , "Nitin Joshi1" Subject: Re: [ibm-acpi-devel] [PATCH 2/4] platform/x86: thinkpad_acpi: Support for trackpoint doubletap Content-Type: text/plain Hi Hans, Many thanks for the review. On Mon, Apr 8, 2024, at 9:04 AM, Hans de Goede wrote: > Hi Mark, > > On 3/24/24 10:07 PM, Mark Pearson wrote: >> Lenovo trackpoints are adding the ability to generate a doubletap event. >> This handles the doubletap event and sends the KEY_DOUBLECLICK event to >> userspace. >> >> Signed-off-by: Mark Pearson >> Signed-off-by: Vishnu Sankar >> --- >> drivers/platform/x86/thinkpad_acpi.c | 17 +++++++++++++++++ >> 1 file changed, 17 insertions(+) >> >> diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c >> index 82429e59999d..2bbb32c898e9 100644 >> --- a/drivers/platform/x86/thinkpad_acpi.c >> +++ b/drivers/platform/x86/thinkpad_acpi.c >> @@ -232,6 +232,7 @@ enum tpacpi_hkey_event_t { >> >> /* Misc */ >> TP_HKEY_EV_RFKILL_CHANGED = 0x7000, /* rfkill switch changed */ >> + TP_HKEY_EV_TRACKPOINT_DOUBLETAP = 0x8036, /* doubletap on Trackpoint*/ >> }; >> >> /**************************************************************************** >> @@ -4081,6 +4082,22 @@ static void hotkey_notify(struct ibm_struct *ibm, u32 event) >> break; >> } >> fallthrough; /* to default */ > > This now no longer fallsthrough to default. IMHO the best thing to do > here is add a new preparation patch which initializes known_ev to false > inside the while before the switch-case (together with the send_acpi_ev > and ignore_acpi_ev init). and then change this fallthrough to a break > in the preparation patch. You can then also remove the default case > altogether in this prep patch. > Ack - that makes sense. I'll look at doing that. >> + case 8: >> + /* 0x8036: Trackpoint doubletaps */ >> + if (hkey == TP_HKEY_EV_TRACKPOINT_DOUBLETAP) { >> + send_acpi_ev = true; >> + ignore_acpi_ev = false; > > These 2 values are set as the default above the switch-case, please > drop these 2 lines. Agreed. Will change. > >> + known_ev = true; >> + /* Send to user space */ >> + mutex_lock(&tpacpi_inputdev_send_mutex); >> + input_report_key(tpacpi_inputdev, KEY_DOUBLECLICK, 1); >> + input_sync(tpacpi_inputdev); >> + input_report_key(tpacpi_inputdev, KEY_DOUBLECLICK, 0); >> + input_sync(tpacpi_inputdev); >> + mutex_unlock(&tpacpi_inputdev_send_mutex); > > This code duplicates tpacpi_input_send_key(), what you want to do here > is define a hotkey_keycode_map scancode range for new 0x8xxx codes like how this > was done when extended scancodes where added to deal with the new 0x13xx hotkey > event codes for the 2017+ models. > > See commit 696c6523ec8f ("platform/x86: thinkpad_acpi: add mapping for > new hotkeys") > > Despite re-using tpacpi_input_send_key() there are 2 reasons why we want > scancodes for these new "keys". > > 1. By adding the keys to the hotkey_keycode_map they automatically > also get input_set_capability(tpacpi_inputdev, EV_KEY, hotkey_keycode_map[i]); > called on them advertising to userspace that tpacpi_inputdev can actually > generate these keypresses. Something which is currently lacking from your > patch. Related to this did you test this with evtest? I think that the input > core will suppress the events when you do not set the capability ? > > 2. This allows remapping scancodes to different KEY_foo values with hwdb > entries. > Will look into doing this. There was a reason originally I did it like this, but I can't remember what it was. I'll revisit it. I did test with evtest but I ended up having to cheat as there's quite a few layers in userspace and I got a bit bogged down chewing my way through those (building them against the right headers etc). I ended up using an already existing code to make sure it was doing the right thing in the driver - and then assumed that once the keycode was 'released', and the different user space projects updated per normal procedure, it would work. It's possible it meant I bypassed/missed this issue so I'll retry once I've made the updates. Mark