I managed to do a workaround. Since my touchscreen is working when using my fingers, I just copy the "coordination matrix" properties of the touchscreen to my stylus pen. After doing that the stylus pen cursor position is perfect.
$ xinput
Virtual core pointer id=2 [master pointer (3)]
↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
↳ Dell Dell Universal Receiver Mouse id=10 [slave pointer (2)]
↳ Dell Dell Universal Receiver Consumer Control id=11 [slave pointer (2)]
↳ ELAN0732:00 04F3:262B id=15 [slave pointer (2)]
↳ SynPS/2 Synaptics TouchPad id=18 [slave pointer (2)]
↳ ELAN0732:00 04F3:262B Pen (0) id=22 [slave pointer (2)]
id=15 is my touchscreen and
id=22 is my stylus pen
First check out their properties:
xinput --list-props 15
Device 'ELAN0732:00 04F3:262B':
Device Enabled (147): 1
Coordinate Transformation Matrix (149): 1.000000, 0.000000, 0.000000, 0.000000, 0.500000, 0.500000, 0.000000, 0.000000, 1.000000
libinput Calibration Matrix (304): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
libinput Calibration Matrix Default (305): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
libinput Send Events Modes Available (269): 1, 0
libinput Send Events Mode Enabled (270): 0, 0
libinput Send Events Mode Enabled Default (271): 0, 0
Device Node (272): "/dev/input/event8"
Device Product ID (273): 1267, 9771
xinput --list-props 22:
'ELAN0732:00 04F3:262B Pen (0)':
Device Enabled (147): 1
Coordinate Transformation Matrix (149): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
Device Node (272): "/dev/input/event17"
Device Product ID (273): 1267, 9771
libinput Tablet Tool Pressurecurve (579): 0.000000, 0.000000, 0.000000, 0.000000, 1.000000, 1.000000, 1.000000, 1.000000*
As the touchscreen is working perfectly, I assumed its properties to be wright. The "Coordinate Transformation Matrix" differed between the two. (I also checked when unplugging the external screen - these scores were equal)
Then I just set the Coordinate Transformation Matrix Settings from the touchscreen to my stylus:
Solution for the external screen being on top of my Notebook-Screen:
xinput --set-prop 22 "Coordinate Transformation Matrix" 1.000000, 0.000000, 0.000000, 0.000000, 0.500000, 0.500000, 0.000000, 0.000000, 1.000000
General solution for all positions of the external screen:
First saving the correct numbers to an object I called 'correct_matrix':
correct_matrix=$(xinput --list-props {insert id of your touchscreen} | grep "Coordinate Transformation Matrix" | sed -E 's/.*Coordinate Transformation Matrix.*:(.*)$/\1/')
If you want check what is in correct_matrix with $ echo $correct_matrix
Then set the stylus matrix settings to the numbers in 'correct_matrix':
xinput --set-prop {insert id of your stylus} "Coordinate Transformation Matrix" $correct_matrix
That works fine for me. I just made a small shell script out of these two commands, which I run whenever I connect an external monitor or change position settings of the external monitor.
Shell script:
#!/bin/bash
correct_matrix=$(xinput --list-props {insert id of your touchscreen} | grep "Coordinate Transformation Matrix" | sed -E 's/.*Coordinate Transformation Matrix.*:(.*)$/\1/')
xinput --set-prop {insert id of your stylus} "Coordinate Transformation Matrix" $correct_matrix
I put this into a 'stylus-correct.sh' shell file, which I can then run with
bash ./stylus-correct.sh
That solves the issue for me very quickly. Whenever I connect a new screen I just go to the directory of this shell file and run it with the given command.
note that as IDs often change with boots my setptops used the name
– pierrely Nov 01 '20 at 05:27xrandr --output eDP --rotate normal && xinput set-prop 'ELAN0732:00 04F3:2536 Pen (0)' --type=float "Coordinate Transformation Matrix" 0 0 0 0 0 0 0 0 0 && xinput map-to-output 'ELAN0732:00 04F3:2536 Pen (0)' eDP && xinput map-to-output 14 eDP
– pierrely Nov 01 '20 at 05:27eg
bash /home//MyScripts/RotateNormal.sh
– pierrely Nov 01 '20 at 05:30