Categories
Guides Linux Technology

How to rotate the WaveShare WS170120 HDMI/USB touchscreen on a Raspberry Pi 4

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/

One reply on “How to rotate the WaveShare WS170120 HDMI/USB touchscreen on a Raspberry Pi 4”

I’m curious to find out what blog system you are using? I’m experiencing some minor security issues with my latest blog and I’d like to find something more secure. Do you have any solutions?

Leave a Reply