Hi, this is the v2 of my series which reworks the HID report processing. I took Ping's comments into account, and amended my MR with the regression tests[0]. More specifically, the tests (and thus this new version of the series) enforces that only one BTN_TOOL_* event gets forwarded between each EV_SYN frame, and that BTN_TOUCH are properly translated too. This also magivally solved some worrying transitions we had in the pen state machine where the pen was jumping from "eraser" to "in contact". This new behavior enforces a "out-of-range" state in the middle, making it easier for userspace to understand now. Again, tests are welcome :) Cheers, Benjamin [0] https://gitlab.freedesktop.org/libevdev/hid-tools/-/merge_requests/127 Benjamin Tissoires (12): HID: core: statically allocate read buffers HID: core: de-duplicate some code in hid_input_field() HID: core: split data fetching from processing in hid_input_field() HID: input: tag touchscreens as such if the physical is not there HID: input: rework spaghetti code with switch statements HID: input: move up out-of-range processing of input values HID: compute an ordered list of input fields to process HID: core: for input reports, process the usages by priority list HID: input: enforce Invert usage to be processed before InRange HID: input: remove the need for HID_QUIRK_INVERT HID: input: accommodate priorities for slotted devices Input: docs: add more details on the use of BTN_TOOL Documentation/input/event-codes.rst | 6 +- drivers/hid/hid-core.c | 280 ++++++++++++++++++--- drivers/hid/hid-input.c | 364 ++++++++++++++++++++++------ include/linux/hid.h | 23 +- 4 files changed, 568 insertions(+), 105 deletions(-) -- 2.33.1