---
title: "eGalax touchscreens on Ubuntu"
date: "2022-06-17"
path: "/215-egalax-touchscreens-on-ubuntu.html"
section: "/ramblings"
description: "Installing the eGalax eGTouch driver on Ubuntu and getting it to start reliably at boot with a systemd unit."
---

eGalax resistive and capacitive touch controllers turn up in a lot of industrial and kiosk panels. On Ubuntu the panel is usually detected as a generic USB HID device and touches more or less work, but you do not get calibration or multi-touch behaving properly until you install the vendor's `eGTouch` driver. The catch is that the driver's installer does not set up a reliable start-at-boot, so you have to do that part yourself. This is on Ubuntu 18.04.

## Install the driver

Download the current `eGTouch` driver for your architecture from eGalax, unpack it and run the installer:

```bash
tar xvzf eGTouch_v2.5.xxxx.L-x.tar.gz
cd eGTouch_v2.5.xxxx.L-x
sudo ./setup.sh
```

Confirm the controller is actually on the USB bus and being seen:

```bash
lsusb
sudo dmesg | grep -i touch
```

## Make it start at boot

The installer puts the daemon binary at `/usr/bin/eGTouchD` but does not give you a dependable boot job, so touch can come up before the daemon does, or not at all after a reboot. Create a proper systemd unit:

```bash
sudo systemctl edit --force --full eGTouch.service
```

Paste in the following. The important parts are that it runs early (`Before=sysinit.target`), it is a forking service that matches how `eGTouchD` backgrounds itself, and it restarts if it ever dies:

```text
[Unit]
Documentation=man:systemd-sysv-generator(8)
SourcePath=/usr/bin/eGTouchD
DefaultDependencies=no
Before=sysinit.target
After=apparmor.service

[Service]
Type=forking
Restart=always
RestartSec=5
StartLimitInterval=60s
StartLimitBurst=3
TimeoutSec=0
IgnoreSIGPIPE=no
KillMode=process
GuessMainPID=no
RemainAfterExit=no
User=root
Group=root
ExecStart=/usr/bin/eGTouchD start
ExecReload=/usr/bin/eGTouchD restart
ExecStop=/usr/bin/eGTouchD stop

[Install]
WantedBy=multi-user.target
```

Enable and start it, then reboot to prove it comes up on its own:

```bash
sudo systemctl enable eGTouch.service
sudo systemctl restart eGTouch.service
sudo reboot
```

## Checking the display side

While you are here it is worth confirming the display modes the panel is offering, as a touch panel driven over VGA will often advertise a pile of resolutions and the compositor picks one for you. On a Wayland compositor the mode list shows up in its log, for example:

```text
gbm-kms: Output: VGA-1 (connected)
gbm-kms:   Mode: 1920x1080@59.93
gbm-kms:   Mode: 1680x1050@59.88
gbm-kms:   Mode: 1280x1024@60.01
gbm-kms:   Mode: 1024x768@60.00
```

If touch coordinates end up offset or mirrored, it is almost always a mismatch between the resolution the panel is running at and the one it was calibrated against, so pin the display to a single known mode and recalibrate at that mode rather than chasing it in software.
