From 580e053326e4d83aeac6d2e46539841c2e476b81 Mon Sep 17 00:00:00 2001 From: rootzoll Date: Sun, 26 Jan 2020 16:53:02 +0100 Subject: [PATCH] #809 adding calibrate option to script --- .../config.scripts/blitz.touchscreen.sh | 27 +++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/home.admin/config.scripts/blitz.touchscreen.sh b/home.admin/config.scripts/blitz.touchscreen.sh index f408505dd..a40976f96 100644 --- a/home.admin/config.scripts/blitz.touchscreen.sh +++ b/home.admin/config.scripts/blitz.touchscreen.sh @@ -11,7 +11,7 @@ source /mnt/hdd/raspiblitz.conf if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then echo "STILL EXPERIMENTAL - NOT FINISHED" echo "the Blitz-Touch-User-Interface (BlitzTUI) feature" - echo "blitz.touchscreen.sh [on|off|update]" + echo "blitz.touchscreen.sh [on|off|calibrate|update]" exit 1 fi @@ -125,6 +125,7 @@ EOF sudo sed -i 's/^touchscreen=.*/touchscreen=1/g' /mnt/hdd/raspiblitz.conf echo "OK - a restart is needed: sudo shutdown -r now" + exit 0 fi @@ -134,7 +135,28 @@ fi if [ "$1" = "update" ]; then echo "updating BlitzTUI (including python dependencies) ..." - /home/admin/python3-env-lnd/bin/pip install /home/admin/raspiblitz/home.admin/BlitzTUI/ + /home/admin/python3-env-lnd/bin/pip install /home/admin/raspiblitz/home.admin/BlitzTUI/ + exit 0 +fi + +################### +# CALIBRATE +################### + +if [ "$1" = "calibrate" ]; then + echo "# calibrating touchscreen ..." + 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 + if [ "$2" == "norestart" ]; then + echo "# skipping touchscreen restart" + else + echo "# retstarting touchscreen" + sudo init 3 + sleep 3 + sudo init 5 + fi + echo "# OK done" + exit 0 fi ################### @@ -173,5 +195,6 @@ if [ "$1" = "0" ] || [ "$1" = "off" ]; then sudo sed -i 's/^touchscreen=.*/touchscreen=0/g' /mnt/hdd/raspiblitz.conf echo "OK - a restart is needed: sudo shutdown -r now" + exit 0 fi