How can I correct touchscreen configuration (inverted x and y) in 19.04?
This worked for me since kernel 4.20 which was the first time I had any touchscreen at all.I had to , and still have to run scripts to rotate and until kernel 5.0 I had to run this following script to calibrate the touch pen and screen. The key line is:
xinput map-to-output $i eDP
where $1
is what you get from xinput and it is a number (which I found could change between boots, so I get it from the name with the deviceid=
line, mine being ELAN0732:00). note I have to touch the screen to activate the pen to get it to show up in xinput. the number changes all the time.
I had an issue last week with the pen cursor being off where the pen was contacting, but this has, er, magically resolved itself, actually just checked and its back so I need to work on that one. I think my script just fixed it again.
This link helped with the rotations. I still don't have those showing in display settings, though I think it once did. Such is consistent with Ubuntu AMD experiences this year. https://wiki.ubuntu.com/X/InputCoordinateTransformation
I made a script saved as RotateMapToOutputs.sh
# dont forget to touch the screen first with the pen.
touchscreen=""
pen=""
OIFS=$IFS
search=""ELAN0732:00""
# note that the pen didnt show up until I mapped the standard one or clicked the screen.
# so need to do that first
echo $search
list=$(xinput | grep $search | grep pointer)
echo "list $list"
# just a text file to work with the list.
if [ -f tempxinput.txt ]
then
echo " removing tempxinput"
rm tempxinput.txt
fi
device_id=$(echo "$list" | sed -n 's/.*ELAN0732:00.*id=\([0-9]*\).*/\1/p')
for i in $device_id
do
echo "id is $i"
xinput map-to-output $i eDP
done
I then set a keyboard shortcut to do
bash "~/MyScripts/ RotateMapToOutputs.sh"
as it seems like you might have troubles with rotation, this is my rotate inverted script and I made a shortcut key as above. (note the maptoputput there might be in error as 14 is no longer that one, so I can then run the above maptooutputs after any rotation if it doesn't calibrate.
xrandr --output eDP --rotate inverted && xinput set-prop 'ELAN0732:00 04F3:2536 Pen (0)' --type=float "Coordinate Transformation Matrix" -1 0 1 0 -1 1 0 0 1 && xinput map-to-output 'ELAN0732:00 04F3:2536 Pen (0)' eDP && xinput map-to-output 14 eDP
normal is:
xrandr --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
left:
xrandr --output eDP --rotate left && xinput set-prop 'ELAN0732:00 04F3:2536 Pen (0)' --type=float "Coordinate Transformation Matrix" 0 -1 1 1 0 0 0 0 1 && xinput map-to-output 'ELAN0732:00 04F3:2536 Pen (0)' eDP && xinput map-to-output 14 eDP
right:
xrandr --output eDP --rotate right && xinput set-prop 'ELAN0732:00 04F3:2536 Pen (0)' --type=float "Coordinate Transformation Matrix" 0 1 0 -1 0 1 0 0 1 && xinput map-to-output 'ELAN0732:00 04F3:2536 Pen (0)' eDP && xinput map-to-output 14 eDP