1#!/vendor/bin/sh
2path="/sys/devices/virtual/goog_touch_interface/gti.0"
3procfs_path="/proc/goog_touch_interface/gti.0"
4
5if [[ -d "$procfs_path" ]]; then
6heatmap_path=$procfs_path
7else
8heatmap_path=$path
9fi
10
11echo "------ Force Touch Active ------"
12result=$( cat "$path/force_active" 2>&1 )
13if [ $? -eq 0 ]; then
14    state=$( echo "$result" |cut -d " " -f 2 )
15    if [ "$state" = "locked" ]; then
16        echo "The force_active is already locked!"
17    else
18        echo 1 > $path/force_active
19        if [ $? -ne 0  ]; then
20            echo "Failed to active touch device"
21            exit 1
22        fi
23    fi
24else
25    if [[ $result == *Operation\ not\ supported* ]]; then
26        echo "force_active is not support, skip it"
27    else
28        echo "Failed to read the state of force_force"
29        exit 1
30    fi
31fi
32
33echo "------ Touch Firmware Version ------"
34cat $path/fw_ver
35
36echo "------ Panel ID ------"
37cat $path/panel_id
38
39echo "------ Offload ID ------"
40cat $path/offload_id
41
42echo "------ Get Mutual Sensing Data - Baseline ------"
43cat $heatmap_path/ms_base
44
45echo "------ Get Mutual Sensing Data - Delta ------"
46cat $heatmap_path/ms_diff
47
48echo "------ Get Mutual Sensing Data - Raw ------"
49cat $heatmap_path/ms_raw
50
51echo "------ Get Self Sensing Data - Baseline ------"
52cat $heatmap_path/ss_base
53
54echo "------ Get Self Sensing Data - Delta ------"
55cat $heatmap_path/ss_diff
56
57echo "------ Get Self Sensing Data - Raw ------"
58cat $heatmap_path/ss_raw
59
60echo "------ Self Test ------"
61cat $path/self_test
62
63if [[ -f "${procfs_path}/dump" ]]; then
64  echo "------ Dump ------"
65  cat ${procfs_path}/dump
66fi
67
68echo "------ Disable Force Touch Active ------"
69echo 0 > $path/force_active
70