Calibrate Waveshare 5″ Resistive Touchscreen

# install calibrator and evdev (allows multiple keyboards mice treated as separate device)
sudo apt install xinput-calibrator xserver-xorg-input-evdev

# make evdev higher number than libinput
sudo mv /usr/share/X11/xorg.conf.d/10-evdev.conf /usr/share/X11/xorg.conf.d/45-evdev.conf

# list devices
xinput

# view calibration option
xinput --list-props <deviceid>

# calibrate
xinput_calibrator

# copy paste the result like below to /usr/share/X11/xorg.conf.d/99-calibration.conf:
Section "InputClass"
Identifier "calibration"
MatchProduct "BYZHYYZHY By ZH851"
Option "Calibration" "182 3859 277 3944"
Option "SwapAxes" "0"
EndSection

Source: https://www.waveshare.com/wiki/5inch_HDMI_LCD_(B)