Skip to content

Commit 1b2c3ca

Browse files
author
Benjamin Tissoires
committed
selftests/hid: tablets: also check for XP-Pen offset correction
The values are taken from the HID-BPF file. Basically we are recomputing the array provided there. Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Peter Hutterer <[email protected]> Signed-off-by: Benjamin Tissoires <[email protected]>
1 parent 0389901 commit 1b2c3ca

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

tools/testing/selftests/hid/tests/test_tablet.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -957,10 +957,24 @@ def move_to(self, pen, state, button):
957957
pen.eraser = False
958958
pen.barrelswitch = False
959959

960-
pen.xtilt = 0
961-
pen.ytilt = 0
962960
pen.current_state = state
963961

962+
def event(self, pen, test_button):
963+
import math
964+
965+
pen_copy = copy.copy(pen)
966+
width = 13.567
967+
height = 8.480
968+
tip_height = 0.055677699
969+
hx = tip_height * (32767 / width)
970+
hy = tip_height * (32767 / height)
971+
if pen_copy.xtilt != 0:
972+
pen_copy.x += round(hx * math.sin(math.radians(pen_copy.xtilt)))
973+
if pen_copy.ytilt != 0:
974+
pen_copy.y += round(hy * math.sin(math.radians(pen_copy.ytilt)))
975+
976+
return super().event(pen_copy, test_button)
977+
964978

965979
class XPPen_Artist24_28bd_093a(PenDigitizer):
966980
"""

0 commit comments

Comments
 (0)