diff options
author | Benjamin Tissoires <benjamin.tissoires@redhat.com> | 2018-10-04 08:34:30 -0400 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2018-10-04 15:06:45 -0400 |
commit | d9ca1c990a7ffee7e68ab8d64efacd6c73103203 (patch) | |
tree | a1fb65cdaff9c3e89c80adaf9aa43c36df014ad5 | |
parent | 5fe2ccbef9d7aecf5c4402c753444f1a12096cfd (diff) |
Input: reserve 2 events code because of HID
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_MT_SLOT-1 (ABS_MISC+6) was never assigned a code, and
so libinput can detect fake multitouch devices from genuine ones by
checking if ABS_MT_SLOT-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+6 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 <benjamin.tissoires@redhat.com>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
-rw-r--r-- | include/uapi/linux/input-event-codes.h | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/include/uapi/linux/input-event-codes.h b/include/uapi/linux/input-event-codes.h index dad8d3890a3a..6d180cc60a5d 100644 --- a/include/uapi/linux/input-event-codes.h +++ b/include/uapi/linux/input-event-codes.h | |||
@@ -708,7 +708,15 @@ | |||
708 | #define REL_DIAL 0x07 | 708 | #define REL_DIAL 0x07 |
709 | #define REL_WHEEL 0x08 | 709 | #define REL_WHEEL 0x08 |
710 | #define REL_MISC 0x09 | 710 | #define REL_MISC 0x09 |
711 | #define REL_WHEEL_HI_RES 0x0a | 711 | /* |
712 | * 0x0a is reserved and should not be used in input drivers. | ||
713 | * It was used by HID as REL_MISC+1 and userspace needs to detect if | ||
714 | * the next REL_* event is correct or is just REL_MISC + n. | ||
715 | * We define here REL_RESERVED so userspace can rely on it and detect | ||
716 | * the situation described above. | ||
717 | */ | ||
718 | #define REL_RESERVED 0x0a | ||
719 | #define REL_WHEEL_HI_RES 0x0b | ||
712 | #define REL_MAX 0x0f | 720 | #define REL_MAX 0x0f |
713 | #define REL_CNT (REL_MAX+1) | 721 | #define REL_CNT (REL_MAX+1) |
714 | 722 | ||
@@ -745,6 +753,15 @@ | |||
745 | 753 | ||
746 | #define ABS_MISC 0x28 | 754 | #define ABS_MISC 0x28 |
747 | 755 | ||
756 | /* | ||
757 | * 0x2e is reserved and should not be used in input drivers. | ||
758 | * It was used by HID as ABS_MISC+6 and userspace needs to detect if | ||
759 | * the next ABS_* event is correct or is just ABS_MISC + n. | ||
760 | * We define here ABS_RESERVED so userspace can rely on it and detect | ||
761 | * the situation described above. | ||
762 | */ | ||
763 | #define ABS_RESERVED 0x2e | ||
764 | |||
748 | #define ABS_MT_SLOT 0x2f /* MT slot being modified */ | 765 | #define ABS_MT_SLOT 0x2f /* MT slot being modified */ |
749 | #define ABS_MT_TOUCH_MAJOR 0x30 /* Major axis of touching ellipse */ | 766 | #define ABS_MT_TOUCH_MAJOR 0x30 /* Major axis of touching ellipse */ |
750 | #define ABS_MT_TOUCH_MINOR 0x31 /* Minor axis (omit if circular) */ | 767 | #define ABS_MT_TOUCH_MINOR 0x31 /* Minor axis (omit if circular) */ |