From 476373ef30784fd0048cdd443ccb1238380c655b Mon Sep 17 00:00:00 2001 From: Wendly Li Date: Tue, 11 Jul 2023 16:30:44 +0000 Subject: [PATCH] dump_gti: fix I/O error when touch fails to resume Bug: 289680312 Test: dump_gti works properly Change-Id: I8881102161d6e69fa9c188c751f332f5762bf7c7 Signed-off-by: Wendly Li --- touch/gti/dump_gti0.sh | 21 ++++++++++++++++++++- touch/gti/dump_gti1.sh | 21 ++++++++++++++++++++- 2 files changed, 40 insertions(+), 2 deletions(-) diff --git a/touch/gti/dump_gti0.sh b/touch/gti/dump_gti0.sh index 69293dd..a3af3d7 100644 --- a/touch/gti/dump_gti0.sh +++ b/touch/gti/dump_gti0.sh @@ -9,7 +9,26 @@ heatmap_path=$path fi echo "------ Force Touch Active ------" -echo 1 > $path/force_active +result=$( cat "$path/force_active" 2>&1 ) +if [ $? -eq 0 ]; then + state=$( echo "$result" |cut -d " " -f 2 ) + if [ "$state" = "locked" ]; then + echo "The force_active is already locked!" + else + echo 1 > $path/force_active + if [ $? -ne 0 ]; then + echo "Failed to active touch device" + exit 1 + fi + fi +else + if [[ $result == *Operation\ not\ supported* ]]; then + echo "force_active is not support, skip it" + else + echo "Failed to read the state of force_force" + exit 1 + fi +fi echo "------ Touch Firmware Version ------" cat $path/fw_ver diff --git a/touch/gti/dump_gti1.sh b/touch/gti/dump_gti1.sh index 8cc69cf..297ad44 100644 --- a/touch/gti/dump_gti1.sh +++ b/touch/gti/dump_gti1.sh @@ -9,7 +9,26 @@ heatmap_path=$path fi echo "------ Force Touch Active ------" -echo 1 > $path/force_active +result=$( cat "$path/force_active" 2>&1 ) +if [ $? -eq 0 ]; then + state=$( echo "$result" |cut -d " " -f 2 ) + if [ "$state" = "locked" ]; then + echo "The force_active is already locked!" + else + echo 1 > $path/force_active + if [ $? -ne 0 ]; then + echo "Failed to active touch device" + exit 1 + fi + fi +else + if [[ $result == *Operation\ not\ supported* ]]; then + echo "force_active is not support, skip it" + else + echo "Failed to read the state of force_force" + exit 1 + fi +fi echo "------ Touch Firmware Version ------" cat $path/fw_ver