Received: by 2002:a05:6520:4211:b029:f4:110d:56bc with SMTP id o17csp1622985lkv; Wed, 19 May 2021 14:17:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyiWtiUAWYLd2ZJa4XpghlH9NqiQVUSipm0fwW5rQDGK6vNIZmtEKsTXfwd7GcZ6znX8ExR X-Received: by 2002:a6b:c913:: with SMTP id z19mr1771381iof.42.1621459073765; Wed, 19 May 2021 14:17:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621459073; cv=none; d=google.com; s=arc-20160816; b=IkRGMEMuSm5PXaBNgmZf+u4jpFf4KyItNKQoIt3PGY4kuwTTJCdebfr8OJZosia54Y maSgohwkS3AuWkGgZu+Ki3HVNBpLPMBtjs/ASWXWtyohKRbA8Zpn8ztQBWWdyL/kxMq0 5OCu30JxVMjC0c8QaDW3LjLK7E06SBE0SdHgKMUQOYJ0PxL45d0G58UwQW3vxOyNCHkH b+eDYMt1LWEzZSy35HZphm5dzUAfMOI1ybygZWFVychXWJSpZARnERKod5p+OkI3XQ+I oL9E6iG6xKd1stg4Hj3qTuRjvFjQdDl5CsSaBp/CscljcS0LjNsv631fHWkB09ctvF7x b+Vw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:jabber-id:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:dkim-signature:date; bh=wsJtrVxTXFRtZq0+OHqaKeKww8kG9sL+EsjWa10gomg=; b=BH3Z1stU0l2TuBAch7XgkrvhPYpmkAc70SRuFJzGloY7ePVu8I+H1PXkni1MwEgOHr XJLBuC454QTpFsx2Rb0wKBylTunVTWGF4hMi9sRB/PGYuuo2W3nmioInfH3GEqw7Z/C8 BP//hDmPXkrbM5sArZPQNgg+l51HV3EZBefdl9GbTVn2rRG8lMXLwAeklRMRLmSMwNu7 iWYvv8tXk6VjKgTGGH7vHIXDQaYZwYilTnrJimeLZV5E2YJ4r8CErPoQ0Kgaruw363tu CWPkkLU3kF+L1VKMbaMEi/WG162dNU3g15csP7LpLjIR9q8wGv1GOlHcjY/9UVl4rkpA BFdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@weissschuh.net header.s=mail header.b=I70ea2iI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v3si847013ilq.36.2021.05.19.14.17.41; Wed, 19 May 2021 14:17:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@weissschuh.net header.s=mail header.b=I70ea2iI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355563AbhESRMi (ORCPT + 99 others); Wed, 19 May 2021 13:12:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50636 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355490AbhESRMi (ORCPT ); Wed, 19 May 2021 13:12:38 -0400 X-Greylist: delayed 4027 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Wed, 19 May 2021 10:11:18 PDT Received: from todd.t-8ch.de (todd.t-8ch.de [IPv6:2a01:4f8:c010:41de::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E8E6C06175F; Wed, 19 May 2021 10:11:18 -0700 (PDT) Date: Wed, 19 May 2021 19:11:15 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=weissschuh.net; s=mail; t=1621444276; bh=UW5EOnJw1PTdktYiMLckFFhJRIzlnxs9XcpFpPI3ktQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=I70ea2iIFQR6y8mdJtX8EYqdIqoytiucbbzylNfGNyMyy/xrPuE8+fqJwf7187TYO eyUegLWCtIS4w+yGm950v5ViWoX9oMme0/C5R6zGZpmys7i1p6FFAOxLO/v2Bu7QVO iQzw+vgWWBtusLm/iF7E+1D3xT8BVGERQWH+qhdI= From: Thomas =?utf-8?Q?Wei=C3=9Fschuh?= To: Hans de Goede Cc: linux-input@vger.kernel.org, Jiri Kosina , Benjamin Tissoires , linux-kernel@vger.kernel.org Subject: Re: [PATCH] HID: input: Add support for Programmable Buttons Message-ID: <2acfc492-a8a9-4159-be49-dc4dc5d1614a@t-8ch.de> References: <61dcf8c7-2dcb-4173-fbbd-9adf3412edb7@redhat.com> <20210519160349.609690-1-linux@weissschuh.net> <2dc197eb-a222-8af6-f0ab-f722e4f492ca@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <2dc197eb-a222-8af6-f0ab-f722e4f492ca@redhat.com> Jabber-ID: thomas@t-8ch.de X-Accept: text/plain, text/html;q=0.2, text/*;q=0.1 X-Accept-Language: en-us, en;q=0.8, de-de;q=0.7, de;q=0.6 X-PGP-Key: https://t-8ch.de/pubkey.asc X-PGP-Key-Fingerprint: 187EF7CE Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On Mi, 2021-05-19T18:13+0200, Hans de Goede wrote: > Hi, > > On 5/19/21 6:03 PM, Thomas Weißschuh wrote: > > From: Thomas Weißschuh > > > > Map them to KEY_MACRO# event codes. > > > > These buttons are defined by HID as follows: > > "The user defines the function of these buttons to control software > > applications or GUI objects." > > > > This matches the semantics of the KEY_MACRO# input event codes that > > Linux supports. > > > > Signed-off-by: Thomas Weißschuh > > --- > > drivers/hid/hid-debug.c | 11 +++++++++++ > > drivers/hid/hid-input.c | 1 + > > 2 files changed, 12 insertions(+) > > > > diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c > > index 18f5e28d475c..7d4dee58d869 100644 > > --- a/drivers/hid/hid-input.c > > +++ b/drivers/hid/hid-input.c > > @@ -632,6 +632,7 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel > > else > > code += BTN_TRIGGER_HAPPY - 0x10; > > break; > > + case HID_CP_CONSUMER_CONTROL: code += KEY_MACRO1; break; > > Shouldn't there be a check here to ensure that we don't map things above KEY_MACRO30 ? > if we do that then we start hitting other codes like KEY_MACRO_RECORD_START and eventually > BTN_TRIGGER_HAPPY and after the BTN_TRIGGER_HAPPY range we go over KEY_MAX which I think > is not supported ? > > Regards, > > Hans I thought all the other chunks of logic around this one would be affected by this issue, too. But actually it seems all the overflowing keys get first assigned to the BTN_TRIGGER_HAPPY range and after that will be clipped directly by map_key()/hid_map_usage(). I'll resend the patch. Thanks, Thomas