From 5bf734cda3a2b739b9b5de258cc680271c2909a9 Mon Sep 17 00:00:00 2001 From: j4nn <531585+j4nn@users.noreply.github.com> Date: Sun, 5 Oct 2025 12:57:19 +0200 Subject: [PATCH] add touch auto detect setup script picked from tama devices twrp by MartinX3 as available here https://github.com/MartinX3-AndroidDevelopment/TWRP_android_device_sony_akari_old android-9.0 and from twrp builds available at https://www.dhsfileserver.de/ftp/martinx3/ explicit set of permissive mode seems to be needed during restore of twrp backup for some reason (it might be depending on used rom) so picking that too --- recovery/root/init.recovery.qcom.rc | 18 ++++++++++ recovery/root/system/bin/permissive.sh | 8 +++++ recovery/root/system/bin/preptouch.sh | 47 ++++++++++++++++++++++++++ 3 files changed, 73 insertions(+) create mode 100755 recovery/root/system/bin/permissive.sh create mode 100755 recovery/root/system/bin/preptouch.sh diff --git a/recovery/root/init.recovery.qcom.rc b/recovery/root/init.recovery.qcom.rc index 6de4855..e6e9d58 100644 --- a/recovery/root/init.recovery.qcom.rc +++ b/recovery/root/init.recovery.qcom.rc @@ -45,3 +45,21 @@ on fs on late-init start boot-hal-1-0 start health-hal-2-0 + start set_permissive + +on post-fs-data + start preptouch + +service set_permissive /system/bin/permissive.sh + disabled + user root + group root + oneshot + seclabel u:r:recovery:s0 + +service preptouch /system/bin/preptouch.sh + disabled + user root + group root + oneshot + seclabel u:r:recovery:s0 diff --git a/recovery/root/system/bin/permissive.sh b/recovery/root/system/bin/permissive.sh new file mode 100755 index 0000000..f1046f9 --- /dev/null +++ b/recovery/root/system/bin/permissive.sh @@ -0,0 +1,8 @@ +#!/sbin/sh + +# We use this shell script because the script will follow symlinks and +# different trees will use different binaries to supply the setenforce +# tool. Before M we use toolbox, M and beyond will use toybox. The init +# binary and init.rc will not follow symlinks. + +setenforce 0 diff --git a/recovery/root/system/bin/preptouch.sh b/recovery/root/system/bin/preptouch.sh new file mode 100755 index 0000000..4b45b1e --- /dev/null +++ b/recovery/root/system/bin/preptouch.sh @@ -0,0 +1,47 @@ +#!/sbin/sh +# +# Copyright (c) 2019-2020 Martin Dünkelmann +# All rights reserved. +# +# We use this shell script because the script will follow symlinks and +# different trees will use different binaries to supply the setenforce +# tool. Before M we use toolbox, M and beyond will use toybox. The init +# binary and init.rc will not follow symlinks. + +touch_id=`cat /sys/devices/dsi_panel_driver/panel_id` + +#XZ2 "3" XZ2C "4" Clearpad +if [[ "$touch_id" == "3" ]] || [[ "$touch_id" == "4" ]]; then + insmod /sbin/clearpad_rmi_dev.ko + insmod /sbin/clearpad_core.ko + insmod /sbin/clearpad_i2c.ko + + echo 1 > /sys/devices/virtual/input/clearpad/post_probe_start +fi + +#XZ2 "7" XZ2C "8" TCM +if [[ "$touch_id" == "7" ]] || [[ "$touch_id" == "8" ]]; then + insmod /sbin/synaptics_tcm_i2c.ko + insmod /sbin/synaptics_tcm_core.ko + insmod /sbin/synaptics_tcm_touch.ko + insmod /sbin/synaptics_tcm_device.ko + insmod /sbin/synaptics_tcm_testing.ko + insmod /sbin/synaptics_tcm_reflash.ko + insmod /sbin/synaptics_tcm_recovery.ko + insmod /sbin/synaptics_tcm_diagnostics.ko +fi + +#XZ2P SSW +if [[ "$touch_id" == "9" ]]; then + insmod /sbin/ssw49501.ko + insmod /sbin/ssw_mon.ko + + echo 1 > /sys/devices/virtual/input/siw_touch_input/init_late_session +fi + +#XZ3 ATMEL +if [[ "$touch_id" == "5" ]]; then + insmod /sbin/atmel_mxt640u.ko + + echo 1 > /sys/devices/virtual/input/lge_touch/charge_out +fi