summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2022-05-05 10:45:47 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2022-05-10 09:52:04 +1000
commitbcd984bdc353f2b4524debe36a11f58d0e81f346 (patch)
tree26346f286eb2096d81e0491cdaeea6ecb28ef464
parent1f21c8c7fca37c15e0d8a6f7c7f89519c5947829 (diff)
downloadxf86-input-wacom-bcd984bdc353f2b4524debe36a11f58d0e81f346.tar.gz
test: add a test for the artpen rotation
The artpen has a physical rotation property, sent by the kernel driver as ABS_Z (historical reasons). In the driver this is mapped to the ds->abswheel state because this axis is shared with the airbrush wheel - both are sent through the same XI valuator (historical reasons, as usual). We can rather easily test this by ensuring we have an artpen device id and then send something through ABS_Z, that should update the wheel axis. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Aaron Skomra <aaron.skomra@wacom.com>
-rw-r--r--test/__init__.py4
-rw-r--r--test/test_wacom.py13
2 files changed, 14 insertions, 3 deletions
diff --git a/test/__init__.py b/test/__init__.py
index f216239..70a3c18 100644
--- a/test/__init__.py
+++ b/test/__init__.py
@@ -42,6 +42,10 @@ except ValueError as e:
logger = logging.getLogger(__name__)
+class PenId(enum.IntEnum):
+ ARTPEN = 0x100804
+
+
@attr.s
class InputId:
product: int = attr.ib()
diff --git a/test/test_wacom.py b/test/test_wacom.py
index dd115fd..f7dffd3 100644
--- a/test/test_wacom.py
+++ b/test/test_wacom.py
@@ -16,7 +16,7 @@
from typing import Dict
-from . import Device, Monitor, Sev, Proximity
+from . import Device, Monitor, Ev, Sev, Proximity, PenId
import pytest
import logging
@@ -146,7 +146,7 @@ def test_relative_motion(mainloop, opts, rotate):
assert all([m == motions[0] for m in motions])
-@pytest.mark.parametrize("axis", ["x", "y", "pressure", "tilt_x", "tilt_y"])
+@pytest.mark.parametrize("axis", ["x", "y", "pressure", "tilt_x", "tilt_y", "wheel"])
def test_axis_updates(mainloop, opts, axis):
"""
Check that the various axes come through correctly
@@ -162,6 +162,7 @@ def test_axis_updates(mainloop, opts, axis):
"pressure": 2,
"tilt_x": 3,
"tilt_y": 4,
+ "wheel": 5,
}
# Send a bunch of events with only one axis changing, the rest remains at
@@ -174,9 +175,15 @@ def test_axis_updates(mainloop, opts, axis):
return axes[map[axis]]
ev = [
+ Ev("ABS_MISC", PenId.ARTPEN),
+ Ev("MSC_SERIAL", 0x123456),
Sev("ABS_X", 50 + axval("x")),
Sev("ABS_Y", 50 + axval("y")),
- Sev("ABS_Z", 50), # FIXME: what is this axis??
+ # ABS_Z sets ds->abswheel in the driver which is used for artpen
+ # physical rotation and airbrush wheel - both share the
+ # same valuator. This is *not* rotation, that axis is for the
+ # cursor rotation only.
+ Sev("ABS_Z", 50 + axval("wheel")),
Sev("ABS_PRESSURE", 50 + axval("pressure")),
Sev("ABS_DISTANCE", 0), # Distance isn't exported
Sev("ABS_TILT_X", 50 + axval("tilt_x")),