madbutter
Posts: 14
Joined: Mon Sep 07, 2015 4:24 am

touchscreen inversion stopped working PIXEL

Thu Jan 19, 2017 5:18 am

I updated my RPi-based kiosk project to use the latest Jessie/Pixel distro. I am using a rotated (vertical) RPi touchscreen and the rotation looks correct but the touch functionality is no longer inverted as it was before the upgrade. In other words the display is correctly rotated visually and the mouse works properly but the touch is not "inverted".
This was handled in the previous version of Jesse in a shell script executed on startup with these lines:
xinput --set-prop 'FT5406 memory based driver' 'Evdev Axis Inversion' 0 1
xinput --set-prop 'FT5406 memory based driver' 'Evdev Axes Swap' 1
I tried to run the line in terminal (tty0) and it says:
property 'Evdev Axis Inversion' doesn't exist, you need to specify its type and format
I also notice that the same error pops up in a console window when I boot up, when the shell script is executed.
Can anyone help me?
Also the Pixel interface seems sluggish, I have to hold the mouse down for a few extra beats to get it to trigger - like when I try to open a terminal window from the top menu bar or shutdown with the mouse

DidaJI
Posts: 11
Joined: Thu Jan 19, 2017 6:26 am

Re: touchscreen inversion stopped working PIXEL

Thu Jan 19, 2017 6:28 am

I have the same problem...

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 6733
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: touchscreen inversion stopped working PIXEL

Thu Jan 19, 2017 11:19 am

How are you rotating the display? (i.e. have you added a line to config.txt?)

DidaJI
Posts: 11
Joined: Thu Jan 19, 2017 6:26 am

Re: touchscreen inversion stopped working PIXEL

Thu Jan 19, 2017 12:31 pm

Yes,
in config.txt I have: display_rotate=3 (rotate display)
and after boot I run script with:
xinput set-prop 'FT5406 memory based driver' 'Evdev Axes Swap' 1
xinput --set-prop 'FT5406 memory based driver' 'Evdev Axis Inversion' 1 0
(rotate touchscreen).
Until yesterday everything worked, OK, after system upgrade rotate touchscreen stopped working.
Rotate display is OK, rotate touchscreen not.

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 6733
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: touchscreen inversion stopped working PIXEL

Thu Jan 19, 2017 3:01 pm

I don't have an LCD display with me - can test tomorrow.

What does

Code: Select all

xinput list
xinput list-props 'FT5406 memory based driver'
report?

DidaJI
Posts: 11
Joined: Thu Jan 19, 2017 6:26 am

Re: touchscreen inversion stopped working PIXEL

Thu Jan 19, 2017 3:21 pm

xinput list write:
⎜ ↳ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ FT5406 memory based driver id=7 [slave pointer (2)]
⎜ ↳ USB Mouse id=8 [slave pointer (2)]
⎣ Virtual core keyboard id=3 [master keyboard (2)]
↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)]
↳ CHICONY USB Keyboard id=6 [slave keyboard (3)]

xinput list-props 'FT5406 memory based driver' write:
Device Enabled (114): 1
Coordinate Transformation Matrix (115): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
libinput Calibration Matrix (252): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
libinput Calibration Matrix Default (253): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
libinput Send Events Modes Available (234): 1, 0
libinput Send Events Mode Enabled (235): 0, 0
libinput Send Events Mode Enabled Default (236): 0, 0
Device Node (237): "/dev/input/event1"
Device Product ID (238): 0, 0
libinput Horizontal Scroll Enabled (239): 0

DidaJI
Posts: 11
Joined: Thu Jan 19, 2017 6:26 am

Re: touchscreen inversion stopped working PIXEL

Thu Jan 19, 2017 3:23 pm

But xinput set-prop 'FT5406 memory based driver' 'Evdev Axes Swap' 1 write:
property 'Evdev Axes Swap' doesn't exist, you need to specify its type and format

DidaJI
Posts: 11
Joined: Thu Jan 19, 2017 6:26 am

Re: touchscreen inversion stopped working PIXEL

Thu Jan 19, 2017 3:27 pm

On the kernel version 4.4.38 is everything okay but on the version 4.4.43 it writes this one error.

madbutter
Posts: 14
Joined: Mon Sep 07, 2015 4:24 am

Re: touchscreen inversion stopped working PIXEL

Fri Jan 20, 2017 7:29 am

Just to be clear: the display is visually rotated by putting

Code: Select all

display_rotate=1
into /boot/config.txt

The xinput commands I (we) put in: /etc/xdg/lxsession/LXDE-pi/autostart

Code: Select all

xinput --set-prop 'FT5406 memory based driver' 'Evdev Axis Inversion' 0 1
xinput --set-prop 'FT5406 memory based driver' 'Evdev Axes Swap' 1
are to remap the touchscreen input.

-madbutter

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 6733
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: touchscreen inversion stopped working PIXEL

Fri Jan 20, 2017 4:34 pm

DidaJI wrote:On the kernel version 4.4.38 is everything okay but on the version 4.4.43 it writes this one error.
I've tested with latest apt-get kernel (Linux domnfs 4.4.38-v7+ #938 SMP Thu Dec 15 15:22:21 GMT 2016 armv7l GNU/Linux) which worked.
I've tested after rpi-update (Linux domnfs 4.4.43-v7+ #948 SMP Sun Jan 15 22:20:07 GMT 2017 armv7l GNU/Linux) and that is also working.

Are you saying this doesn't work for you?
i.e. does reverting to 4.4.38 kernel work and updating to 4.4.43 kernel fails?

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 6733
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: touchscreen inversion stopped working PIXEL

Fri Jan 20, 2017 5:51 pm

Okay I have reproduced. Seems it is an apt-get upgrade of one the X packages has switched form using evdev to libinput.
While this can be reverted, this is how Debian Stretch works so it is probably best to adjust to the new world.

I think you want to use the tranformation matrix to swap the coordinates around. I think this is what you want:

Code: Select all

xinput --set-prop 'FT5406 memory based driver' 'Coordinate Transformation Matrix'  0 1 0 -1 0 1 0 0 1
See: https://wiki.ubuntu.com/X/InputCoordinateTransformation

madbutter
Posts: 14
Joined: Mon Sep 07, 2015 4:24 am

Re: touchscreen inversion stopped working PIXEL

Sat Jan 21, 2017 9:49 am

Didn't seem to work for me. I tried it in a terminal and it just sits there with a > until I Ctrl-C out (and there is no change to the touch orientation). If I hit return it just puts a > on a new line. I then put it in the shell script that contained the old command (and commented out the old Evdev commands) and re-started and that did not work either. In the terminal I can run
xinput list
and see
'FT5406 memory based driver'
in the list and I can
xinput list-props 'FT5406 memory based driver' | grep "Coordinate Transformation Matrix"
and see the identity matrix I just can't seem to set it with --set-prop

User avatar
rpdom
Posts: 22374
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: touchscreen inversion stopped working PIXEL

Sat Jan 21, 2017 10:19 am

madbutter wrote:Didn't seem to work for me. I tried it in a terminal and it just sits there with a > until I Ctrl-C out
That means that you haven't typed the command correctly. There is a missing quote mark or something. The command line is still waiting for you to type in the matching end quote.
Here's an example of what happens when you miss a quote mark.

Code: Select all

pi@raspi6 ~ $ echo 'hello
> what?
> Oh, I missed the endquote
> here it is'
hello
what?
Oh, I missed the endquote
here it is
pi@raspi6 ~ $ 
So make sure you type all four ' marks in that command.

DidaJI
Posts: 11
Joined: Thu Jan 19, 2017 6:26 am

Re: touchscreen inversion stopped working PIXEL

Sun Jan 22, 2017 9:52 am

This one command:
"xinput --set-prop 'FT5406 memory based driver' 'Coordinate Transformation Matrix' 0 1 0 -1 0 1 0 0 1" switch x-axis and y-axis for me.
Axis already so move right, but I need still switch direction left<>right and up<>down.

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 6733
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: touchscreen inversion stopped working PIXEL

Sun Jan 22, 2017 5:03 pm

DidaJI wrote:This one command:
"xinput --set-prop 'FT5406 memory based driver' 'Coordinate Transformation Matrix' 0 1 0 -1 0 1 0 0 1" switch x-axis and y-axis for me.
Axis already so move right, but I need still switch direction left<>right and up<>down.
That command is a right rotate. If you want a left rotate then try:

Code: Select all

xinput --set-prop 'FT5406 memory based driver' 'Coordinate Transformation Matrix' 0 -1 1 1 0 0 0 0 1

DidaJI
Posts: 11
Joined: Thu Jan 19, 2017 6:26 am

Re: touchscreen inversion stopped working PIXEL

Sun Jan 22, 2017 5:47 pm

Bingo, thank you very much Dom! Now everything works fine...

gulliverrr
Posts: 38
Joined: Wed Jan 02, 2013 1:38 pm

Re: touchscreen inversion stopped working PIXEL

Sun Jan 22, 2017 9:35 pm

Worked for me for slightly altered as I have ADS7846. My 2 cents:
1. If you are via SSH,

Code: Select all

xinput list
does not work. Run it like that instead

Code: Select all

DISPLAY=:0.0 xinput list
2. If the above command reports "ADS7846" instead of "FT5406" run this command

Code: Select all

DISPLAY=:0.0 xinput --set-prop 'ADS7846 Touchscreen' 'Coordinate Transformation Matrix' 0 -1 1 1 0 0 0 0 1
or
DISPLAY=:0.0 xinput --set-prop 'ADS7846 Touchscreen' 'Coordinate Transformation Matrix' 0 1 0 -1 0 1 0 0 1
depending on the way you need it rotated.
The above change is gone though after restart. Is there a way to make it permanent or do I need to run it as a script on boot?
Thanks!

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 6733
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: touchscreen inversion stopped working PIXEL

Mon Jan 23, 2017 1:00 pm

gulliverrr wrote:The above change is gone though after restart. Is there a way to make it permanent or do I need to run it as a script on boot?
@madbutter reported adding to /etc/xdg/lxsession/LXDE-pi/autostart

madbutter
Posts: 14
Joined: Mon Sep 07, 2015 4:24 am

Re: touchscreen inversion stopped working PIXEL

Tue Jan 24, 2017 11:18 am

Just wanted to confirm that this is working for me, once I got the typos out, and that it is started automatically when I boot the Pi.
To sum up the whole procedure to have R-Pi touchscreen startup in in portrait mode:

1. In /boot/config.txt type in and save:
display_rotate=1

2. In /etc/xdg/lxsession/LXDE-pi/autostart type in and save:
xinput --set-prop 'FT5406 memory based driver' 'Coordinate Transformation Matrix' 0 1 0 -1 0 1 0 0 1

Thanks for your help, Dom

User avatar
dasmanul
Posts: 502
Joined: Wed Sep 30, 2015 10:20 am
Location: Frankfurt, Germany

Re: touchscreen inversion stopped working PIXEL

Tue Jan 24, 2017 2:05 pm

Can somebody explain to me why the transformation matrix for transforming 2D coordinates is 3x3?

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 6733
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: touchscreen inversion stopped working PIXEL

Tue Jan 24, 2017 3:12 pm

dasmanul wrote:Can somebody explain to me why the transformation matrix for transforming 2D coordinates is 3x3?
You can't achieve a translation with a 2x2 matrix. You may want (0,0) to end up at (1280,720) when display is rotated 180 degrees.

User avatar
dasmanul
Posts: 502
Joined: Wed Sep 30, 2015 10:20 am
Location: Frankfurt, Germany

Re: touchscreen inversion stopped working PIXEL

Tue Jan 24, 2017 4:52 pm

Thanks. I still don't quite get it though. The linked page gives the matrix for 180° rotation as

Code: Select all

⎡ -1  0 1 ⎤
⎜  0 -1 1 ⎥
⎣  0  0 1 ⎦
How would that turn (0,0) into (1280,720)?

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 6733
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: touchscreen inversion stopped working PIXEL

Tue Jan 24, 2017 4:56 pm

The multiplication would be:

Code: Select all

⎡ -1  0 1 ⎤⎡x⎤
⎜  0 -1 1 ⎥⎜y⎥
⎣  0  0 1 ⎦⎣1⎦
with x and y normalised to [0,1]

So (0,0) would give (1, 1, 1) which when un-normalised gives (1280, 720)

divejunk
Posts: 1
Joined: Tue Jan 24, 2017 5:05 pm

Re: touchscreen inversion stopped working PIXEL

Tue Jan 24, 2017 5:08 pm

Finally it is working!

This line did the job:
xinput --set-prop 'FT5406 memory based driver' 'Coordinate Transformation Matrix' 0 1 0 -1 0 1 0 0 1

But:
after a reboot it's gone.
I placed it in /etc/xdg/lxsession/LXDE-pi/autostart

Any one any thoughts?

User avatar
dasmanul
Posts: 502
Joined: Wed Sep 30, 2015 10:20 am
Location: Frankfurt, Germany

Re: touchscreen inversion stopped working PIXEL

Tue Jan 24, 2017 6:13 pm

@dom: Thanks, got it now!

Return to “Troubleshooting”