Touch Calibration
Touch Rotation
Section titled “Touch Rotation”When you rotate the display, touch input also needs rotation. The GUI method handles this automatically, but command-line rotation requires manual touch calibration.
Calibration Matrices
Section titled “Calibration Matrices”Touch rotation uses a libinput calibration matrix. Each rotation angle has a specific matrix:
| Rotation | Matrix Values |
|---|---|
| 0° (default) | 1 0 0 0 1 0 |
| 90° (left) | 0 -1 1 1 0 0 |
| 180° (inverted) | -1 0 1 0 -1 1 |
| 270° (right) | 0 1 0 -1 0 1 |
Applying Touch Rotation
Section titled “Applying Touch Rotation”Create a udev rule file:
sudo nano /etc/udev/rules.d/99-waveshare-touch.rulesAdd the appropriate line for your rotation:
# For 90° rotationENV{ID_INPUT_TOUCHSCREEN}=="1", ENV{LIBINPUT_CALIBRATION_MATRIX}="0 -1 1 1 0 0"
# For 180° rotation# ENV{ID_INPUT_TOUCHSCREEN}=="1", ENV{LIBINPUT_CALIBRATION_MATRIX}="-1 0 1 0 -1 1"
# For 270° rotation# ENV{ID_INPUT_TOUCHSCREEN}=="1", ENV{LIBINPUT_CALIBRATION_MATRIX}="0 1 0 -1 0 1"Uncomment only the line matching your display rotation.
Reboot to apply:
sudo rebootFor testing, use xinput (requires X11):
# Find your touch devicexinput list
# Apply rotation (example for 90°)xinput set-prop "Goodix Capacitive TouchScreen" \ "libinput Calibration Matrix" 0 -1 1 1 0 0 0 0 1Touch Modes
Section titled “Touch Modes”The display supports two touch modes in Raspberry Pi OS:
Mouse Emulation (Default)
Section titled “Mouse Emulation (Default)”- Single touch controls mouse cursor
- Tap = left click
- Long press = right click
- Double-tap supported
- Best for desktop use
Multitouch Mode
Section titled “Multitouch Mode”- Full 10-point multitouch
- Pinch-to-zoom, gestures
- No right-click or double-tap
- Best for touch-optimized applications
Switching Modes
Section titled “Switching Modes”- Open Menu → Preferences → Control Center → Screens
- Select Touchscreen tab
- Choose Mouse Emulation or Multitouch
- Click Apply
Verifying Touch
Section titled “Verifying Touch”Check Touch Device
Section titled “Check Touch Device”# List input devicescat /proc/bus/input/devices | grep -A5 "Goodix"You should see:
N: Name="Goodix Capacitive TouchScreen"Test Touch Input
Section titled “Test Touch Input”# Install evtest if neededsudo apt install evtest
# Monitor touch eventssudo evtest /dev/input/event0Touch the screen - you should see coordinate data.
Troubleshooting Touch
Section titled “Troubleshooting Touch”| Issue | Solution |
|---|---|
| Touch doesn’t respond | Check power connection, verify GT9271 detected |
| Touch offset from display | Apply calibration matrix matching rotation |
| Touch inverted | Wrong matrix - try different rotation value |
| Multitouch not working | Enable Multitouch mode in Screen Configuration |
See Touch Problems for more solutions.