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