---
pageType: source
id: source.psb-thinking-2026-03-03-touchscreen-fix
title: psb-thinking-2026-03-03-touchscreen-fix
sourceType: local-file
sourcePath: /home/topher/.openclaw/workspace-psb-thinking/memory/2026-03-03-touchscreen-fix.md
ingestedAt: 2026-05-03T01:26:47.719Z
updatedAt: 2026-05-03T01:26:47.719Z
status: active
growth: seed
---

# psb-thinking-2026-03-03-touchscreen-fix

## Source
- Type: `local-file`
- Path: `/home/topher/.openclaw/workspace-psb-thinking/memory/2026-03-03-touchscreen-fix.md`
- Bytes: 2532
- Updated: 2026-05-03T01:26:47.719Z

## Content
````text
# Touchscreen Fix — Hackerspace Conversation (2026-03-03)

## Context
Topher 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=ili210x
dtoverlay=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 Discovery
The touch panel reports range 0-16383 but **only physically uses ~11%**:
- Actual X range: 14595-16351
- Actual Y range: 19-1112

Standard rotation matrices alone couldn't fix it — needed range correction first.

### Working Config
1. **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: ✅ RESOLVED
Touch and rotation both working correctly.

````

## Notes
<!-- openclaw:human:start -->
<!-- openclaw:human:end -->

## Related
<!-- openclaw:wiki:related:start -->
- No related pages yet.
<!-- openclaw:wiki:related:end -->
