From d8180e5dfeebbd16d2533b8972a1bdd24c167f94 Mon Sep 17 00:00:00 2001 From: Adam Shih Date: Fri, 18 Nov 2022 13:30:42 +0800 Subject: [PATCH] create focaltech folder for touch Bug: 256521567 Test: adb bugreport Change-Id: Ibff80f64ca78bd81a5cb5542183866d9a0863ec5 --- touch/focaltech/Android.bp | 11 ++++++ touch/focaltech/dump_focaltech.sh | 42 ++++++++++++++++++++++ touch/focaltech/focaltech.mk | 3 ++ touch/focaltech/init.touch.rc | 28 +++++++++++++++ touch/focaltech/sepolicy/dump_focaltech.te | 5 +++ touch/focaltech/sepolicy/file.te | 2 ++ touch/focaltech/sepolicy/file_contexts | 2 ++ touch/focaltech/sepolicy/genfs_contexts | 3 ++ touch/focaltech/sepolicy/vendor_init.te | 2 ++ 9 files changed, 98 insertions(+) create mode 100644 touch/focaltech/Android.bp create mode 100644 touch/focaltech/dump_focaltech.sh create mode 100644 touch/focaltech/focaltech.mk create mode 100644 touch/focaltech/init.touch.rc create mode 100644 touch/focaltech/sepolicy/dump_focaltech.te create mode 100644 touch/focaltech/sepolicy/file.te create mode 100644 touch/focaltech/sepolicy/file_contexts create mode 100644 touch/focaltech/sepolicy/genfs_contexts create mode 100644 touch/focaltech/sepolicy/vendor_init.te diff --git a/touch/focaltech/Android.bp b/touch/focaltech/Android.bp new file mode 100644 index 0000000..ebaa308 --- /dev/null +++ b/touch/focaltech/Android.bp @@ -0,0 +1,11 @@ +package { + default_applicable_licenses: ["Android-Apache-2.0"], +} + +sh_binary { + name: "dump_focaltech.sh", + src: "dump_focaltech.sh", + init_rc: ["init.touch.rc"], + vendor: true, + sub_dir: "dump", +} diff --git a/touch/focaltech/dump_focaltech.sh b/touch/focaltech/dump_focaltech.sh new file mode 100644 index 0000000..82bd2cd --- /dev/null +++ b/touch/focaltech/dump_focaltech.sh @@ -0,0 +1,42 @@ +#!/vendor/bin/sh +path="/proc/focaltech_touch" + +echo "------ Enable Force Touch Active ------" +echo 21 > $path/force_active + +echo "------ Touch Firmware Version ------" +cat $path/FW_Version + +echo "------ Touch INT PIN Test ------" +cat $path/INT_PIN + +echo "------ Get Raw Data - Panel_Differ ------" +cat $path/selftest/Panel_Differ + +echo "------ Get Raw Data - Raw ------" +cat $path/selftest/Rawdata + +echo "------ Get Raw Data - Baseline ------" +cat $path/selftest/Baseline + +echo "------ Get Raw Data - Noise ------" +cat $path/selftest/Noise + +echo "------ Get Raw Data - Uniformity ------" +cat $path/selftest/Rawdata_Uniformity + +echo "------ Get Scap_CB ------" +cat $path/selftest/Scap_CB + +echo "------ Get Scap_Rawdata ------" +cat $path/selftest/Scap_Rawdata + +echo "------ Get Short Test ------" +cat $path/selftest/Short + +echo "------ Get HeatMap(ms,ss) ------" +cat $path/selftest/Strength + +echo "------ Disable Force Touch Active ------" +echo 20 > $path/force_active + diff --git a/touch/focaltech/focaltech.mk b/touch/focaltech/focaltech.mk new file mode 100644 index 0000000..5236586 --- /dev/null +++ b/touch/focaltech/focaltech.mk @@ -0,0 +1,3 @@ +BOARD_VENDOR_SEPOLICY_DIRS += device/google/gs-common/touch/focaltech/sepolicy + +PRODUCT_PACKAGES += dump_focaltech.sh diff --git a/touch/focaltech/init.touch.rc b/touch/focaltech/init.touch.rc new file mode 100644 index 0000000..b517d9e --- /dev/null +++ b/touch/focaltech/init.touch.rc @@ -0,0 +1,28 @@ +on property:vendor.device.modules.ready=1 + chown system system /proc/focaltech_touch/Channel_Num + chown system system /proc/focaltech_touch/FW_Version + chown system system /proc/focaltech_touch/INT_PIN + chown system system /proc/focaltech_touch/force_active + chown system system /proc/focaltech_touch/Reset_Pin + chown system system /proc/focaltech_touch/fw_grip + chown system system /proc/focaltech_touch/fw_palm + chown system system /proc/focaltech_touch/heatmap_onoff + chown system system /proc/focaltech_touch/mf_mode + chown system system /proc/focaltech_touch/selftest/Baseline + chown system system /proc/focaltech_touch/selftest/Noise + chown system system /proc/focaltech_touch/selftest/Panel_Differ + chown system system /proc/focaltech_touch/selftest/Rawdata + chown system system /proc/focaltech_touch/selftest/Rawdata_Uniformity + chown system system /proc/focaltech_touch/selftest/Scap_CB + chown system system /proc/focaltech_touch/selftest/Scap_Rawdata + chown system system /proc/focaltech_touch/selftest/Short + chown system system /proc/focaltech_touch/selftest/Strength + +# Toggle glove_mode according to touch_sensitivity_mode +on property:persist.vendor.touch_sensitivity_mode=0 && property:sys.boot_completed=1 + write /proc/focaltech_touch/high_sensitivity 0 + +on property:persist.vendor.touch_sensitivity_mode=1 && property:sys.boot_completed=1 + write /proc/focaltech_touch/high_sensitivity 1 + + diff --git a/touch/focaltech/sepolicy/dump_focaltech.te b/touch/focaltech/sepolicy/dump_focaltech.te new file mode 100644 index 0000000..0b0fb9a --- /dev/null +++ b/touch/focaltech/sepolicy/dump_focaltech.te @@ -0,0 +1,5 @@ +pixel_bugreport(dump_focaltech) + +allow dump_focaltech proc_touch:dir r_dir_perms; +allow dump_focaltech proc_touch:file rw_file_perms; +allow dump_focaltech vendor_toolbox_exec:file execute_no_trans; diff --git a/touch/focaltech/sepolicy/file.te b/touch/focaltech/sepolicy/file.te new file mode 100644 index 0000000..929bf69 --- /dev/null +++ b/touch/focaltech/sepolicy/file.te @@ -0,0 +1,2 @@ +type proc_touch, proc_type, fs_type; + diff --git a/touch/focaltech/sepolicy/file_contexts b/touch/focaltech/sepolicy/file_contexts new file mode 100644 index 0000000..250aaf9 --- /dev/null +++ b/touch/focaltech/sepolicy/file_contexts @@ -0,0 +1,2 @@ +/vendor/bin/dump/dump_focaltech\.sh u:object_r:dump_focaltech_exec:s0 + diff --git a/touch/focaltech/sepolicy/genfs_contexts b/touch/focaltech/sepolicy/genfs_contexts new file mode 100644 index 0000000..2ac9314 --- /dev/null +++ b/touch/focaltech/sepolicy/genfs_contexts @@ -0,0 +1,3 @@ +genfscon proc /focaltech_touch u:object_r:proc_touch:s0 + + diff --git a/touch/focaltech/sepolicy/vendor_init.te b/touch/focaltech/sepolicy/vendor_init.te new file mode 100644 index 0000000..117288e --- /dev/null +++ b/touch/focaltech/sepolicy/vendor_init.te @@ -0,0 +1,2 @@ +allow vendor_init proc_touch:file w_file_perms; +