From c2aa6de0cfcba9557c4c1f5269e61244b70b0555 Mon Sep 17 00:00:00 2001 From: rootzoll Date: Sun, 26 Jan 2020 17:09:36 +0100 Subject: [PATCH] #809 calibration detecting user cancel --- home.admin/config.scripts/blitz.touchscreen.sh | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/home.admin/config.scripts/blitz.touchscreen.sh b/home.admin/config.scripts/blitz.touchscreen.sh index a40976f96..161bfe4e1 100644 --- a/home.admin/config.scripts/blitz.touchscreen.sh +++ b/home.admin/config.scripts/blitz.touchscreen.sh @@ -144,9 +144,23 @@ fi ################### if [ "$1" = "calibrate" ]; then + + # run calibrate screen echo "# calibrating touchscreen ..." + sudo rm /tmp/99-calibration.conf 2>/dev/null sudo -u pi DISPLAY=:0.0 xinput_calibrator --output-filename /tmp/99-calibration.conf - sudo cp /tmp/99-calibration.conf /etc/X11/xorg.conf.d/99-calibration.conf + + # check if calibration was done of user + calibrationDone=$(sudo ls /tmp/99-calibration.conf 2>/dev/null | grep -c "99-calibration.conf") + if [ ${calibrationDone} -eq 0 ]; then + echo "error='aborted'" + exit 1 + fi + + # copy the results over as configuration + sudo mv /tmp/99-calibration.conf /etc/X11/xorg.conf.d/99-calibration.conf + + # restart touchscreen with new calibration if [ "$2" == "norestart" ]; then echo "# skipping touchscreen restart" else @@ -155,6 +169,7 @@ if [ "$1" = "calibrate" ]; then sleep 3 sudo init 5 fi + echo "# OK done" exit 0 fi