I have a raspberry pi 4B attached to a 7" raspberry pi touchscreen via the provided ribbon cable. In my application, I have my touchscreen rotated 90° by using display_rotate which is working correctly. The touchscreen input device needs to be separately rotated into the new coordinate system. I can do that locally by running the following xinput command:

    xinput set-prop 'raspberrypi-ts' 'Coordinate Transformation Matrix' 0, 1, 0, -1, 0, 1, 0, 0, 1

I want to run this command when the raspberry pi loads every time automatically, so I've edited my autostart file located in /etc/xdg/lxsession/LXDE-pi/autostart

@lxpanel --profile LXDE-pi
@pcmanfm --desktop --profile LXDE-pi
@chromium-browser localhost
@xinput set-prop 'raspberrypi-ts' 'Coordinate Transformation Matrix' 0, 1, 0, -1, 0, 1, 0, 0, 1

@xscreensaver -no-splash

I'm able to run chromium automatically and load it to the requested page every time I restart the pi, but the touchscreen input is never rotated into the new coordinate system. If I enter the command into the terminal everything works like it should, but I really want it to happen automatically on boot.

Am I going about this the wrong way? Is there an issue with my formatting? Or is there a different location I should be adding this command so that it will be executed on load at the right time?

Thank you for your help in advance.

  • what happens if you remove the chromium-browser line? – jsotola Oct 16 '20 at 1:10
  • It still doesn’t execute the xinput command – Andrew97p Oct 16 '20 at 13:23
  • introduce an error into the xinput command line to see if it returns an error message – jsotola Oct 16 '20 at 18:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.