create raven touch dump

Bug: 256521567
Test: adb bugreport
Change-Id: Ibf5d74936605f7b0a3a2124bb7df094c60644c23
diff --git a/touch/lsi/Android.bp b/touch/lsi/Android.bp
new file mode 100644
index 0000000..b0cef6f
--- /dev/null
+++ b/touch/lsi/Android.bp
@@ -0,0 +1,10 @@
+package {
+    default_applicable_licenses: ["Android-Apache-2.0"],
+}
+
+sh_binary {
+    name: "dump_lsi.sh",
+    src: "dump_lsi.sh",
+    vendor: true,
+    sub_dir: "dump",
+}
diff --git a/touch/lsi/dump_lsi.sh b/touch/lsi/dump_lsi.sh
new file mode 100644
index 0000000..57c7f4d
--- /dev/null
+++ b/touch/lsi/dump_lsi.sh
@@ -0,0 +1,48 @@
+#!/vendor/bin/sh
+path="/sys/devices/virtual/sec/tsp"
+
+echo "--- Force Touch Active ---"
+echo "force_touch_active,2,1" > $path/cmd && cat $path/cmd_result
+
+echo "--- LSI firmware version ---"
+cat $path/fw_version
+
+echo "--- LSI touch status ---"
+cat $path/status
+
+echo "--- Calibration info ---"
+echo "get_mis_cal_info" > $path/cmd && cat $path/cmd_result
+
+echo "--- Mutual Strength ---"
+echo "run_delta_read_all" > $path/cmd && cat $path/cmd_result
+
+echo "--- Self Strength ---"
+echo "run_self_delta_read_all" > $path/cmd && cat $path/cmd_result
+
+echo "--- TYPE_AMBIENT_DATA ---"
+echo "run_rawdata_read_type,3" > $path/cmd && cat $path/cmd_result
+
+echo "--- TYPE_DECODED_DATA ---"
+echo "run_rawdata_read_type,5" > $path/cmd && cat $path/cmd_result
+
+echo "--- TYPE_OFFSET_DATA_SEC ---"
+echo "run_rawdata_read_type,19" > $path/cmd && cat $path/cmd_result
+
+echo "--- TYPE_NOI_P2P_MIN ---"
+echo "run_rawdata_read_type,30" > $path/cmd && cat $path/cmd_result
+
+echo "--- TYPE_NOI_P2P_MAX ---"
+echo "run_rawdata_read_type,31" > $path/cmd && cat $path/cmd_result
+
+echo "--- Mutual Raw Cap ---"
+echo "run_rawcap_read_all" > $path/cmd && cat $path/cmd_result
+
+echo "--- Self Raw Cap ---"
+echo "run_self_rawcap_read_all" > $path/cmd && cat $path/cmd_result
+
+echo "--- CM2 ---"
+echo "run_rawcap_high_freq_read_all" > $path/cmd && cat $path/cmd_result
+
+echo "--- Force Touch Active ---"
+echo force_touch_active,2,0 > $path/cmd && cat $path/cmd_result
+
diff --git a/touch/lsi/lsi.mk b/touch/lsi/lsi.mk
new file mode 100644
index 0000000..bcb69bb
--- /dev/null
+++ b/touch/lsi/lsi.mk
@@ -0,0 +1,3 @@
+BOARD_VENDOR_SEPOLICY_DIRS += device/google/gs-common/touch/lsi/sepolicy
+
+PRODUCT_PACKAGES += dump_lsi.sh
diff --git a/touch/lsi/sepolicy/dump_lsi.te b/touch/lsi/sepolicy/dump_lsi.te
new file mode 100644
index 0000000..a2e114d
--- /dev/null
+++ b/touch/lsi/sepolicy/dump_lsi.te
@@ -0,0 +1,5 @@
+pixel_bugreport(dump_lsi)
+
+allow dump_lsi sysfs_touch:dir r_dir_perms;
+allow dump_lsi sysfs_touch:file rw_file_perms;
+allow dump_lsi vendor_toolbox_exec:file execute_no_trans;
diff --git a/touch/lsi/sepolicy/file_contexts b/touch/lsi/sepolicy/file_contexts
new file mode 100644
index 0000000..c1048fa
--- /dev/null
+++ b/touch/lsi/sepolicy/file_contexts
@@ -0,0 +1,2 @@
+/vendor/bin/dump/dump_lsi\.sh      u:object_r:dump_lsi_exec:s0
+
diff --git a/touch/lsi/sepolicy/genfs_contexts b/touch/lsi/sepolicy/genfs_contexts
new file mode 100644
index 0000000..6dce360
--- /dev/null
+++ b/touch/lsi/sepolicy/genfs_contexts
@@ -0,0 +1,2 @@
+genfscon sysfs /devices/virtual/sec/tsp        u:object_r:sysfs_touch:s0
+