HID_QUIRK_INVERT is kind of complex to deal with and was bogus.
Furthermore, it didn't make sense to use a global per struct hid_device
quirk for something dynamic as the current state.
Store the current tool information in the report itself, and re-order
the processing of the fields to enforce having all the tablet "state"
fields before getting to In Range and other input fields.
This way, we now have all the information whether a tool is present
or not while processing In Range.
This new behavior enforces that only one tool gets forwarded to userspace
at the same time, and that if either eraser or invert is set, we enforce
BTN_TOOL_RUBBER.
Note that the release of the previous tool now happens in its own EV_SYN
report so userspace doesn't get confused by having 2 tools.
These changes are tested in the following hid-tools regression tests:
https://gitlab.freedesktop.org/libevdev/hid-tools/-/merge_requests/127
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Reviewed-by: Ping Cheng <ping.cheng@wacom.com> Acked-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Jiri Kosina <jkosina@suse.cz>