Skip to content

Instantly share code, notes, and snippets.

@francip
Last active August 9, 2024 08:46
Show Gist options
  • Save francip/4183e2a860af34dd4aa0d1c98366f76b to your computer and use it in GitHub Desktop.
Save francip/4183e2a860af34dd4aa0d1c98366f76b to your computer and use it in GitHub Desktop.
Raspberry Pi touch input rotate for 1920 x 480 HDMI IPS Display
#!/bin/bash
# Rotate the display input
# Pi 4 / Xorg
# DEVICE_NAME="wch.cn USB2IIC_CTP_CONTROL"
# Pi 5 / Wayland
DEVICE_NAME="xwayland-touch:14"
PROPERTY_NAME="Coordinate Transformation Matrix"
# To run from SSH uncomment the following line
#export DISPLAY=:0
# Get the device ID
DEVICE_ID=$(xinput list | grep "$DEVICE_NAME" | awk '{print $5}' | tr -d 'id=')
if [ -n "$DEVICE_ID" ]; then
# Get the property ID
PROPERTY_ID=$(xinput list-props "$DEVICE_ID" | grep "$PROPERTY_NAME" | awk '{print $4}' | tr -d '(' | tr -d '):')
# Set the transformation matrix for 270-degree rotation
xinput set-prop "$DEVICE_ID" "$PROPERTY_ID" 0 -1 1 1 0 0 0 0 1
else
echo "Device not found"
fi
@francip
Copy link
Author

francip commented Apr 7, 2024

Interesting. I'll have to give it a try.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment