[PATCH 14/18] selftests/hid: tablets: also check for XP-Pen offset correction

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The values are taken from the HID-BPF file.
Basically we are recomputing the array provided there.

Signed-off-by: Benjamin Tissoires <bentiss@xxxxxxxxxx>
---
 tools/testing/selftests/hid/tests/test_tablet.py | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/hid/tests/test_tablet.py b/tools/testing/selftests/hid/tests/test_tablet.py
index e265f1d4e089..ae0eda9cd3d8 100644
--- a/tools/testing/selftests/hid/tests/test_tablet.py
+++ b/tools/testing/selftests/hid/tests/test_tablet.py
@@ -957,10 +957,24 @@ class XPPen_ArtistPro16Gen2_28bd_095b(PenDigitizer):
             pen.eraser = False
             pen.barrelswitch = False
 
-        pen.xtilt = 0
-        pen.ytilt = 0
         pen.current_state = state
 
+    def event(self, pen, test_button):
+        import math
+
+        pen_copy = copy.copy(pen)
+        width = 13.567
+        height = 8.480
+        tip_height = 0.055677699
+        hx = tip_height * (32767 / width)
+        hy = tip_height * (32767 / height)
+        if pen_copy.xtilt != 0:
+            pen_copy.x += round(hx * math.sin(math.radians(pen_copy.xtilt)))
+        if pen_copy.ytilt != 0:
+            pen_copy.y += round(hy * math.sin(math.radians(pen_copy.ytilt)))
+
+        return super().event(pen_copy, test_button)
+
 
 class XPPen_Artist24_28bd_093a(PenDigitizer):
     """

-- 
2.44.0





[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux