Benjamin Tissoires
da2c1b8610
selftests/hid: fix failing tablet button tests
...
An overlook from commit 74452d6329 ("selftests/hid: tablets: add
variants of states with buttons"), where I don't use the Enum...
Fixes: 74452d6329 ("selftests/hid: tablets: add variants of states with buttons")
Acked-by: Jiri Kosina <jkosina@suse.com >
Link: https://lore.kernel.org/r/20231207-b4-wip-selftests-v1-1-c4e13fe04a70@kernel.org
Signed-off-by: Benjamin Tissoires <bentiss@kernel.org >
2023-12-07 14:55:00 +01:00
Benjamin Tissoires
ed5bc56ced
selftests/hid: fix mypy complains
...
No code change, only typing information added/ignored
Acked-by: Jiri Kosina <jkosina@suse.com >
Link: https://lore.kernel.org/r/20231206-wip-selftests-v2-14-c0350c2f5986@kernel.org
Signed-off-by: Benjamin Tissoires <bentiss@kernel.org >
2023-12-07 09:52:04 +01:00
Benjamin Tissoires
ab9b82909e
selftests/hid: tablets: be stricter for some transitions
...
To accommodate for legacy devices, we rely on the last state of a
transition to be valid:
for example when we test PEN_IS_OUT_OF_RANGE to PEN_IS_IN_CONTACT,
any "normal" device that reports an InRange bit would insert a
PEN_IS_IN_RANGE state between the 2.
This is of course valid, but this solution prevents to detect false
releases emitted by some firmware:
when pressing an "eraser mode" button, they might send an extra
PEN_IS_OUT_OF_RANGE that we may want to filter.
So define 2 sets of transitions: one that is the ideal behavior, and
one that is OK, it won't break user space, but we have serious doubts
if we are doing the right thing. And depending on the test, either
ask only for valid transitions, or tolerate weird ones.
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net >
Acked-by: Jiri Kosina <jkosina@suse.com >
Link: https://lore.kernel.org/r/20231206-wip-selftests-v2-13-c0350c2f5986@kernel.org
Signed-off-by: Benjamin Tissoires <bentiss@kernel.org >
2023-12-07 09:52:04 +01:00
Benjamin Tissoires
76df1f72fb
selftests/hid: tablets: add a secondary barrel switch test
...
Some tablets report 2 barrel switches. We better test those too.
Use the same transistions description from the primary button tests.
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net >
Acked-by: Jiri Kosina <jkosina@suse.com >
Link: https://lore.kernel.org/r/20231206-wip-selftests-v2-12-c0350c2f5986@kernel.org
Signed-off-by: Benjamin Tissoires <bentiss@kernel.org >
2023-12-07 09:52:04 +01:00
Benjamin Tissoires
1f01537ef1
selftests/hid: tablets: convert the primary button tests
...
We get more descriptive in what we are doing, and also get more
information of what is actually being tested. Instead of having a non
exhaustive button changes that are semi-randomly done, we can describe
all the states we want to test.
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net >
Acked-by: Jiri Kosina <jkosina@suse.com >
Link: https://lore.kernel.org/r/20231206-wip-selftests-v2-11-c0350c2f5986@kernel.org
Signed-off-by: Benjamin Tissoires <bentiss@kernel.org >
2023-12-07 09:52:04 +01:00
Benjamin Tissoires
74452d6329
selftests/hid: tablets: add variants of states with buttons
...
Turns out that there are transitions that are unlikely to happen:
for example, having both the tip switch and a button being changed
at the same time (in the same report) would require either a very talented
and precise user or a very bad hardware with a very low sampling rate.
So instead of manually building the button test by hand and forgetting
about some cases, let's reuse the state machine and transitions we have.
This patch only adds the states and the valid transitions. The actual
tests will be replaced later.
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net >
Acked-by: Jiri Kosina <jkosina@suse.com >
Link: https://lore.kernel.org/r/20231206-wip-selftests-v2-10-c0350c2f5986@kernel.org
Signed-off-by: Benjamin Tissoires <bentiss@kernel.org >
2023-12-07 09:52:04 +01:00
Benjamin Tissoires
83912f83fa
selftests/hid: tablets: define the elements of PenState
...
This introduces a little bit more readability by not using the raw values
but a dedicated Enum
Acked-by: Jiri Kosina <jkosina@suse.com >
Link: https://lore.kernel.org/r/20231206-wip-selftests-v2-9-c0350c2f5986@kernel.org
Signed-off-by: Benjamin Tissoires <bentiss@kernel.org >
2023-12-07 09:52:04 +01:00
Benjamin Tissoires
e08e493ff9
selftests/hid: tablets: set initial data for tilt/twist
...
Avoids getting a null event when these usages are set
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net >
Acked-by: Jiri Kosina <jkosina@suse.com >
Link: https://lore.kernel.org/r/20231206-wip-selftests-v2-8-c0350c2f5986@kernel.org
Signed-off-by: Benjamin Tissoires <bentiss@kernel.org >
2023-12-07 09:52:04 +01:00
Benjamin Tissoires
d8d7aa2266
selftests/hid: tablets: do not set invert when the eraser is used
...
Turns out that the chart from Microsoft is not exactly what I got here:
when the rubber is used, and is touching the surface, invert can (should)
be set to 0...
[0] https://learn.microsoft.com/en-us/windows-hardware/design/component-guidelines/windows-pen-states
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net >
Acked-by: Jiri Kosina <jkosina@suse.com >
Link: https://lore.kernel.org/r/20231206-wip-selftests-v2-7-c0350c2f5986@kernel.org
Signed-off-by: Benjamin Tissoires <bentiss@kernel.org >
2023-12-07 09:52:03 +01:00
Benjamin Tissoires
881ccc36b4
selftests/hid: tablets: move move_to function to PenDigitizer
...
We can easily subclass PenDigitizer for introducing firmware bugs when
subclassing Pen is harder.
Move move_to from Pen to PenDigitizer so we get that ability
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net >
Acked-by: Jiri Kosina <jkosina@suse.com >
Link: https://lore.kernel.org/r/20231206-wip-selftests-v2-6-c0350c2f5986@kernel.org
Signed-off-by: Benjamin Tissoires <bentiss@kernel.org >
2023-12-07 09:52:03 +01:00
Benjamin Tissoires
d52f52069f
selftests/hid: tablets: move the transitions to PenState
...
Those transitions have nothing to do with `Pen`, so migrate them to
`PenState`.
The hidden agenda is to remove `Pen` and integrate it into `PenDigitizer`
so that we can tweak the events in each state to emulate firmware bugs.
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net >
Acked-by: Jiri Kosina <jkosina@suse.com >
Link: https://lore.kernel.org/r/20231206-wip-selftests-v2-5-c0350c2f5986@kernel.org
Signed-off-by: Benjamin Tissoires <bentiss@kernel.org >
2023-12-07 09:52:03 +01:00
Benjamin Tissoires
b5edacf79c
selftests/hid: tablets: remove unused class
...
Looks like this is a leftover
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net >
Acked-by: Jiri Kosina <jkosina@suse.com >
Link: https://lore.kernel.org/r/20231206-wip-selftests-v2-4-c0350c2f5986@kernel.org
Signed-off-by: Benjamin Tissoires <bentiss@kernel.org >
2023-12-07 09:52:03 +01:00
Benjamin Tissoires
0bb3ed717d
selftests: hid: import hid-tools hid-multitouch and hid-tablets tests
...
These tests have been developed in the hid-tools[0] tree for a while.
Now that we have a proper selftests/hid kernel entry and that the tests
are more reliable, it is time to directly include those in the kernel
tree.
There are a lot of multitouch tests, and the default timeout of 45 seconds
is not big enough. Bump it to 200 seconds.
[0] https://gitlab.freedesktop.org/libevdev/hid-tools
Cc: Peter Hutterer <peter.hutterer@who-t.net >
Cc: Kai-Heng Feng <kai.heng.feng@canonical.com >
Cc: Roderick Colenbrander <roderick.colenbrander@sony.com >
Cc: наб <nabijaczleweli@nabijaczleweli.xyz >
Cc: Blaž Hrastnik <blaz@mxxn.io >
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz >
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net >
Signed-off-by: Roderick Colenbrander <roderick.colenbrander@sony.com >
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com >
2023-04-12 17:13:37 +02:00