From 7508b08c11d6fe7078f11ec3415f4e3a30ae4960 Mon Sep 17 00:00:00 2001 From: Pierre-Hugues Husson Date: Mon, 12 Aug 2019 22:50:17 +0200 Subject: [PATCH] If /sys/class/sec/tsp rules are obviously completely broken, unbreak them a little --- rw-system.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/rw-system.sh b/rw-system.sh index d792fc7..dc95efb 100644 --- a/rw-system.sh +++ b/rw-system.sh @@ -346,4 +346,16 @@ fi if getprop ro.vendor.build.fingerprint | grep -qiE '^samsung/' && [ "$vndk" -ge 28 ];then setprop persist.sys.phh.samsung_fingerprint -1 + #obviously broken perms + if [ "$(stat -c '%A' /sys/class/sec/tsp/ear_detect_enable)" == "-rw-rw-r--" ] && + [ "$(stat -c '%U' /sys/class/sec/tsp/ear_detect_enable)" == "root" ] && + [ "$(stat -c '%G' /sys/class/sec/tsp/ear_detect_enable)" == "root" ];then + + chcon u:object_r:sysfs_ss_writable:s0 /sys/class/sec/tsp/ear_detect_enable + chown system /sys/class/sec/tsp/ear_detect_enable + + chcon u:object_r:sysfs_ss_writable:s0 /sys/class/sec/tsp/cmd + chcon u:object_r:sysfs_ss_writable:s0 /sys/class/sec/tsp/cmd_{list,result,status} + chown system /sys/class/sec/tsp/cmd_{list,result,status} + fi fi