diff --git a/service.sh b/service.sh index da62a55..49e9af8 100755 --- a/service.sh +++ b/service.sh @@ -1,15 +1,18 @@ #!/system/bin/sh FREQ=500 # How often to update, in ms. +TS_CHECKED=false while true; do SCREEN_ON="$(/system/bin/dumpsys deviceidle | /system/bin/grep mScreenOn | /system/bin/cut -d '=' -f2)" - if [ "${SCREEN_ON}" = true ]; then + if [ "${SCREEN_ON}" = true ] && [ "${TS_CHECKED}" = false ]; then /system/bin/log -t Magisk -p i "[XC5_GSI_Fixes] Checking touchscreen connection." /system/bin/echo check_connection > /sys/class/sec/tsp/cmd RESULT="$(/system/bin/cat /sys/class/sec/tsp/cmd_result | /system/bin/cut -d ':' -f2)" /system/bin/log -t Magisk -p i "[XC5_GSI_Fixes] Result: ${RESULT}" + TS_CHECKED=true fi + [ "${SCREEN_ON}" = false ] && TS_CHECKED=false /system/bin/usleep "${FREQ}" done