Hyperpixel4 touch calibration/scaling issue

I’m running my 3D printer from a Raspberry Pi 4 with the Hyperpixel4 touch. I’m running a set of software called Klipper, moonraker, Fluidd and Klipperscreen but have also tried other software that uses XServer in landscape orientation.

The issue I have is that the touchscreen works OK in landscape (rotated right) and the touchscreen works ok apart from the right-hand side of around 10-15mm that doesn’t respond to touch at all. I’m thinking that the calibration is off or somehow scaled to only cover the first 80-90% of the screen from the left-hand side.

Like many others not using an actual GUI desktop, I had to comment out the dtoverlay=vc4-fkms-v3d lines in the boot.txt file. This is what the important part looks like:

[pi4]
# Enable DRM VC4 V3D driver on top of the dispmanx display stack
# dtoverlay=vc4-fkms-v3d
max_framebuffers=2

[all]
#dtoverlay=vc4-fkms-v3d
# enable raspicam
start_x=1
gpu_mem=128
dtoverlay=hyperpixel4
display_lcd_rotate=3
enable_dpi_lcd=1
dpi_group=2
dpi_mode=87
dpi_output_format=0x7f216
dpi_timings=480 0 10 16 59 800 0 15 113 15 0 0 0 60 0 32000000 6

And my /usr/share/X11/xorg.conf.d/40-libinput.conf is:

Section "InputClass"
        Identifier "libinput pointer catchall"
        MatchIsPointer "on"
        MatchDevicePath "/dev/input/event*"
        Driver "libinput"
EndSection

Section "InputClass"
        Identifier "libinput keyboard catchall"
        MatchIsKeyboard "on"
        MatchDevicePath "/dev/input/event*"
        Driver "libinput"
EndSection

Section "InputClass"
        Identifier "libinput touchpad catchall"
        MatchIsTouchpad "on"
        MatchDevicePath "/dev/input/event*"
        Driver "libinput"
EndSection

Section "InputClass"
        Identifier "libinput touchscreen catchall"
        MatchIsTouchscreen "on"
        MatchDevicePath "/dev/input/event*"
        Driver "libinput"
        Option "TransformationMatrix" "0 -1 1 1 0 0 0 0 1"
EndSection

Section "InputClass"
        Identifier "libinput tablet catchall"
        MatchIsTablet "on"
        MatchDevicePath "/dev/input/event*"
        Driver "libinput"
EndSection

That obviously contains the magic TransformationMatrix to rotate the touchscreen.

Does anyone have any other ideas why the touchscreen doesn’t cover the whole screen or how to maybe calibrate it? I’ve seen some other discussion on Github that seemed to have a similar issue but that was with an older version of the drivers.

The hyperpixel4-rotate commands never worked because I’m not running a desktop GUI.

I know the software I’m running is probably irrelevant to this but here are the specs and versions anyway:

Ender 3 v2 printer
Raspberry Pi 4 (also tried on Pi Zero 2 W with similar results)
Klipper v0.10.0-223-g4c8d24ae
KlipperScreen v0.2.0-20-g58e0aa7
moonraker v0.7.1-285-g505c1bf
Fluidd v1.16.2

Many thanks,

Paul.

Having the same issue except touchscreen isn’t working for me at all