nicarran / jpen

Java library for accessing pen/digitizer tablets and pointing devices
43 stars 17 forks source link

Tilt values are "integrated" and wrong (Linux) #12

Closed Sciss closed 7 years ago

Sciss commented 7 years ago

I'm testing JPen 2.4 on Linux with a Wacom Intuos3, and the reported Tilt-X and Tilt-Y values are completely random because they seem to pick up from the previous value reported and then incrementally add to it. For example, if I tilt the stylus to bottom, then move it away, with the last value being for example 50 degrees, then come back to the tablet in 0 degree position, the reported value is 50 instead of 0, even increasing further as I tilt again to the bottom.

nicarran commented 7 years ago

hi,

cheers!

Sciss commented 7 years ago

Hi, I will conduct some further tests; I notice that pressure has a similar problem, although it is less severe because the last pressure levels sent before the pen is removed from the tablet are usually very low (the problem only happens when you take the pen away too fast).

Sciss commented 7 years ago

Here is the status report:

===== JPen - Status Report =====
JPen Version: 2.0.0
Date: Tue Nov 21 12:00:44 CET 2017
Providers:
   Constructor: JPen
      Construction Exception: none
      Device: Emulation (Emulation@JPen)
         Enabled: true
         Kind: (type=IGNORE)
         Fractional Movements: true
   Constructor: System
      Construction Exception: none
      Device (System Mouse): Mouse (Mouse@System)
         Enabled: true
         Kind: (type=CURSOR)
         Fractional Movements: false
      Device: Keyboard (Keyboard@System)
         Enabled: true
         Kind: (type=IGNORE)
         Fractional Movements: false
   Constructor: XInput
      Construction Exception: none
      Native Version-Build(Expected): 4-2023(2023)
      Device: Wacom Intuos3 6x8 Pen cursor (Wacom Intuos3 6x8 Pen cursor@XInput)
         Enabled: true
         Kind: (type=CURSOR)
         Fractional Movements: true
      Device: Wacom Intuos3 6x8 Pen eraser (Wacom Intuos3 6x8 Pen eraser@XInput)
         Enabled: true
         Kind: (type=ERASER)
         Fractional Movements: true
      Device: Wacom Intuos3 6x8 Pen stylus (Wacom Intuos3 6x8 Pen stylus@XInput)
         Enabled: true
         Kind: (type=STYLUS)
         Fractional Movements: true
      Device: Wacom Intuos3 6x8 Pad pad (Wacom Intuos3 6x8 Pad pad@XInput)
         Enabled: true
         Kind: (type=IGNORE)
         Fractional Movements: true
      Device: SynPS/2 Synaptics TouchPad (SynPS/2 Synaptics TouchPad@XInput)
         Enabled: true
         Kind: (type=CURSOR)
         Fractional Movements: true
System Properties:
   awt.toolkit: sun.awt.X11.XToolkit
   file.encoding: UTF-8
   file.encoding.pkg: sun.io
   file.separator: /
   java.awt.graphicsenv: sun.awt.X11GraphicsEnvironment
   java.awt.printerjob: sun.print.PSPrinterJob
   java.class.path: jpen-2.jar
   java.class.version: 52.0
   java.endorsed.dirs: /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/endorsed
   java.ext.dirs: /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/ext:/usr/java/packages/lib/ext
   java.home: /usr/lib/jvm/java-8-openjdk-amd64/jre
   java.library.path: .:/usr/java/packages/lib/amd64:/usr/lib/x86_64-linux-gnu/jni:/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:/usr/lib/jni:/lib:/usr/lib
   java.runtime.name: OpenJDK Runtime Environment
   java.runtime.version: 1.8.0_151-8u151-b12-1~deb9u1-b12
   java.specification.name: Java Platform API Specification
   java.specification.vendor: Oracle Corporation
   java.specification.version: 1.8
   java.vendor: Oracle Corporation
   java.vendor.url: http://java.oracle.com/
   java.vendor.url.bug: http://bugreport.sun.com/bugreport/
   java.version: 1.8.0_151
   java.vm.info: mixed mode
   java.vm.name: OpenJDK 64-Bit Server VM
   java.vm.specification.name: Java Virtual Machine Specification
   java.vm.specification.vendor: Oracle Corporation
   java.vm.specification.version: 1.8
   java.vm.vendor: Oracle Corporation
   java.vm.version: 25.151-b12
   javax.accessibility.assistive_technologies: org.GNOME.Accessibility.AtkWrapper
   os.arch: amd64
   os.name: Linux
   os.version: 4.9.0-4-amd64
   path.separator: :
   sun.arch.data.model: 64
   sun.awt.enableExtraMouseButtons: true
   sun.boot.class.path: /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/resources.jar:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/rt.jar:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/sunrsasign.jar:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/jsse.jar:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/jce.jar:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/charsets.jar:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/jfr.jar:/usr/lib/jvm/java-8-openjdk-amd64/jre/classes
   sun.boot.library.path: /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64
   sun.cpu.endian: little
   sun.cpu.isalist:
   sun.desktop: gnome
   sun.font.fontmanager: sun.awt.X11FontManager
   sun.io.unicode.encoding: UnicodeLittle
   sun.java.command: jpen-2.jar
   sun.java.launcher: SUN_STANDARD
   sun.jnu.encoding: UTF-8
   sun.management.compiler: HotSpot 64-Bit Tiered Compilers
   sun.os.patch.level: unknown
   user.country: DK
   user.language: en
   user.timezone: Europe/Ljubljana
===== ===== =====

The xinput program is not installed, I'll have to look for that.

Sciss commented 7 years ago

Here is output from xinput:

# entering tablet more or less perpendicular
motion a[2]=0 a[3]=-57 a[4]=-52 a[5]=-900 
motion a[1]=9436 a[2]=0 a[3]=-56 a[4]=-53 a[5]=-900 
motion a[0]=25347 a[1]=9458 a[2]=0 a[3]=-56 a[4]=-53 a[5]=-900 
motion a[0]=25362 a[1]=9489 a[2]=0 a[3]=-56 a[4]=-54 a[5]=-900 
motion a[0]=25381 a[1]=9533 a[2]=0 a[3]=-56 a[4]=-54 a[5]=-900 
motion a[0]=25416 a[1]=9579 a[2]=0 a[3]=-56 a[4]=-55 a[5]=-900 
motion a[0]=25445 a[1]=9615 a[2]=0 a[3]=-55 a[4]=-56 a[5]=-900 
motion a[0]=25468 a[1]=9662 a[2]=0 a[3]=-55 a[4]=-57 a[5]=-900 
motion a[0]=25497 a[1]=9695 a[2]=0 a[3]=-55 a[4]=-58 a[5]=-900 
motion a[0]=25520 a[1]=9718 a[2]=0 a[3]=-54 a[4]=-59 a[5]=-900 
motion a[0]=25551 a[1]=9749 a[2]=0 a[3]=-54 a[4]=-60 a[5]=-900 
motion a[0]=25588 a[1]=9774 a[2]=0 a[3]=-54 a[4]=-61 a[5]=-900 

# entering tablet tilted to the left
motion a[2]=0 a[3]=0 a[4]=0 a[5]=-900 
motion a[0]=20632 a[1]=16523 a[2]=0 a[3]=0 a[4]=0 a[5]=-900 
motion a[0]=20641 a[1]=16525 a[2]=0 a[3]=0 a[4]=-1 a[5]=-900 
motion a[0]=20652 a[1]=16519 a[2]=0 a[3]=0 a[4]=-1 a[5]=-900 
motion a[0]=20663 a[1]=16512 a[2]=0 a[3]=0 a[4]=-1 a[5]=-900 
motion a[0]=20660 a[1]=16487 a[2]=0 a[3]=1 a[4]=-1 a[5]=-900 
motion a[0]=20657 a[1]=16466 a[2]=0 a[3]=1 a[4]=-1 a[5]=-900 
motion a[0]=20646 a[1]=16443 a[2]=0 a[3]=1 a[4]=-1 a[5]=-900 
motion a[0]=20635 a[1]=16420 a[2]=0 a[3]=1 a[4]=-1 a[5]=-900 
motion a[0]=20628 a[1]=16408 a[2]=0 a[3]=1 a[4]=-1 a[5]=-900 
motion a[0]=20617 a[1]=16406 a[2]=0 a[3]=1 a[4]=-1 a[5]=-900 
motion a[1]=16400 a[2]=0 a[3]=1 a[4]=-1 a[5]=-900 

# entering tablet tilted to the right
motion a[2]=0 a[3]=0 a[4]=0 a[5]=-900 
motion a[1]=15705 a[2]=0 a[3]=0 a[4]=1 a[5]=-900 
motion a[0]=19159 a[1]=15700 a[2]=0 a[3]=0 a[4]=1 a[5]=-900 
motion a[0]=19156 a[1]=15691 a[2]=0 a[3]=0 a[4]=1 a[5]=-900 
motion a[0]=19153 a[1]=15695 a[2]=0 a[3]=0 a[4]=1 a[5]=-900 
motion a[0]=19142 a[1]=15697 a[2]=0 a[3]=0 a[4]=1 a[5]=-900 
motion a[0]=19128 a[1]=15713 a[2]=0 a[3]=0 a[4]=1 a[5]=-900 
motion a[0]=19122 a[1]=15718 a[2]=0 a[3]=0 a[4]=1 a[5]=-900 
motion a[0]=19141 a[1]=15723 a[2]=0 a[3]=0 a[4]=1 a[5]=-900 
motion a[0]=19160 a[1]=15710 a[2]=0 a[3]=0 a[4]=1 a[5]=-900 
motion a[0]=19179 a[1]=15717 a[2]=0 a[3]=0 a[4]=1 a[5]=-900 
motion a[0]=19194 a[1]=15710 a[2]=0 a[3]=0 a[4]=1 a[5]=-900 

# entering tablet tilted to the top
motion a[2]=0 a[3]=0 a[4]=0 a[5]=-900 
motion a[0]=0 a[1]=13463 a[2]=0 a[3]=0 a[4]=0 a[5]=-900 
motion a[0]=3 a[1]=13481 a[2]=0 a[3]=0 a[4]=0 a[5]=-900 
motion a[0]=0 a[1]=13520 a[2]=0 a[3]=0 a[4]=0 a[5]=-900 
motion a[0]=1 a[1]=13567 a[2]=0 a[3]=0 a[4]=0 a[5]=-900 
motion a[0]=0 a[1]=13608 a[2]=0 a[3]=0 a[4]=0 a[5]=-900 
motion a[0]=0 a[1]=13663 a[2]=0 a[3]=0 a[4]=0 a[5]=-900 
motion a[1]=13715 a[2]=0 a[3]=0 a[4]=0 a[5]=-900 
motion a[0]=0 a[1]=13761 a[2]=0 a[3]=0 a[4]=0 a[5]=-900 
motion a[0]=0 a[1]=13811 a[2]=0 a[3]=0 a[4]=-1 a[5]=-900 
motion a[0]=0 a[1]=13844 a[2]=0 a[3]=0 a[4]=-1 a[5]=-900 
motion a[0]=0 a[1]=13869 a[2]=0 a[3]=0 a[4]=-2 a[5]=-900 

# entering tablet tilted to the bottom
motion a[2]=0 a[3]=0 a[4]=0 a[5]=-900 
motion a[0]=2021 a[1]=10974 a[2]=0 a[3]=0 a[4]=0 a[5]=-900 
motion a[0]=2022 a[1]=10982 a[2]=0 a[3]=0 a[4]=0 a[5]=-900 
motion a[1]=10989 a[2]=0 a[3]=0 a[4]=0 a[5]=-900 
motion a[0]=2025 a[1]=10993 a[2]=0 a[3]=0 a[4]=0 a[5]=-900 
motion a[0]=2035 a[1]=10991 a[2]=0 a[3]=0 a[4]=0 a[5]=-900 
motion a[0]=2044 a[1]=10993 a[2]=0 a[3]=0 a[4]=0 a[5]=-900 
motion a[0]=2058 a[1]=11004 a[2]=0 a[3]=0 a[4]=0 a[5]=-900 
motion a[0]=2060 a[1]=11013 a[2]=0 a[3]=0 a[4]=0 a[5]=-900 
motion a[0]=2066 a[1]=11023 a[2]=0 a[3]=0 a[4]=0 a[5]=-900 
motion a[0]=2074 a[1]=11039 a[2]=0 a[3]=0 a[4]=0 a[5]=-900 
motion a[0]=2076 a[1]=11055 a[2]=0 a[3]=0 a[4]=0 a[5]=-900 

I'm confused. The values don't indicate any tilt. Also if I do perpendicular again, the a[3] and a4[4] are now around zero.

Sciss commented 7 years ago

Ok, I played around with xinput test and observed the values as I perform tilts; bummer, it seems xinput is completely broken; it sometimes managed to have halfway reasonable values, but the phenomenon report applies here, too, the values get wrongly memorised, and so there is no way you can purposefully interpret the tilt-x and tilt-y. What a disappointment. At least we know that JPen has nothing to do with that. I will investigate more if there are fixes for xinput.

Sciss commented 7 years ago

Found this post: https://forum.kde.org/viewtopic.php?f=137&t=127374

This is actually the problem; if I use "absolute" coordinates mode, it works. Which is crap, because in my case I really need relative mouse coordinates. Anyway, I'm closing now as this is not a JPen bug.