berlna: recovery: add touch script to recovery

Signed-off-by: Andrew Hexen <SyberHexen@gmail.com>
Change-Id: I3daf399871b997f18a6d2aa25fac4926c373def3
This commit is contained in:
Andrew Hexen 2022-07-01 22:49:12 -07:00
parent 6817881611
commit b985836432
No known key found for this signature in database
GPG key ID: 8A690B4B0CD461A2
5 changed files with 127 additions and 0 deletions

View file

@ -67,6 +67,11 @@ $(foreach f,$(wildcard $(LOCAL_PATH)/rootdir/etc/init/*.rc),\
$(foreach f,$(wildcard $(LOCAL_PATH)/rootdir/bin/*.sh),\ $(foreach f,$(wildcard $(LOCAL_PATH)/rootdir/bin/*.sh),\
$(eval PRODUCT_COPY_FILES += $(f):$(TARGET_COPY_OUT_VENDOR)/bin/$(notdir $f))) $(eval PRODUCT_COPY_FILES += $(f):$(TARGET_COPY_OUT_VENDOR)/bin/$(notdir $f)))
# Init (recovery)
PRODUCT_PACKAGES += \
init.recovery.berlna.rc \
load_touch.sh
# Lineage Touch # Lineage Touch
PRODUCT_PACKAGES += \ PRODUCT_PACKAGES += \
vendor.lineage.touch@1.0-service.berlna vendor.lineage.touch@1.0-service.berlna

20
recovery/Android.mk Normal file
View file

@ -0,0 +1,20 @@
LOCAL_PATH := $(call my-dir)
# Recovery-Stuffs
include $(CLEAR_VARS)
LOCAL_MODULE := init.recovery.berlna.rc
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE_CLASS := ETC
LOCAL_SRC_FILES := etc/init.recovery.berlna.rc
LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/
include $(BUILD_PREBUILT)
include $(CLEAR_VARS)
LOCAL_MODULE := load_touch.sh
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE_CLASS := ETC
LOCAL_SRC_FILES := bin/load_touch.sh
LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/vendor/bin/
include $(BUILD_PREBUILT)

View file

@ -0,0 +1,60 @@
#!/system/bin/sh
firmware_path=/vendor/firmware
touch_class_path=/sys/class/touchscreen
touch_path=
firmware_file=
wait_for_poweron()
{
local wait_nomore
local readiness
local count
echo "wait until driver reports <ready to flash>..."
wait_nomore=60
count=0
while true; do
readiness=$(cat $touch_path/poweron)
if [ "$readiness" == "1" ]; then
echo "ready to flash!!!"
break;
fi
count=$((count+1))
[ $count -eq $wait_nomore ] && break
sleep 1
echo "not ready; keep waiting..."
done
if [ $count -eq $wait_nomore ]; then
return 1
fi
return 0
}
load_touch()
{
panel_supplier=""
panel_supplier=$(cat /sys/class/touchscreen/*/panel_supplier)
echo "panel supplier vendor is: [$panel_supplier]"
cd $firmware_path
case $panel_supplier in
tianma)
firmware_file="novatek_ts-NT36675-21061805-603a-berlna.bin"
;;
esac
echo "Firmware file for upgrade $firmware_file"
touch_path=/sys/class/touchscreen/$(ls /sys/class/touchscreen/)
wait_for_poweron
wait
echo "forcing firmware upgrade"
echo 1 > $touch_path/forcereflash
wait
echo "sending reflash command"
echo $firmware_file > $touch_path/doreflash
sleep 1.5
echo "Resetting Touch"
echo 1 > $touch_path/reset
}
load_touch
exit 0

View file

@ -0,0 +1,39 @@
# Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of The Linux Foundation nor
# the names of its contributors may be used to endorse or promote
# products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
on boot
start load_touch
on property:sys.usb.config=fastboot
start load_touch
service load_touch vendor/bin/load_touch.sh
oneshot
disabled
user root
group root
seclabel u:r:recovery:s0

View file

@ -7,3 +7,6 @@
# Fingerprint # Fingerprint
/(mnt/vendor)/persist/egis(/.*)? u:object_r:fingerprint_vendor_data_file:s0 /(mnt/vendor)/persist/egis(/.*)? u:object_r:fingerprint_vendor_data_file:s0
/sys/devices/soc/0.et320(/.*)? u:object_r:vendor_sysfs_fingerprint:s0 /sys/devices/soc/0.et320(/.*)? u:object_r:vendor_sysfs_fingerprint:s0
# Vendor init scripts
/(vendor|system/vendor)/bin/load_touch\.sh u:object_r:vendor_qti_init_shell_exec:s0