From 0aae23648828518d54d5a134bbba9bc3f7d99d34 Mon Sep 17 00:00:00 2001 From: Emil Kosz Date: Wed, 15 Jan 2025 12:31:05 +0100 Subject: [PATCH] Version 0.3 --- META-INF/com/google/android/update-binary | 33 ++++++++++++++++++++++ META-INF/com/google/android/updater-script | 1 + README.md | 13 +++++++++ module.prop | 6 ++++ pack_module.sh | 6 ++++ service.sh | 18 ++++++++++++ 6 files changed, 77 insertions(+) create mode 100644 META-INF/com/google/android/update-binary create mode 100644 META-INF/com/google/android/updater-script create mode 100644 README.md create mode 100644 module.prop create mode 100755 pack_module.sh create mode 100755 service.sh diff --git a/META-INF/com/google/android/update-binary b/META-INF/com/google/android/update-binary new file mode 100644 index 0000000..28b48e5 --- /dev/null +++ b/META-INF/com/google/android/update-binary @@ -0,0 +1,33 @@ +#!/sbin/sh + +################# +# Initialization +################# + +umask 022 + +# echo before loading util_functions +ui_print() { echo "$1"; } + +require_new_magisk() { + ui_print "*******************************" + ui_print " Please install Magisk v20.4+! " + ui_print "*******************************" + exit 1 +} + +######################### +# Load util_functions.sh +######################### + +OUTFD=$2 +ZIPFILE=$3 + +mount /data 2>/dev/null + +[ -f /data/adb/magisk/util_functions.sh ] || require_new_magisk +. /data/adb/magisk/util_functions.sh +[ $MAGISK_VER_CODE -lt 20400 ] && require_new_magisk + +install_module +exit 0 diff --git a/META-INF/com/google/android/updater-script b/META-INF/com/google/android/updater-script new file mode 100644 index 0000000..11d5c96 --- /dev/null +++ b/META-INF/com/google/android/updater-script @@ -0,0 +1 @@ +#MAGISK diff --git a/README.md b/README.md new file mode 100644 index 0000000..837e8c9 --- /dev/null +++ b/README.md @@ -0,0 +1,13 @@ +# Samsung XCover 5 GSI Fixes + +This module does the following: +- Works around touchscreen bug, where the touchscreen disables after + the screen is locked. This is done using a service script which + periodically checks if the screen is on and checks touchscreen + connection. Workaround originally conceived by febeslmeisl + [here](https://github.com/phhusson/treble_experimentations/issues/2205#issuecomment-1079981168). + +## Usage +1. Clone this repo and run `pack_module.sh` +2. Install the ZIP via Magisk. +3. Reboot and enjoy. diff --git a/module.prop b/module.prop new file mode 100644 index 0000000..29884a6 --- /dev/null +++ b/module.prop @@ -0,0 +1,6 @@ +id=XC5_GSI_Fixes +name=Samsung XCover 5 GSI Fixes +version=0.3 +versionCode=3 +author=Emil Kosz +description=Fixes touchscreen bug in XCover 5 and likely other Samsung phones with GSIs diff --git a/pack_module.sh b/pack_module.sh new file mode 100755 index 0000000..d2ccf02 --- /dev/null +++ b/pack_module.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash +MODULE_NAME="XC5_GSI_fixes" +EXCLUDE="LICENSE README.md pack_module.sh" + +rm -f "${MODULE_NAME}.zip" +zip -9 --recurse-paths "${MODULE_NAME}.zip" --exclude $EXCLUDE -- * >/dev/null diff --git a/service.sh b/service.sh new file mode 100755 index 0000000..de7fe90 --- /dev/null +++ b/service.sh @@ -0,0 +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 ] && [ "${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 + usleep "${FREQ}" +done