diff --git a/base.mk b/base.mk index 69f51c11..218907fd 100644 --- a/base.mk +++ b/base.mk @@ -257,6 +257,7 @@ INIT += init.qcom.uicc.sh INIT += fstab.qcom INIT += init.qcom.debug.sh INIT += init.qcom.zram.sh +INIT += init.qcom.sensors.sh #IPROUTE2 IPROUTE2 := ip diff --git a/rootdir/Android.mk b/rootdir/Android.mk index 79d394f4..92d9171c 100644 --- a/rootdir/Android.mk +++ b/rootdir/Android.mk @@ -210,3 +210,11 @@ LOCAL_MODULE_TAGS := optional eng LOCAL_MODULE_CLASS := ETC LOCAL_SRC_FILES := etc/init.qcom.uicc.sh include $(BUILD_PREBUILT) + +include $(CLEAR_VARS) +LOCAL_MODULE := init.qcom.sensors.sh +LOCAL_MODULE_TAGS := optional eng +LOCAL_MODULE_CLASS := ETC +LOCAL_SRC_FILES := etc/init.qcom.sensors.sh +LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT) +include $(BUILD_PREBUILT) diff --git a/rootdir/etc/init.qcom.rc b/rootdir/etc/init.qcom.rc index c6d74fd0..57839919 100644 --- a/rootdir/etc/init.qcom.rc +++ b/rootdir/etc/init.qcom.rc @@ -704,6 +704,11 @@ service qcom-sh /system/bin/sh /init.qcom.sh user root oneshot +service sensor-sh /system/bin/sh /init.qcom.sensors.sh + class core + user root + oneshot + service qcom-post-boot /system/bin/sh /system/etc/init.qcom.post_boot.sh class late_start user root diff --git a/rootdir/etc/init.qcom.sensors.sh b/rootdir/etc/init.qcom.sensors.sh new file mode 100644 index 00000000..a5375046 --- /dev/null +++ b/rootdir/etc/init.qcom.sensors.sh @@ -0,0 +1,46 @@ +#!/system/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() +{ + if [ -c /dev/msm_dsps -o -c /dev/sensors ]; then + chmod -h 775 /persist/sensors + chmod -h 664 /persist/sensors/sensors_settings + chown -h system.root /persist/sensors/sensors_settings + + mkdir -p /data/misc/sensors + chmod -h 775 /data/misc/sensors + + start sensors + fi +} + +start_sensors diff --git a/rootdir/etc/init.qcom.sh b/rootdir/etc/init.qcom.sh index 736a9b78..0ea5cae2 100644 --- a/rootdir/etc/init.qcom.sh +++ b/rootdir/etc/init.qcom.sh @@ -32,22 +32,6 @@ if [ -f /sys/devices/soc0/soc_id ]; then else platformid=`cat /sys/devices/system/soc/soc0/id` fi -# -# Function to start sensors for DSPS enabled platforms -# -start_sensors() -{ - if [ -c /dev/msm_dsps -o -c /dev/sensors ]; then - chmod -h 775 /persist/sensors - chmod -h 664 /persist/sensors/sensors_settings - chown -h system.root /persist/sensors/sensors_settings - - mkdir -p /data/misc/sensors - chmod -h 775 /data/misc/sensors - - start sensors - fi -} start_battery_monitor() { @@ -128,7 +112,6 @@ case "$baseband" in ;; esac -start_sensors start_copying_prebuilt_qcril_db case "$target" in