We’re developing a new product at work, and used a WaveShare WS170120 7″ HDMI/USB touchscreen and a Raspberry Pi 4 during the control prototyping.
The 7″ touchscreen had to be rotated by 90 degrees, and working out how to do this wasn’t that straightforward, so I thought I’d publish it just in case it helps anyone out.
Rotating the display output
To rotate the display, this command should be run at boot:
xrandr --output HDMI-1 --rotate right
More information on the
xrandr command can be found at https://xorg-team.pages.debian.net/xorg/howto/use-xrandr.html
Rotating the touchscreen overlay
This was a bit more difficult – several forum posts were either out of date or only gave part of the required information.
This command should also be run at boot:
xinput set-prop 'WaveShare WS170120' 'Coordinate Transformation Matrix' 0 1 0 -1 0 1 0 0 1
A good resource for the
xinput command can be found at https://linuxhint.com/change_mouse_touchpad_settings_xinput_linux/