Last active
August 9, 2024 08:46
-
-
Save francip/4183e2a860af34dd4aa0d1c98366f76b to your computer and use it in GitHub Desktop.
Raspberry Pi touch input rotate for 1920 x 480 HDMI IPS Display
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Interesting. I'll have to give it a try.