From 7afcc6fc5db1f3fbcaae0fb7a4e6f5878a7b0530 Mon Sep 17 00:00:00 2001 From: Patrick Mulligan Date: Sun, 29 Mar 2026 22:03:15 -0400 Subject: [PATCH] feat(deploy): add eGalax touchscreen support for Dell 9030 AIO The Dell OptiPlex 9030 AIO's built-in eGalax touchscreen is misidentified by libinput as a touchpad. Fix: 1. Unbind from usbhid at boot via udev, bind to usbtouchscreen kernel module which handles it as absolute input 2. Apply calibration matrix via systemd service after X11 starts (swap+invert axes, scale to active panel area 238-1853 x 197-1869) Also updates hardware comments for Dell 9030 (was HP ProDesk). Co-Authored-By: Claude Opus 4.6 (1M context) --- deploy/nixos/hardware/batm3.nix | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/deploy/nixos/hardware/batm3.nix b/deploy/nixos/hardware/batm3.nix index f037e2e..363c3c9 100644 --- a/deploy/nixos/hardware/batm3.nix +++ b/deploy/nixos/hardware/batm3.nix @@ -1,6 +1,6 @@ # BATM3 Hardware Configuration -# HP ProDesk 600 G3 DM, Intel i5-7500T, Intel HD 630 -# Temporary board replacement for GeneralBytes BATM3 (ARM Android → x86 NixOS) +# Dell OptiPlex 9030 AIO, Intel i7-4790S, Intel HD 4600 +# Board replacement for GeneralBytes BATM3 (ARM Android → x86 NixOS) { config, lib, pkgs, ... }: @@ -21,6 +21,7 @@ kernelModules = [ "kvm-intel" + "usbtouchscreen" ]; kernelParams = [ @@ -67,8 +68,11 @@ hybrid-sleep.enable = false; }; - # Serial port access for bill validator/dispenser (USB-serial adapters) - # Stable symlinks by adapter serial number (prevents ttyUSB reordering on reboot) + # eGalax touchscreen (Dell 9030 AIO built-in panel) + # The eGalax HID descriptor confuses libinput (treats it as touchpad). + # Fix: unbind from usbhid at boot, bind to usbtouchscreen kernel module, + # then apply calibration matrix after X11 starts. + # Unbind eGalax from usbhid, bind to usbtouchscreen services.udev.extraRules = lib.mkAfter '' KERNEL=="ttyS[0-9]*", MODE="0666" KERNEL=="ttyUSB[0-9]*", MODE="0666" @@ -76,5 +80,23 @@ SUBSYSTEM=="tty", ATTRS{serial}=="DDDLb103Y23", SYMLINK+="ttyF56", MODE="0666" SUBSYSTEM=="tty", ATTRS{serial}=="A9YW78OC", SYMLINK+="ttyMEI", MODE="0666" SUBSYSTEM=="tty", ATTRS{serial}=="A9ZF8ELY", SYMLINK+="ttyNFC", MODE="0666" + ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="0eef", ATTRS{idProduct}=="0001", RUN+="${pkgs.bash}/bin/bash -c 'echo $kernel:1.0 > /sys/bus/usb/drivers/usbhid/unbind 2>/dev/null; echo 0eef 0001 > /sys/bus/usb/drivers/usbtouchscreen/new_id 2>/dev/null'" ''; + + # Apply touchscreen calibration after X11 starts + # Matrix: swap X/Y axes, invert both, scale to active panel area (238-1853 x 197-1869) + systemd.services.egalax-calibrate = { + description = "Calibrate eGalax touchscreen"; + after = [ "display-manager.service" ]; + requires = [ "display-manager.service" ]; + wantedBy = [ "graphical.target" ]; + serviceConfig = { + Type = "oneshot"; + RemainAfterExit = true; + User = "lamassu"; + Environment = "DISPLAY=:0"; + ExecStartPre = "${pkgs.coreutils}/bin/sleep 3"; + ExecStart = "${pkgs.xorg.xinput}/bin/xinput set-prop 'eGalax Inc. USB TouchController' 'Coordinate Transformation Matrix' 0 -1.268 1.147 -1.224 0 1.118 0 0 1"; + }; + }; }