From 070727ce81f6af1cd9bd4065f8dffeb2ac0ac970 Mon Sep 17 00:00:00 2001 From: therootlord Date: Tue, 25 Sep 2018 14:03:31 -0300 Subject: [PATCH] sanders: rootdir: add sensors init script from LA.UM.7.6.2.r1-03200-89xx.0 --- device.mk | 1 + rootdir/Android.mk | 8 ++++++ rootdir/etc/init.mmi.rc | 6 ----- rootdir/etc/init.qcom.rc | 29 +++++++++++++++++++++ rootdir/etc/init.qcom.sensors.sh | 44 ++++++++++++++++++++++++++++++++ 5 files changed, 82 insertions(+), 6 deletions(-) create mode 100755 rootdir/etc/init.qcom.sensors.sh diff --git a/device.mk b/device.mk index 4474f4b..c9cd4e1 100644 --- a/device.mk +++ b/device.mk @@ -326,6 +326,7 @@ PRODUCT_PACKAGES += \ init.mmi.rc \ init.mmi.usb.rc \ init.qcom.rc \ + init.qcom.sensors.sh PRODUCT_COPY_FILES += \ $(LOCAL_PATH)/rootdir/etc/ueventd.qcom.rc:$(TARGET_COPY_OUT_VENDOR)/ueventd.rc diff --git a/rootdir/Android.mk b/rootdir/Android.mk index 7c940ba..58ab7df 100644 --- a/rootdir/Android.mk +++ b/rootdir/Android.mk @@ -42,6 +42,14 @@ LOCAL_SRC_FILES := etc/init.qcom.ril.sh LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_EXECUTABLES) include $(BUILD_PREBUILT) +include $(CLEAR_VARS) +LOCAL_MODULE := init.qcom.sensors.sh +LOCAL_MODULE_TAGS := optional eng +LOCAL_MODULE_CLASS := EXECUTABLES +LOCAL_SRC_FILES := etc/init.qcom.sensors.sh +LOCAL_VENDOR_MODULE := true +include $(BUILD_PREBUILT) + # Init scripts include $(CLEAR_VARS) LOCAL_MODULE := fstab.qcom diff --git a/rootdir/etc/init.mmi.rc b/rootdir/etc/init.mmi.rc index e0f8e93..4c76297 100644 --- a/rootdir/etc/init.mmi.rc +++ b/rootdir/etc/init.mmi.rc @@ -280,12 +280,6 @@ service vendor.mmi-boot-sh /vendor/bin/sh /vendor/bin/init.mmi.boot.sh oneshot disabled -# Sanders uses qti sensor service -service vendor.sensors.qti /vendor/bin/sensors.qti - class core - user root - group root - service vendor.charge_only_mode /vendor/bin/charge_only_mode user root group graphics system input diff --git a/rootdir/etc/init.qcom.rc b/rootdir/etc/init.qcom.rc index cdb6bd9..7fc3616 100644 --- a/rootdir/etc/init.qcom.rc +++ b/rootdir/etc/init.qcom.rc @@ -84,6 +84,24 @@ on early-boot # Motorola uses external sensorhub, do not boot the slpi # write /sys/kernel/boot_slpi/boot 1 + # for backward compatibility + chown system system /persist/sensors + chown system system /persist/sensors/registry + chown system system /persist/sensors/registry/registry + chown system system /persist/sensors/registry/registry/sensors_registry + chown system system /persist/sensors/sensors_settings + chown system system /persist/sensors/registry/config + chmod 0664 /persist/sensors/sensors_settings + + chown system system /mnt/vendor/persist/sensors + chown system system /mnt/vendor/persist/sensors/registry + chown system system /mnt/vendor/persist/sensors/registry/registry + chown system system /mnt/vendor/persist/sensors/registry/registry/sensors_registry + chown system system /mnt/vendor/persist/sensors/sensors_settings + chown system system /mnt/vendor/persist/sensors/registry/sns_reg_config + chown system system /mnt/vendor/persist/sensors/registry/config + chmod 0664 /mnt/vendor/persist/sensors/sensors_settings + on boot # access permission for secure touch chmod 0660 /sys/devices/soc/78b7000.i2c/i2c-3/3-0020/input/input0/secure_touch_enable @@ -685,6 +703,12 @@ service vendor.qti /vendor/bin/qti group radio net_raw oem_2950 usb net_admin writepid /dev/cpuset/system-background/tasks +service vendor.sensors.qti /vendor/bin/sensors.qti + class core + user system + group system + disabled + on property:ro.use_data_netmgrd=false # netmgr not supported on specific target stop vendor.netmgrd @@ -823,6 +847,11 @@ on property:crypto.driver.load=1 insmod /vendor/lib/modules/qce.ko insmod /vendor/lib/modules/qcedev.ko +service vendor-sensor-sh /vendor/bin/init.qcom.sensors.sh + class core + user root + oneshot + service atfwd /vendor/bin/ATFWD-daemon class late_start user system diff --git a/rootdir/etc/init.qcom.sensors.sh b/rootdir/etc/init.qcom.sensors.sh new file mode 100755 index 0000000..d2eb8e1 --- /dev/null +++ b/rootdir/etc/init.qcom.sensors.sh @@ -0,0 +1,44 @@ +#!/vendor/bin/sh +# Copyright (c) 2015, 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. +# + +# +# Function to start sensors for SSC enabled platforms +# +start_sensors() +{ + chmod -h 664 /persist/sensors/sensors_settings + chown -h -R system.system /persist/sensors + start vendor.sensors.qti + + # Only for SLPI + if [ -c /dev/msm_dsps -o -c /dev/sensors ]; then + start vendor.sensors + fi +} + +start_sensors