Last active
January 13, 2024 17:08
-
-
Save rama982/92804bdfff8a8aded787d763aab80825 to your computer and use it in GitHub Desktop.
Script to patch the file "transsion_touch.ko" to fix the touchscreen in TWRP. Maybe only applicable for Transsion MT6789 devices. credit: https://github.com/Shivelight
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Set the input file | |
file="transsion_touch.ko" | |
# Define patterns for replacement | |
pattern1='0000004a' | |
pattern2='patched_get_boot_mode' | |
# Patching the file | |
xxd -p "$file" | tr -d '\n' | sed 's/600a40b9/'"$pattern1"'/g' | xxd -r -p > "$file.tmp" | |
sed -e "0,/tran_tp_get_boot_mode/s/tran_tp_get_boot_mode/$pattern2/" \ | |
"$file.tmp" > "$file.patched" | |
rm "$file.tmp" | |
# Check if patched | |
if hexdump -ve '/1 "%02x"' "$file.patched" | grep -q "$pattern1" && strings "$file.patched" | grep -q "$pattern2"; then | |
echo "Module patched successfully to $file.patched" | |
else | |
echo "Module patching failed" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment