Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1538339imm; Fri, 7 Sep 2018 01:52:46 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbmtnQKWoTxA5TnEbkimSWF0jBnV+GQLx0nIl16aNZBQHhJHuPdt9wYi0+7pInCEVyiJmQn X-Received: by 2002:a63:7d48:: with SMTP id m8-v6mr7248507pgn.0.1536310366504; Fri, 07 Sep 2018 01:52:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536310366; cv=none; d=google.com; s=arc-20160816; b=dkkMvdbBInH4URv9H4YDGMX9oJli5ScWeAnf6YzbbkG6g5fpguHTsB40V+kA1R+FT3 Tp6KmYk12qPmEsDsCVswK27iq1P8oeFiYV+HNAZcXolaCQmmZM8cgWumndCFD7kjr4j1 QNOR5sVXYgdJb/WQK8aM0z0nvHwnHJORToMPHO1ebjcXX0MQmCw8zjzLXqcvNpbjEZit A2upaK1r4AdrRZLBC5EpEcta7BuXdXPr8jDA6Lf+bLyB3ZEmGk1550eGqxbDza9V6WbM B9U6Djr8vo6BpWMbFMFF8WxFBr0obwFOfRYJ8P2kJPLv+RDupqaB+ef7M+Gd+VOtYZsD MGsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=UEfTAWlDq56lEousTgC7Fbq56KvbHPzC3fwK3kkm3QM=; b=KD85NwsiLjAxdJ/3bhy8Si7EDPtljnFatxzwr4is6egok4Iz2UkUU+5RT86XGNezee 5wenVGp82hgKKDZXDr7a2d9e+y6u7avjlJPwCMYRX3qMJPjgzNJzv8QI1GnNjcvohvKS sXeim0ROlpSw82JZZrrCF3WpcbkrvDtvxM/olUcIH9zr2kmSJtG0JWg2zsSskyAbkjNZ eXEgJZ6e3NQV5OecHZjroW8GFKh95idJO9N9b5CIQMGyagS59D8v/3cJzl0EDUbtBZMU aMtAuT0TwQHRI+YMSifJGH9BiIov2p7Biun/erC7OICsDGmyYhUEGtNjLosFQFAE0nC5 iXSA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g5-v6si7363087plp.280.2018.09.07.01.52.30; Fri, 07 Sep 2018 01:52:46 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727679AbeIGNbS (ORCPT + 99 others); Fri, 7 Sep 2018 09:31:18 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:58180 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726594AbeIGNbS (ORCPT ); Fri, 7 Sep 2018 09:31:18 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5C6598010FDF; Fri, 7 Sep 2018 08:51:21 +0000 (UTC) Received: from plouf.redhat.com (ovpn-116-25.ams2.redhat.com [10.36.116.25]) by smtp.corp.redhat.com (Postfix) with ESMTP id E884B2156889; Fri, 7 Sep 2018 08:51:17 +0000 (UTC) From: Benjamin Tissoires To: Dmitry Torokhov , Jiri Kosina , Harry Cutts , Peter Hutterer Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Benjamin Tissoires Subject: [PATCH] Input: reserve 2 events code because of HID Date: Fri, 7 Sep 2018 10:51:15 +0200 Message-Id: <20180907085115.30242-1-benjamin.tissoires@gmail.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Fri, 07 Sep 2018 08:51:21 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Fri, 07 Sep 2018 08:51:21 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'benjamin.tissoires@gmail.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Benjamin Tissoires Prior to commit 190d7f02ce8e ("HID: input: do not increment usages when a duplicate is found") from the v4.18 kernel, HID used to shift the event codes if a duplicate usage was found. This ended up in a situation where a device would export a ton of ABS_MISC+n event codes, or a ton of REL_MISC+n event codes. This is now fixed, however userspace needs to detect those situation. Fortunately, ABS_MISC+1 was never assigned a code, and so libinput can detect fake multitouch devices from genuine ones by checking is ABS_MISC+1 is set. Now that we have REL_WHEEL_HI_RES, libinput won't be able to differentiate true high res mice from some other device in a pre-v4.18 kernel. Set in stone that the ABS_MISC+1 and REL_MISC+1 are reserved and should not be used so userspace can properly work around those old kernels. Signed-off-by: Benjamin Tissoires --- Hi, while reviewing my local tree, I realize that we might want to be able to differentiate older kernels from new ones that export REL_WHEEL_HI_RES. I know Dmitry was against adding several REL_MISC, so I hope just moving REL_WHEEL_HI_RES by one and reserving the faulty event codes would be good this time. This patch applies on top of the branch for-4.20/logitech-highres from Jiri's tree. It should go through Jiri's tree as well. Cheers, Benjamin include/uapi/linux/input-event-codes.h | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/include/uapi/linux/input-event-codes.h b/include/uapi/linux/input-event-codes.h index 29fb891ea337..30149939249a 100644 --- a/include/uapi/linux/input-event-codes.h +++ b/include/uapi/linux/input-event-codes.h @@ -708,7 +708,12 @@ #define REL_DIAL 0x07 #define REL_WHEEL 0x08 #define REL_MISC 0x09 -#define REL_WHEEL_HI_RES 0x0a +/* + * 0x0a is reserved and should not be used. + * It was used by HID as REL_MISC+1 and usersapce needs to detect if + * the next REL_* event is correct or is just REL_MISC + n. + */ +#define REL_WHEEL_HI_RES 0x0b #define REL_MAX 0x0f #define REL_CNT (REL_MAX+1) @@ -745,6 +750,12 @@ #define ABS_MISC 0x28 +/* + * 0x29 is reserved and should not be used. + * It was used by HID as ABS_MISC+1 and usersapce needs to detect if + * the next ABS_* event is correct or is just ABS_MISC + n. + */ + #define ABS_MT_SLOT 0x2f /* MT slot being modified */ #define ABS_MT_TOUCH_MAJOR 0x30 /* Major axis of touching ellipse */ #define ABS_MT_TOUCH_MINOR 0x31 /* Minor axis (omit if circular) */ -- 2.14.3