From 453a29320a97e24a1e4bd43d9712c32d0973f14e Mon Sep 17 00:00:00 2001 From: Kuen-Han Tsai Date: Fri, 2 Feb 2024 13:46:41 +0800 Subject: [PATCH] usb: add disable_contanimant_detection This patch adds the disable_contaminant_detection script, providing a command-based method to bypass moisture detection. Bug: 295127978 Test: disable moisture detection by 'setprop vendor.usb.contaminantdisable true' Change-Id: I035d656401aedf11a9a5390504bec46b3c4e2634 Signed-off-by: Kuen-Han Tsai --- Android.bp | 7 +++++++ conf/init.zumapro.usb.rc | 3 +++ device.mk | 4 ++++ disable_contaminant_detection.sh | 7 +++++++ 4 files changed, 21 insertions(+) create mode 100644 disable_contaminant_detection.sh diff --git a/Android.bp b/Android.bp index e719cab..7156389 100644 --- a/Android.bp +++ b/Android.bp @@ -34,3 +34,10 @@ license { "NOTICE", ], } + +sh_binary { + name: "disable_contaminant_detection.sh", + src: "disable_contaminant_detection.sh", + vendor: true, + sub_dir: "hw", +} diff --git a/conf/init.zumapro.usb.rc b/conf/init.zumapro.usb.rc index 322e530..8f33d1e 100644 --- a/conf/init.zumapro.usb.rc +++ b/conf/init.zumapro.usb.rc @@ -296,6 +296,9 @@ on property:sys.usb.config=charger && property:sys.usb.configfs=1 on property:ro.bootmode=usbuwb setprop persist.vendor.usb.usbradio.config uwb_acm +on property:vendor.usb.contaminantdisable=true + exec /vendor/bin/hw/disable_contaminant_detection.sh + on property:persist.vendor.usb.displayport.enabled=1 write /sys/module/exynos_drm/parameters/dp_enabled 1 write /sys/class/typec/port0/port0.0/mode1/active "yes" diff --git a/device.mk b/device.mk index aea5c16..ca0e409 100644 --- a/device.mk +++ b/device.mk @@ -380,6 +380,10 @@ PRODUCT_COPY_FILES += \ device/google/$(TARGET_BOARD_PLATFORM)/conf/fstab.persist:$(TARGET_COPY_OUT_VENDOR)/etc/fstab.persist \ device/google/$(TARGET_BOARD_PLATFORM)/conf/fstab.modem:$(TARGET_COPY_OUT_VENDOR)/etc/fstab.modem +# Shell scripts +PRODUCT_PACKAGES += \ + disable_contaminant_detection.sh + include device/google/gs-common/insmod/insmod.mk # Insmod config files diff --git a/disable_contaminant_detection.sh b/disable_contaminant_detection.sh new file mode 100644 index 0000000..fde6eb4 --- /dev/null +++ b/disable_contaminant_detection.sh @@ -0,0 +1,7 @@ +#!/vendor/bin/sh + +for f in /sys/devices/platform/108d0000.hsi2c/i2c-*/*-0025; do + if [ -d $f ]; then + echo 0 > $f/contaminant_detection; + fi +done