# Touchscreen Fix — Hackerspace Conversation (2026-03-03)## ContextTopher asked Brewer (Claude Opus, Hackerspace channel) to figure out the touchscreen connected to the Pi 5's I2C port.## Hardware- **Display:** Repurposed Samsung Family Hub screen (from a refrigerator), connected via HDMI- **Touch controller:** ILITEK ILI2511 at I2C address **0x41** on bus 1- **Pi:** Raspberry Pi 5, Raspberry Pi OS Bookworm, Wayfire (Wayland)- **Resolution:** 1920x1080, portrait mode (rotated 270°)## Problem- `/boot/firmware/config.txt` had two wrong touch overlays: - `dtoverlay=ili210x` — wrong driver entirely - `dtoverlay=ilitek251x_ts` — wrong overlay name (correct is `ilitek251x`)- Auto-detected `edt-ft5406` overlay was probing at 0x38 and failing (device is at 0x41)- Net result: touch not working at all## Fix Applied (2026-03-03)Backed up config to `/boot/firmware/config.txt.bak.20260303`, then:```# Removed:dtoverlay=ili210xdtoverlay=ilitek251x_ts# Replaced with:dtoverlay=ilitek251x,interrupt=4```After reboot, touch registered successfully:```ILI210x Touchscreen as /devices/.../i2c-1/1-0041/input/input5```## Rotation Calibration (2026-03-04, continued session)Touch worked but rotation was off. After extensive debugging:### Key DiscoveryThe touch panel reports range 0-16383 but **only physically uses ~11%**:- Actual X range: 14595-16351- Actual Y range: 19-1112Standard rotation matrices alone couldn't fix it — needed range correction first.### Working Config1. **hwdb range override** (`/etc/udev/hwdb.d/99-touchscreen.hwdb`):```evdev:input:b0018v0000p0000* EVDEV_ABS_00=31:1919 EVDEV_ABS_01=13:1062 EVDEV_ABS_35=31:1919 EVDEV_ABS_36=13:1062```2. **Rotation matrix** (`/etc/udev/rules.d/99-touchscreen.rules`): 90° CW: `0 1 0 -1 0 1 0 0 1`3. **Display rotation**: `wlr-randr --output HDMI-A-1 --transform 270` - `display_rotate=3` in config.txt = **commented out** (conflicts with Wayfire)4. **wayfire.ini**: No `touchscreen_output` — the udev matrix handles everything### Key Learnings- `display_rotate=3` in config.txt does NOT rotate Wayfire content (only framebuffer/console)- `wlr-randr --transform 270` is what actually rotates Wayfire- Having both caused double-rotation issues with touch input- `ts_calibrate` / pointercal only works for tslib, NOT libinput/Wayland- Touch in Wayland doesn't show a cursor (direct tap like a phone) — this is normal## Current Status: ✅ RESOLVEDTouch and rotation both working correctly.