msm8953-common: Initial Common tree

* based on motorola sdm632-common

Co-authored-by: Jorg3Lucas <jorgelucas@pixelexperience.org>
This commit is contained in:
jeangraff30
2020-09-06 15:31:00 +02:00
commit 1220e128cd
154 changed files with 23679 additions and 0 deletions

View File

@@ -0,0 +1,155 @@
#! /vendor/bin/sh
# Copyright (c) 2013-2014, 2019 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.
#
#
# start ril-daemon only for targets on which radio is present
#
baseband=`getprop ro.baseband`
sgltecsfb=`getprop persist.vendor.radio.sglte_csfb`
datamode=`getprop persist.vendor.data.mode`
qcrild_status=true
case "$baseband" in
"apq" | "sda" | "qcs" )
setprop ro.vendor.radio.noril yes
stop ril-daemon
stop vendor.ril-daemon
stop vendor.qcrild
esac
case "$baseband" in
"msm" | "csfb" | "svlte2a" | "mdm" | "mdm2" | "sglte" | "sglte2" | "dsda2" | "unknown" | "dsda3" | "sdm" | "sdx" | "sm6")
# For older modem packages launch ril-daemon.
if [ -f /vendor/firmware_mnt/verinfo/ver_info.txt ]; then
modem=`cat /vendor/firmware_mnt/verinfo/ver_info.txt |
sed -n 's/^[^:]*modem[^:]*:[[:blank:]]*//p' |
sed 's/.*MPSS.\(.*\)/\1/g' | cut -d \. -f 1`
if [ "$modem" = "AT" ]; then
version=`cat /vendor/firmware_mnt/verinfo/ver_info.txt |
sed -n 's/^[^:]*modem[^:]*:[[:blank:]]*//p' |
sed 's/.*AT.\(.*\)/\1/g' | cut -d \- -f 1`
if [ ! -z $version ]; then
if [ "$version" \< "3.1" ]; then
qcrild_status=false
fi
fi
elif [ "$modem" = "TA" ]; then
version=`cat /vendor/firmware_mnt/verinfo/ver_info.txt |
sed -n 's/^[^:]*modem[^:]*:[[:blank:]]*//p' |
sed 's/.*TA.\(.*\)/\1/g' | cut -d \- -f 1`
if [ ! -z $version ]; then
if [ "$version" \< "3.0" ]; then
qcrild_status=false
fi
fi
elif [ "$modem" = "JO" ]; then
version=`cat /vendor/firmware_mnt/verinfo/ver_info.txt |
sed -n 's/^[^:]*modem[^:]*:[[:blank:]]*//p' |
sed 's/.*JO.\(.*\)/\1/g' | cut -d \- -f 1`
if [ ! -z $version ]; then
if [ "$version" \< "3.2" ]; then
qcrild_status=false
fi
fi
elif [ "$modem" = "TH" ]; then
qcrild_status=false
fi
else
qcrild_status=false
fi
if [ "$qcrild_status" = "true" ]; then
# Make sure both rild, qcrild are not running at same time.
# This is possible with vanilla aosp system image.
stop ril-daemon
stop vendor.ril-daemon
start vendor.qcrild
else
start ril-daemon
start vendor.ril-daemon
fi
case "$baseband" in
"svlte2a" | "csfb")
start qmiproxy
;;
"sglte" | "sglte2" )
if [ "x$sgltecsfb" != "xtrue" ]; then
start qmiproxy
else
setprop persist.vendor.radio.voice.modem.index 0
fi
;;
esac
multisim=`getprop persist.radio.multisim.config`
if [ "$multisim" = "dsds" ] || [ "$multisim" = "dsda" ]; then
if [ "$qcrild_status" = "true" ]; then
start vendor.qcrild2
else
start vendor.ril-daemon2
fi
elif [ "$multisim" = "tsts" ]; then
if [ "$qcrild_status" = "true" ]; then
start vendor.qcrild2
start vendor.qcrild3
else
start vendor.ril-daemon2
start vendor.ril-daemon3
fi
fi
case "$datamode" in
"tethered")
start vendor.dataqti
start vendor.dataadpl
;;
"concurrent")
start vendor.dataqti
start vendor.dataadpl
;;
*)
;;
esac
esac
#
# Allow persistent faking of bms
# User needs to set fake bms charge in persist.vendor.bms.fake_batt_capacity
#
fake_batt_capacity=`getprop persist.vendor.bms.fake_batt_capacity`
case "$fake_batt_capacity" in
"") ;; #Do nothing here
* )
echo "$fake_batt_capacity" > /sys/class/power_supply/battery/capacity
;;
esac

View File

@@ -0,0 +1,46 @@
#!/vendor/bin/sh
PATH=/sbin:/vendor/bin
export PATH
scriptname=${0##*/}
# We take this from cpuinfo because hex "letters" are lowercase there - (lolwhat)
cinfo=`getprop ro.boot.hwrev`
hw=${cinfo#???}
# Now "cook" the value so it can be matched against devtree names
m2=${hw%?}
minor2=${hw#$m2}
m1=${m2%?}
minor1=${m2#$m1}
if [ "$minor2" == "0" ]; then
minor2=""
if [ "$minor1" == "0" ]; then
minor1=""
fi
fi
rev="p${hw%??}$minor1$minor2"
rev2=`echo $rev | tr '[:upper:]' '[:lower:]'`
setprop ro.boot.hardware.revision $rev2
unset hw cinfo m1 m2 minor1 minor2
# Let kernel know our image version/variant/crm_version
if [ -f /sys/devices/soc0/select_image ]; then
image_version="10:"
image_version+=`getprop ro.build.id`
image_version+=":"
image_version+=`getprop ro.build.version.incremental`
image_variant=`getprop ro.product.name`
image_variant+="-"
image_variant+=`getprop ro.build.type`
oem_version=`getprop ro.build.version.codename`
echo 10 > /sys/devices/soc0/select_image
echo $image_version > /sys/devices/soc0/image_version
echo $image_variant > /sys/devices/soc0/image_variant
echo $oem_version > /sys/devices/soc0/image_crm_version
fi

430
rootdir/bin/init.mmi.usb.sh Normal file
View File

@@ -0,0 +1,430 @@
#!/vendor/bin/sh
# Copyright (c) 2012, Code Aurora Forum. 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 Code Aurora Forum, Inc. 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 "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.
#
#
# Allow unique persistent serial numbers for devices connected via usb
# User needs to set unique usb serial number to persist.usb.serialno and
# if persistent serial number is not set then Update USB serial number if
# passed from command line
#
target=`getprop ro.board.platform`
usb_action=`getprop vendor.usb.mmi-usb-sh.action`
echo "mmi-usb-sh: action = \"$usb_action\""
sys_usb_config=`getprop vendor.usb.config`
tcmd_ctrl_adb ()
{
ctrl_adb=`getprop vendor.tcmd.ctrl_adb`
echo "mmi-usb-sh: vendor.tcmd.ctrl_adb = $ctrl_adb"
case "$ctrl_adb" in
"0")
if [[ "$sys_usb_config" == *adb* ]]
then
# *** ALWAYS expecting adb at the end ***
new_usb_config=${sys_usb_config/,adb/}
echo "mmi-usb-sh: disabling adb ($new_usb_config)"
setprop persist.vendor.usb.config $new_usb_config
setprop vendor.usb.config $new_usb_config
setprop persist.vendor.factory.allow_adb 0
fi
;;
"1")
if [[ "$sys_usb_config" != *adb* ]]
then
# *** ALWAYS expecting adb at the end ***
new_usb_config="$sys_usb_config,adb"
echo "mmi-usb-sh: enabling adb ($new_usb_config)"
setprop persist.vendor.usb.config $new_usb_config
setprop vendor.usb.config $new_usb_config
setprop persist.vendor.factory.allow_adb 1
fi
;;
esac
exit 0
}
case "$usb_action" in
"")
;;
"vendor.tcmd.ctrl_adb")
tcmd_ctrl_adb
;;
esac
# soc_ids for 8937
if [ -f /sys/devices/soc0/soc_id ]; then
soc_id=`cat /sys/devices/soc0/soc_id`
else
soc_id=`cat /sys/devices/system/soc/soc0/id`
fi
case "$target" in
"msm8937")
setprop vendor.usb.rps_mask 0
setprop vendor.rmnet_vnd.rps_mask 0
case "$soc_id" in
"294" | "295")
setprop vendor.usb.rps_mask 40
;;
esac
case "$soc_id" in
"313" | "320")
qcom_usb_config="diag,serial_smd,rmnet_ipa"
qcom_adb_usb_config="diag,serial_smd,rmnet_ipa,adb"
bpt_usb_config="diag,serial_smd,rmnet_bam_ipa"
bpt_adb_usb_config="diag,serial_smd,rmnet_bam_ipa,adb"
setprop vendor.usb.rndis.func.name "rndis_bam"
setprop vendor.usb.rmnet.inst.name "rmnet"
setprop vendor.usb.dpl.inst.name "dpl"
;;
*)
qcom_usb_config="diag,serial_smd,rmnet_qti_bam"
qcom_adb_usb_config="diag,serial_smd,rmnet_qti_bam,adb"
bpt_usb_config="diag,serial_smd,rmnet"
bpt_adb_usb_config="diag,serial_smd,rmnet,adb"
;;
esac
;;
"msm8953")
#Set RPS Mask for Tethering to CPU4
setprop vendor.usb.rps_mask 10
setprop vendor.rmnet_vnd.rps_mask 0
if [ -d /config/usb_gadget/g1 ]; then
qcom_usb_config="diag,serial_cdev,rmnet"
qcom_adb_usb_config="diag,serial_cdev,rmnet,adb"
bpt_usb_config="diag,serial,rmnet"
bpt_adb_usb_config="diag,serial,rmnet,adb"
setprop vendor.usb.rndis.func.name "rndis_bam"
setprop vendor.usb.rmnet.func.name "rmnet_bam"
else
qcom_usb_config="diag,serial_smd,serial_tty,rmnet_bam,mass_storage"
qcom_adb_usb_config="diag,serial_smd,serial_tty,rmnet_bam,mass_storage,adb"
bpt_usb_config="diag,serial_smd,serial_tty,rmnet"
bpt_adb_usb_config="diag,serial_smd,serial_tty,rmnet,adb"
fi
setprop vendor.usb.controller "7000000.dwc3"
;;
"msm8996")
#Set RPS Mask for Tethering to CPU2
setprop vendor.usb.rps_mask 2
setprop vendor.rmnet_vnd.rps_mask 0f
qcom_usb_config="diag,serial_cdev,serial_tty,rmnet_bam,mass_storage"
qcom_adb_usb_config="diag,serial_cdev,serial_tty,rmnet_bam,mass_storage,adb"
bpt_usb_config="diag,serial_cdev,serial_tty,rmnet"
bpt_adb_usb_config="diag,serial_cdev,serial_tty,rmnet,adb"
setprop vendor.usb.controller "6a00000.dwc3"
;;
"msm8998")
#Set RPS Mask for Tethering to CPU2
setprop vendor.usb.rps_mask 70
setprop vendor.rmnet_vnd.rps_mask 0d
qcom_usb_config="diag,serial_cdev,rmnet"
qcom_adb_usb_config="diag,serial_cdev,rmnet,adb"
bpt_usb_config="diag,serial,rmnet"
bpt_adb_usb_config="diag,serial,rmnet,adb"
setprop vendor.usb.controller "a800000.dwc3"
setprop vendor.usb.rndis.func.name "gsi"
setprop vendor.usb.rmnet.func.name "gsi"
setprop vendor.usb.hcd_mask 80
;;
"sdm660")
#Set RPS Mask for Tethering to CPU2
setprop vendor.usb.rps_mask 30
setprop vendor.rmnet_vnd.rps_mask 4
qcom_usb_config="diag,serial_cdev,rmnet"
qcom_adb_usb_config="diag,serial_cdev,rmnet,adb"
bpt_usb_config="diag,serial,rmnet"
bpt_adb_usb_config="diag,serial,rmnet,adb"
setprop vendor.usb.controller "a800000.dwc3"
setprop vendor.usb.rndis.func.name "rndis_bam"
setprop vendor.usb.rmnet.func.name "rmnet_bam"
;;
"sdm845")
qcom_usb_config="diag,serial_cdev,rmnet"
qcom_adb_usb_config="diag,serial_cdev,rmnet,adb"
bpt_usb_config="diag,serial,rmnet"
bpt_adb_usb_config="diag,serial,rmnet,adb"
setprop vendor.usb.controller "a600000.dwc3"
setprop vendor.usb.rndis.func.name "gsi"
setprop vendor.usb.rmnet.func.name "gsi"
;;
"sdm710")
qcom_usb_config="diag,serial_cdev,rmnet"
qcom_adb_usb_config="diag,serial_cdev,rmnet,adb"
bpt_usb_config="diag,serial,rmnet"
bpt_adb_usb_config="diag,serial,rmnet,adb"
setprop vendor.usb.controller "a600000.dwc3"
setprop vendor.usb.rndis.func.name "gsi"
setprop vendor.usb.rmnet.func.name "gsi"
;;
"sm6150")
qcom_usb_config="diag,serial_cdev,rmnet"
qcom_adb_usb_config="diag,serial_cdev,rmnet,adb"
bpt_usb_config="diag,serial,rmnet"
bpt_adb_usb_config="diag,serial,rmnet,adb"
setprop vendor.usb.controller "a600000.dwc3"
setprop vendor.usb.rndis.func.name "gsi"
setprop vendor.usb.rmnet.func.name "gsi"
setprop vendor.usb.hcd_mask 80
setprop vendor.usb.rps_mask 40
;;
"trinket")
qcom_usb_config="diag,serial_cdev,rmnet"
qcom_adb_usb_config="diag,serial_cdev,rmnet,adb"
bpt_usb_config="diag,serial,rmnet"
bpt_adb_usb_config="diag,serial,rmnet,adb"
setprop vendor.usb.controller "4e00000.dwc3"
setprop vendor.usb.rndis.func.name "gsi"
setprop vendor.usb.rmnet.func.name "gsi"
;;
"kona")
qcom_usb_config="diag,diag_mdm,qdss,qdss_mdm,serial_cdev,serial_cdev_mdm,dpl,rmnet"
qcom_adb_usb_config="diag,diag_mdm,qdss,qdss_mdm,serial_cdev,serial_cdev_mdm,dpl,rmnet,adb"
bpt_usb_config="diag,serial,rmnet"
bpt_adb_usb_config="diag,serial,rmnet,adb"
setprop vendor.usb.controller "a600000.dwc3"
echo "none" > /config/usb_gadget/g1/UDC
echo "a600000.dwc3" > /config/usb_gadget/g1/UDC
setprop vendor.usb.rndis.func.name "gsi"
setprop vendor.usb.rmnet.func.name "gsi"
;;
"lito")
qcom_usb_config="diag,diag_mdm,qdss,qdss_mdm,serial_cdev,serial_cdev_mdm,dpl,rmnet"
qcom_adb_usb_config="diag,diag_mdm,qdss,qdss_mdm,serial_cdev,serial_cdev_mdm,dpl,rmnet,adb"
bpt_usb_config="diag,serial,rmnet"
bpt_adb_usb_config="diag,serial,rmnet,adb"
setprop vendor.usb.controller "a600000.dwc3"
echo "none" > /config/usb_gadget/g1/UDC
echo "a600000.dwc3" > /config/usb_gadget/g1/UDC
setprop vendor.usb.rndis.func.name "gsi"
setprop vendor.usb.rmnet.func.name "gsi"
;;
esac
## This is needed to switch to the qcom rndis driver.
diag_extra=`getprop persist.vendor.usb.config.extra`
if [ "$diag_extra" == "" ]; then
setprop persist.vendor.usb.config.extra none
fi
#
# Allow USB enumeration with default PID/VID
#
usb_config=`getprop persist.vendor.usb.config`
mot_usb_config=`getprop persist.vendor.mot.usb.config`
bootmode=`getprop ro.bootmode`
buildtype=`getprop ro.build.type`
securehw=`getprop ro.boot.secure_hardware`
cid=`getprop ro.vendor.boot.cid`
diagmode=`getprop persist.vendor.radio.usbdiag`
echo "mmi-usb-sh: persist usb configs = \"$usb_config\", \"$mot_usb_config\", \"$diagmode\""
phonelock_type=`getprop persist.sys.phonelock.mode`
usb_restricted=`getprop persist.sys.usb.policylocked`
if [ "$securehw" == "1" ] && [ "$buildtype" == "user" ] && [ "$(($cid))" != 0 ]
then
if [ "$usb_restricted" == "1" ]
then
echo 1 > /sys/class/android_usb/android0/secure
else
case "$phonelock_type" in
"1" )
echo 1 > /sys/class/android_usb/android0/secure
;;
* )
echo 0 > /sys/class/android_usb/android0/secure
;;
esac
fi
fi
# ##DIAG# mode option
case "$diagmode" in
"1" )
case "$usb_config" in
"$bpt_usb_config" | "$bpt_adb_usb_config" )
;;
* )
case "$securehw" in
"1" )
setprop persist.vendor.usb.config $bpt_usb_config
;;
*)
setprop persist.vendor.usb.config $bpt_adb_usb_config
;;
esac
;;
esac
exit 0
;;
* )
# Do nothing. USB enumeration will be set by bootmode
;;
esac
case "$bootmode" in
"bp-tools" )
case "$usb_config" in
"$bpt_usb_config" | "$bpt_adb_usb_config" )
;;
* )
case "$securehw" in
"1" )
setprop persist.vendor.usb.config $bpt_usb_config
setprop persist.vendor.usb.bp-tools.config $bpt_usb_config
setprop persist.vendor.usb.bp-tools.func $bpt_usb_config
;;
*)
setprop persist.vendor.usb.config $bpt_adb_usb_config
setprop persist.vendor.usb.bp-tools.config $bpt_adb_usb_config
setprop persist.vendor.usb.bp-tools.func $bpt_adb_usb_config
;;
esac
;;
esac
;;
"mot-factory" )
allow_adb=`getprop persist.vendor.factory.allow_adb`
case "$allow_adb" in
"1")
if [ "$usb_config" != "usbnet,adb" ]
then
setprop persist.vendor.usb.config usbnet,adb
setprop persist.vendor.usb.mot-factory.config usbnet,adb
setprop persist.vendor.usb.mot-factory.func usbnet,adb
fi
;;
*)
if [ "$usb_config" != "usbnet" ]
then
setprop persist.vendor.usb.config usbnet
setprop persist.vendor.usb.mot-factory.config usbnet
setprop persist.vendor.usb.mot-factory.func usbnet
fi
;;
esac
# Disable Host Mode LPM for Factory mode
echo 1 > /sys/module/dwc3_msm/parameters/disable_host_mode_pm
;;
"qcom" )
case "$usb_config" in
"$qcom_usb_config" | "$qcom_adb_usb_config" )
;;
* )
case "$securehw" in
"1" )
setprop persist.vendor.usb.config $qcom_usb_config
setprop persist.vendor.usb.qcom.config $qcom_usb_config
setprop persist.vendor.usb.qcom.func $qcom_usb_config
;;
*)
setprop persist.vendor.usb.config $qcom_adb_usb_config
setprop persist.vendor.usb.qcom.config $qcom_adb_usb_config
setprop persist.vendor.usb.qcom.func $qcom_adb_usb_config
;;
esac
;;
esac
;;
* )
if [ "$buildtype" == "user" ] && [ "$phonelock_type" != "1" ] && [ "$usb_restricted" != "1" ]
then
echo 1 > /sys/class/android_usb/android0/secure
echo "Disabling enumeration until bootup!"
fi
case "$usb_config" in
"mtp,adb" | "mtp" | "adb")
;;
*)
case "$mot_usb_config" in
"mtp,adb" | "mtp" | "adb")
setprop persist.vendor.usb.config $mot_usb_config
;;
*)
case "$securehw" in
"1" )
setprop persist.vendor.usb.config mtp
;;
*)
setprop persist.vendor.usb.config adb
;;
esac
;;
esac
;;
esac
adb_early=`getprop ro.boot.adb_early`
if [ "$adb_early" == "1" ]; then
echo 0 > /sys/class/android_usb/android0/secure
echo "Enabling enumeration after bootup, count = $count !"
new_persist_usb_config=`getprop persist.vendor.usb.config`
if [[ "$new_persist_usb_config" != *adb* ]]; then
setprop persist.vendor.usb.config "adb"
setprop vendor.usb.config "adb"
else
setprop vendor.usb.config $new_persist_usb_config
fi
exit 0
fi
if [ "$buildtype" == "user" ] && [ "$phonelock_type" != "1" ] && [ "$usb_restricted" != "1" ]
then
count=0
bootcomplete=`getprop vendor.boot_completed`
echo "mmi-usb-sh - bootcomplete = $booted"
while [ "$bootcomplete" != "1" ]; do
echo "Sleeping till bootup!"
sleep 1
count=$((count+1))
if [ $count -gt 90 ]
then
echo "mmi-usb-sh - Timed out waiting for bootup"
break
fi
bootcomplete=`getprop vendor.boot_completed`
done
echo 0 > /sys/class/android_usb/android0/secure
echo "Enabling enumeration after bootup, count = $count !"
exit 0
fi
;;
esac
new_persist_usb_config=`getprop persist.vendor.usb.config`
if [ "$sys_usb_config" != "$new_persist_usb_config" ]; then
setprop vendor.usb.config $new_persist_usb_config
fi

View File

@@ -0,0 +1,494 @@
#! /vendor/bin/sh
# Copyright (c) 2012-2013,2016,2018,2019 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.
#
export PATH=/vendor/bin
# Set platform variables
if [ -f /sys/devices/soc0/hw_platform ]; then
soc_hwplatform=`cat /sys/devices/soc0/hw_platform` 2> /dev/null
else
soc_hwplatform=`cat /sys/devices/system/soc/soc0/hw_platform` 2> /dev/null
fi
if [ -f /sys/devices/soc0/soc_id ]; then
soc_hwid=`cat /sys/devices/soc0/soc_id` 2> /dev/null
else
soc_hwid=`cat /sys/devices/system/soc/soc0/id` 2> /dev/null
fi
if [ -f /sys/devices/soc0/platform_version ]; then
soc_hwver=`cat /sys/devices/soc0/platform_version` 2> /dev/null
else
soc_hwver=`cat /sys/devices/system/soc/soc0/platform_version` 2> /dev/null
fi
if [ -f /sys/class/drm/card0-DSI-1/modes ]; then
echo "detect" > /sys/class/drm/card0-DSI-1/status
mode_file=/sys/class/drm/card0-DSI-1/modes
while read line; do
fb_width=${line%%x*};
break;
done < $mode_file
elif [ -f /sys/class/graphics/fb0/virtual_size ]; then
res=`cat /sys/class/graphics/fb0/virtual_size` 2> /dev/null
fb_width=${res%,*}
fi
log -t BOOT -p i "MSM target '$1', SoC '$soc_hwplatform', HwID '$soc_hwid', SoC ver '$soc_hwver'"
#For drm based display driver
vbfile=/sys/module/drm/parameters/vblankoffdelay
if [ -w $vbfile ]; then
echo -1 > $vbfile
else
log -t DRM_BOOT -p w "file: '$vbfile' or perms doesn't exist"
fi
function set_density_by_fb() {
#put default density based on width
if [ -z $fb_width ]; then
setprop vendor.display.lcd_density 320
else
if [ $fb_width -ge 1600 ]; then
setprop vendor.display.lcd_density 640
elif [ $fb_width -ge 1440 ]; then
setprop vendor.display.lcd_density 560
elif [ $fb_width -ge 1080 ]; then
setprop vendor.display.lcd_density 480
elif [ $fb_width -ge 720 ]; then
setprop vendor.display.lcd_density 320 #for 720X1280 resolution
elif [ $fb_width -ge 480 ]; then
setprop vendor.display.lcd_density 240 #for 480X854 QRD resolution
else
setprop vendor.display.lcd_density 160
fi
fi
}
target=`getprop ro.board.platform`
case "$target" in
"msm7630_surf" | "msm7630_1x" | "msm7630_fusion")
case "$soc_hwplatform" in
"FFA" | "SVLTE_FFA")
# linking to surf_keypad_qwerty.kcm.bin instead of surf_keypad_numeric.kcm.bin so that
# the UI keyboard works fine.
ln -s /system/usr/keychars/surf_keypad_qwerty.kcm.bin /system/usr/keychars/surf_keypad.kcm.bin
;;
"Fluid")
setprop vendor.display.lcd_density 240
setprop qcom.bt.dev_power_class 2
;;
*)
ln -s /system/usr/keychars/surf_keypad_qwerty.kcm.bin /system/usr/keychars/surf_keypad.kcm.bin
;;
esac
;;
"sm6150")
case "$soc_hwplatform" in
"ADP")
setprop vendor.display.lcd_density 160
;;
esac
case "$soc_hwid" in
365|366)
sku_ver=`cat /sys/devices/platform/soc/aa00000.qcom,vidc1/sku_version` 2> /dev/null
setprop vendor.media.target.version 1
if [ $sku_ver -eq 1 ]; then
setprop vendor.media.target.version 2
fi
;;
355|369|377|384)
setprop vendor.chre.enabled 0
;;
*)
esac
;;
"msm8660")
case "$soc_hwplatform" in
"Fluid")
setprop vendor.display.lcd_density 240
;;
"Dragon")
setprop ro.sound.alsa "WM8903"
;;
esac
;;
"msm8960")
# lcd density is write-once. Hence the separate switch case
case "$soc_hwplatform" in
"Liquid")
if [ "$soc_hwver" == "196608" ]; then # version 0x30000 is 3D sku
setprop ro.sf.hwrotation 90
fi
setprop vendor.display.lcd_density 160
;;
"MTP")
setprop vendor.display.lcd_density 240
;;
*)
case "$soc_hwid" in
"109")
setprop vendor.display.lcd_density 160
;;
*)
setprop vendor.display.lcd_density 240
;;
esac
;;
esac
#Set up composition type based on the target
case "$soc_hwid" in
87)
#8960
setprop debug.composition.type dyn
;;
153|154|155|156|157|138)
#8064 V2 PRIME | 8930AB | 8630AB | 8230AB | 8030AB | 8960AB
setprop debug.composition.type c2d
;;
*)
esac
;;
"msm8974")
case "$soc_hwplatform" in
"Liquid")
setprop vendor.display.lcd_density 160
# Liquid do not have hardware navigation keys, so enable
# Android sw navigation bar
setprop ro.hw.nav_keys 0
;;
"Dragon")
setprop vendor.display.lcd_density 240
;;
*)
setprop vendor.display.lcd_density 320
;;
esac
;;
"msm8226")
case "$soc_hwplatform" in
*)
setprop vendor.display.lcd_density 320
;;
esac
;;
"msm8610" | "apq8084" | "mpq8092")
case "$soc_hwplatform" in
*)
setprop vendor.display.lcd_density 240
;;
esac
;;
"apq8084")
case "$soc_hwplatform" in
"Liquid")
setprop vendor.display.lcd_density 320
# Liquid do not have hardware navigation keys, so enable
# Android sw navigation bar
setprop ro.hw.nav_keys 0
;;
"SBC")
setprop vendor.display.lcd_density 200
# SBC do not have hardware navigation keys, so enable
# Android sw navigation bar
setprop qemu.hw.mainkeys 0
;;
*)
setprop vendor.display.lcd_density 480
;;
esac
;;
"msm8996")
case "$soc_hwplatform" in
"Dragon")
setprop vendor.display.lcd_density 240
setprop qemu.hw.mainkeys 0
;;
"ADP")
setprop vendor.display.lcd_density 160
setprop qemu.hw.mainkeys 0
;;
"SBC")
setprop vendor.display.lcd_density 240
setprop qemu.hw.mainkeys 0
;;
*)
setprop vendor.display.lcd_density 560
;;
esac
;;
"msm8937" | "msm8940")
# Set vendor.opengles.version based on chip id.
# MSM8937 and MSM8940 variants supports OpenGLES 3.1
# 196608 is decimal for 0x30000 to report version 3.0
# 196609 is decimal for 0x30001 to report version 3.1
# 196610 is decimal for 0x30002 to report version 3.2
case "$soc_hwid" in
294|295|296|297|298|313|353|354|363|364)
setprop vendor.opengles.version 196610
if [ $soc_hwid = 354 ]
then
setprop vendor.media.target.version 1
log -t BOOT -p i "SDM429 early_boot prop set for: HwID '$soc_hwid'"
fi
;;
303|307|308|309|320)
# Vulkan is not supported for 8917 variants
setprop vendor.opengles.version 196608
setprop persist.graphics.vulkan.disable true
;;
*)
setprop vendor.opengles.version 196608
;;
esac
;;
"msm8909")
case "$soc_hwplatform" in
*)
setprop persist.graphics.vulkan.disable true
;;
esac
;;
"msm8998" | "apq8098_latv")
case "$soc_hwplatform" in
*)
setprop vendor.display.lcd_density 560
;;
esac
;;
"sdm845")
case "$soc_hwplatform" in
*)
if [ $fb_width -le 1600 ]; then
setprop vendor.display.lcd_density 560
else
setprop vendor.display.lcd_density 640
fi
;;
esac
;;
"msmnile")
case "$soc_hwplatform" in
*)
if [ $fb_width -le 1600 ]; then
setprop vendor.display.lcd_density 560
else
setprop vendor.display.lcd_density 640
fi
;;
esac
;;
"kona")
case "$soc_hwplatform" in
*)
if [ $fb_width -le 1600 ]; then
setprop vendor.display.lcd_density 560
else
setprop vendor.display.lcd_density 640
fi
;;
esac
;;
"lito")
case "$soc_hwplatform" in
*)
sku_ver=`cat /sys/devices/platform/soc/aa00000.qcom,vidc1/sku_version` 2> /dev/null
if [ $sku_ver -eq 1 ]; then
setprop vendor.media.target.version 1
fi
;;
esac
;;
"msm8953")
if [ -f /vendor/firmware_mnt/verinfo/ver_info.txt ]; then
echo "file"
modem=`cat /vendor/firmware_mnt/verinfo/ver_info.txt |
sed -n 's/^[^:]*modem[^:]*:[[:blank:]]*//p' |
sed 's/.*TA.\(.*\)/\1/g' | cut -d \- -f 1`
# In MSM8953 if meta version is greater than 2.1, need
# to use the new vendor-ril which supports L+L feature
# otherwise use the existing old one.
zygote=`getprop ro.zygote`
case "$zygote" in
""zygote64_32"")
if [ "$modem" \< "3.0" ]; then
setprop vendor.rild.libpath "/vendor/lib64/libril-qc-qmi-1.so"
else
setprop vendor.rild.libpath "/vendor/lib64/libril-qc-hal-qmi.so"
fi
;;
"zygote32")
if [ "$modem" \< "3.0" ]; then
setprop vendor.rild.libpath "/vendor/lib/libril-qc-qmi-1.so"
else
setprop vendor.rild.libpath "/vendor/lib/libril-qc-hal-qmi.so"
fi
;;
esac
fi
;;
"sdm710" | "msmpeafowl")
case "$soc_hwplatform" in
*)
sku_ver=`cat /sys/devices/platform/soc/aa00000.qcom,vidc1/sku_version` 2> /dev/null
if [ $sku_ver -eq 1 ]; then
setprop vendor.media.target.version 1
fi
;;
esac
;;
"msm8953")
cap_ver = 1
if [ -e "/sys/devices/platform/soc/1d00000.qcom,vidc/capability_version" ]; then
cap_ver=`cat /sys/devices/platform/soc/1d00000.qcom,vidc/capability_version` 2> /dev/null
else
cap_ver=`cat /sys/devices/soc/1d00000.qcom,vidc/capability_version` 2> /dev/null
fi
if [ $cap_ver -eq 1 ]; then
setprop vendor.media.target.version 1
fi
;;
#Set property to differentiate SDM660 & SDM455
#SOC ID for SDM455 is 385
"sdm660")
case "$soc_hwid" in
385)
setprop vendor.media.target.version 1
esac
;;
esac
baseband=`getprop ro.baseband`
#enable atfwd daemon all targets except sda, apq, qcs
case "$baseband" in
"apq" | "sda" | "qcs" )
setprop persist.vendor.radio.atfwd.start false;;
*)
setprop persist.vendor.radio.atfwd.start true;;
esac
#set default lcd density
#Since lcd density has read only
#property, it will not overwrite previous set
#property if any target is setting forcefully.
set_density_by_fb
# set Lilliput LCD density for ADP
product=`getprop ro.build.product`
case "$product" in
"msmnile_au")
setprop vendor.display.lcd_density 160
echo 902400000 > /sys/class/devfreq/soc:qcom,cpu0-cpu-l3-lat/min_freq
echo 1612800000 > /sys/class/devfreq/soc:qcom,cpu0-cpu-l3-lat/max_freq
echo 902400000 > /sys/class/devfreq/soc:qcom,cpu4-cpu-l3-lat/min_freq
echo 1612800000 > /sys/class/devfreq/soc:qcom,cpu4-cpu-l3-lat/max_freq
;;
*)
;;
esac
case "$product" in
"sm6150_au")
setprop vendor.display.lcd_density 160
;;
*)
;;
esac
case "$product" in
"sdmshrike_au")
setprop vendor.display.lcd_density 160
echo 940800000 > /sys/class/devfreq/soc:qcom,cpu0-cpu-l3-lat/min_freq
echo 940800000 > /sys/class/devfreq/soc:qcom,cpu4-cpu-l3-lat/min_freq
;;
*)
;;
esac
case "$product" in
"msmnile_gvmq")
setprop vendor.display.lcd_density 160
;;
*)
;;
esac
# Setup display nodes & permissions
# HDMI can be fb1 or fb2
# Loop through the sysfs nodes and determine
# the HDMI(dtv panel)
function set_perms() {
#Usage set_perms <filename> <ownership> <permission>
chown -h $2 $1
chmod $3 $1
}
# check for the type of driver FB or DRM
fb_driver=/sys/class/graphics/fb0
if [ -e "$fb_driver" ]
then
# check for mdp caps
file=/sys/class/graphics/fb0/mdp/caps
if [ -f "$file" ]
then
setprop vendor.gralloc.disable_ubwc 1
cat $file | while read line; do
case "$line" in
*"ubwc"*)
setprop vendor.gralloc.enable_fb_ubwc 1
setprop vendor.gralloc.disable_ubwc 0
esac
done
fi
else
set_perms /sys/devices/virtual/hdcp/msm_hdcp/min_level_change system.graphics 0660
fi
# allow system_graphics group to access pmic secure_mode node
set_perms /sys/class/lcd_bias/secure_mode system.graphics 0660
set_perms /sys/class/leds/wled/secure_mode system.graphics 0660
boot_reason=`cat /proc/sys/kernel/boot_reason`
reboot_reason=`getprop ro.boot.alarmboot`
if [ "$boot_reason" = "3" ] || [ "$reboot_reason" = "true" ]; then
setprop ro.vendor.alarm_boot true
else
setprop ro.vendor.alarm_boot false
fi
# copy GPU frequencies to vendor property
if [ -f /sys/class/kgsl/kgsl-3d0/gpu_available_frequencies ]; then
gpu_freq=`cat /sys/class/kgsl/kgsl-3d0/gpu_available_frequencies` 2> /dev/null
setprop vendor.gpu.available_frequencies "$gpu_freq"
fi

File diff suppressed because it is too large Load Diff

View File

@@ -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

493
rootdir/bin/init.qcom.sh Normal file
View File

@@ -0,0 +1,493 @@
#! /vendor/bin/sh
# Copyright (c) 2009-2016, 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.
#
target=`getprop ro.board.platform`
low_ram=`getprop ro.config.low_ram`
if [ -f /sys/devices/soc0/soc_id ]; then
platformid=`cat /sys/devices/soc0/soc_id`
else
platformid=`cat /sys/devices/system/soc/soc0/id`
fi
start_battery_monitor()
{
if ls /sys/bus/spmi/devices/qpnp-bms-*/fcc_data ; then
chown -h root.system /sys/module/pm8921_bms/parameters/*
chown -h root.system /sys/module/qpnp_bms/parameters/*
chown -h root.system /sys/bus/spmi/devices/qpnp-bms-*/fcc_data
chown -h root.system /sys/bus/spmi/devices/qpnp-bms-*/fcc_temp
chown -h root.system /sys/bus/spmi/devices/qpnp-bms-*/fcc_chgcyl
chmod 0660 /sys/module/qpnp_bms/parameters/*
chmod 0660 /sys/module/pm8921_bms/parameters/*
mkdir -p /data/bms
chown -h root.system /data/bms
chmod 0770 /data/bms
start battery_monitor
fi
}
start_charger_monitor()
{
if ls /sys/module/qpnp_charger/parameters/charger_monitor; then
chown -h root.system /sys/module/qpnp_charger/parameters/*
chown -h root.system /sys/class/power_supply/battery/input_current_max
chown -h root.system /sys/class/power_supply/battery/input_current_trim
chown -h root.system /sys/class/power_supply/battery/input_current_settled
chown -h root.system /sys/class/power_supply/battery/voltage_min
chmod 0664 /sys/class/power_supply/battery/input_current_max
chmod 0664 /sys/class/power_supply/battery/input_current_trim
chmod 0664 /sys/class/power_supply/battery/input_current_settled
chmod 0664 /sys/class/power_supply/battery/voltage_min
chmod 0664 /sys/module/qpnp_charger/parameters/charger_monitor
start charger_monitor
fi
}
start_vm_bms()
{
if [ -e /dev/vm_bms ]; then
chown -h root.system /sys/class/power_supply/bms/current_now
chown -h root.system /sys/class/power_supply/bms/voltage_ocv
chmod 0664 /sys/class/power_supply/bms/current_now
chmod 0664 /sys/class/power_supply/bms/voltage_ocv
start vm_bms
fi
}
start_msm_irqbalance_8939()
{
if [ -f /vendor/bin/msm_irqbalance ]; then
case "$platformid" in
"239" | "293" | "294" | "295" | "304" | "338" | "313" | "353" | "354")
start vendor.msm_irqbalance;;
"349" | "350" )
start vendor.msm_irqbal_lb;;
esac
fi
}
start_msm_irqbalance_msmnile()
{
if [ -f /vendor/bin/msm_irqbalance ]; then
start vendor.msm_irqbalance
fi
}
start_msm_irqbalance_kona()
{
if [ -f /vendor/bin/msm_irqbalance ]; then
start vendor.msm_irqbalance
fi
}
start_msm_irqbalance_lito()
{
if [ -f /vendor/bin/msm_irqbalance ]; then
start vendor.msm_irqbalance
fi
}
start_msm_irqbalance_atoll()
{
if [ -f /vendor/bin/msm_irqbalance ]; then
start vendor.msm_irqbalance
fi
}
start_msm_irqbalance660()
{
if [ -f /vendor/bin/msm_irqbalance ]; then
case "$platformid" in
"317" | "321" | "324" | "325" | "326" | "336" | "345" | "346" | "360" | "393")
start vendor.msm_irqbalance;;
"318" | "327" | "385")
start vendor.msm_irqbl_sdm630;;
esac
fi
}
start_msm_irqbalance()
{
if [ -f /vendor/bin/msm_irqbalance ]; then
start vendor.msm_irqbalance
fi
}
start_copying_prebuilt_qcril_db()
{
if [ -f /vendor/radio/qcril_database/qcril.db -a ! -f /data/vendor/radio/qcril.db ]; then
# [MOTO] - First copy db from the old N path to O path for upgrade
if [ -f /data/misc/radio/qcril.db ]; then
cp /data/misc/radio/qcril.db /data/vendor/radio/qcril.db
# copy the backup db from the old N path to O path for upgrade
if [ -f /data/misc/radio/qcril_backup.db ]; then
cp /data/misc/radio/qcril_backup.db /data/vendor/radio/qcril_backup.db
fi
# Now delete the old folder
rm -fr /data/misc/radio
else
cp /vendor/radio/qcril_database/qcril.db /data/vendor/radio/qcril.db
fi
chown -h radio.radio /data/vendor/radio/qcril.db
else
# [MOTO] if qcril.db's owner is not radio (e.g. root),
# reset it for the recovery
qcril_db_owner=`stat -c %U /data/misc/radio/qcril.db`
echo "qcril.db's owner is $qcril_db_owner"
if [ $qcril_db_owner != "radio" ]; then
echo "reset owner to radio for qcril.db"
chown -h radio.radio /data/misc/radio/qcril.db
fi
fi
}
baseband=`getprop ro.baseband`
echo 1 > /proc/sys/net/ipv6/conf/default/accept_ra_defrtr
#case "$baseband" in
# "svlte2a")
# start bridgemgrd // no bridgemgrd on 8996 for now, comment out
# ;;
#esac
case "$target" in
"msm7630_surf" | "msm7630_1x" | "msm7630_fusion")
if [ -f /sys/devices/soc0/hw_platform ]; then
value=`cat /sys/devices/soc0/hw_platform`
else
value=`cat /sys/devices/system/soc/soc0/hw_platform`
fi
case "$value" in
"Fluid")
start profiler_daemon;;
esac
;;
"msm8660" )
if [ -f /sys/devices/soc0/hw_platform ]; then
platformvalue=`cat /sys/devices/soc0/hw_platform`
else
platformvalue=`cat /sys/devices/system/soc/soc0/hw_platform`
fi
case "$platformvalue" in
"Fluid")
start profiler_daemon;;
esac
;;
"msm8960")
case "$baseband" in
"msm")
start_battery_monitor;;
esac
if [ -f /sys/devices/soc0/hw_platform ]; then
platformvalue=`cat /sys/devices/soc0/hw_platform`
else
platformvalue=`cat /sys/devices/system/soc/soc0/hw_platform`
fi
case "$platformvalue" in
"Fluid")
start profiler_daemon;;
"Liquid")
start profiler_daemon;;
esac
;;
"msm8974")
platformvalue=`cat /sys/devices/soc0/hw_platform`
case "$platformvalue" in
"Fluid")
start profiler_daemon;;
"Liquid")
start profiler_daemon;;
esac
case "$baseband" in
"msm")
start_battery_monitor
;;
esac
start_charger_monitor
;;
"sdm660")
if [ -f /sys/devices/soc0/soc_id ]; then
soc_id=`cat /sys/devices/soc0/soc_id`
else
soc_id=`cat /sys/devices/system/soc/soc0/id`
fi
if [ -f /sys/devices/soc0/hw_platform ]; then
hw_platform=`cat /sys/devices/soc0/hw_platform`
else
hw_platform=`cat /sys/devices/system/soc/soc0/hw_platform`
fi
case "$soc_id" in
"317" | "324" | "325" | "326" | "318" | "327" )
case "$hw_platform" in
"Surf")
setprop qemu.hw.mainkeys 0
;;
"MTP")
setprop qemu.hw.mainkeys 0
;;
"RCM")
setprop qemu.hw.mainkeys 0
;;
"QRD")
setprop qemu.hw.mainkeys 0
;;
esac
;;
esac
start_msm_irqbalance660
;;
"apq8084")
platformvalue=`cat /sys/devices/soc0/hw_platform`
case "$platformvalue" in
"Fluid")
start profiler_daemon;;
"Liquid")
start profiler_daemon;;
esac
;;
"msm8226")
start_charger_monitor
;;
"msm8610")
start_charger_monitor
;;
"msm8916")
start_vm_bms
start_msm_irqbalance_8939
if [ -f /sys/devices/soc0/soc_id ]; then
soc_id=`cat /sys/devices/soc0/soc_id`
else
soc_id=`cat /sys/devices/system/soc/soc0/id`
fi
if [ -f /sys/devices/soc0/platform_subtype_id ]; then
platform_subtype_id=`cat /sys/devices/soc0/platform_subtype_id`
fi
if [ -f /sys/devices/soc0/hw_platform ]; then
hw_platform=`cat /sys/devices/soc0/hw_platform`
fi
case "$soc_id" in
"239")
case "$hw_platform" in
"Surf")
case "$platform_subtype_id" in
"1")
setprop qemu.hw.mainkeys 0
;;
esac
;;
"MTP")
case "$platform_subtype_id" in
"3")
setprop qemu.hw.mainkeys 0
;;
esac
;;
esac
;;
esac
;;
"msm8994" | "msm8992" | "msm8998" | "apq8098_latv" | "sdm845" | "sdm710" | "qcs605" | "sm6150" | "trinket" | "bengal")
start_msm_irqbalance
;;
"msm8996")
if [ -f /sys/devices/soc0/hw_platform ]; then
hw_platform=`cat /sys/devices/soc0/hw_platform`
fi
case "$hw_platform" in
"MTP" | "CDP")
#Loop through the sysfs nodes and determine the correct sysfs to change the permission and ownership.
for count in 0 1 2 3 4 5 6 7 8 9 10
do
dir="/sys/devices/soc/75ba000.i2c/i2c-12/12-0020/input/input"$count
if [ -d "$dir" ]; then
chmod 0660 $dir/secure_touch_enable
chmod 0440 $dir/secure_touch
chown system.drmrpc $dir/secure_touch_enable
chown system.drmrpc $dir/secure_touch
break
fi
done
;;
esac
;;
"msm8909")
start_vm_bms
;;
"msmnile")
start_msm_irqbalance_msmnile
;;
"kona")
start_msm_irqbalance_kona
;;
"lito")
start_msm_irqbalance_lito
;;
"atoll")
start_msm_irqbalance_atoll
;;
"msm8937")
start_msm_irqbalance_8939
if [ -f /sys/devices/soc0/soc_id ]; then
soc_id=`cat /sys/devices/soc0/soc_id`
else
soc_id=`cat /sys/devices/system/soc/soc0/id`
fi
if [ -f /sys/devices/soc0/hw_platform ]; then
hw_platform=`cat /sys/devices/soc0/hw_platform`
else
hw_platform=`cat /sys/devices/system/soc/soc0/hw_platform`
fi
if [ "$low_ram" != "true" ]; then
case "$soc_id" in
"294" | "295" | "303" | "307" | "308" | "309" | "313" | "320" | "353" | "354" | "363" | "364")
case "$hw_platform" in
"Surf")
setprop qemu.hw.mainkeys 0
;;
"MTP")
setprop qemu.hw.mainkeys 0
;;
"RCM")
setprop qemu.hw.mainkeys 0
;;
"QRD")
setprop qemu.hw.mainkeys 0
;;
esac
;;
esac
fi
;;
"msm8953")
start_msm_irqbalance_8939
if [ -f /sys/devices/soc0/soc_id ]; then
soc_id=`cat /sys/devices/soc0/soc_id`
else
soc_id=`cat /sys/devices/system/soc/soc0/id`
fi
if [ -f /sys/devices/soc0/hw_platform ]; then
hw_platform=`cat /sys/devices/soc0/hw_platform`
else
hw_platform=`cat /sys/devices/system/soc/soc0/hw_platform`
fi
case "$soc_id" in
"293" | "304" | "338" | "351" | "349" | "350" )
case "$hw_platform" in
"Surf")
setprop qemu.hw.mainkeys 0
;;
"MTP")
setprop qemu.hw.mainkeys 0
;;
"RCM")
setprop qemu.hw.mainkeys 0
;;
"QRD")
setprop qemu.hw.mainkeys 0
;;
esac
;;
esac
;;
"sdm710")
if [ -f /sys/devices/soc0/soc_id ]; then
soc_id=`cat /sys/devices/soc0/soc_id`
else
soc_id=`cat /sys/devices/system/soc/soc0/id`
fi
if [ -f /sys/devices/soc0/hw_platform ]; then
hw_platform=`cat /sys/devices/soc0/hw_platform`
else
hw_platform=`cat /sys/devices/system/soc/soc0/hw_platform`
fi
case "$soc_id" in
"336" | "337" | "347" | "360" | "393" )
case "$hw_platform" in
"Surf")
setprop qemu.hw.mainkeys 0
;;
"MTP")
setprop qemu.hw.mainkeys 0
;;
"RCM")
setprop qemu.hw.mainkeys 0
;;
"QRD")
setprop qemu.hw.mainkeys 0
;;
esac
;;
esac
;;
esac
#
# Make modem config folder and copy firmware config to that folder for RIL
#
if [ -f /data/vendor/modem_config/ver_info.txt ]; then
prev_version_info=`cat /data/vendor/modem_config/ver_info.txt`
else
prev_version_info=""
fi
cur_version_info=`cat /vendor/firmware_mnt/verinfo/ver_info.txt`
if [ ! -f /vendor/firmware_mnt/verinfo/ver_info.txt -o "$prev_version_info" != "$cur_version_info" ]; then
# add W for group recursively before delete
chmod g+w -R /data/vendor/modem_config/*
rm -rf /data/vendor/modem_config/*
# preserve the read only mode for all subdir and files
cp --preserve=m -dr /vendor/firmware_mnt/image/modem_pr/mcfg/configs/* /data/vendor/modem_config
cp --preserve=m -d /vendor/firmware_mnt/verinfo/ver_info.txt /data/vendor/modem_config/
cp --preserve=m -d /vendor/firmware_mnt/image/modem_pr/mbn_ota.txt /data/vendor/modem_config/
# the group must be root, otherwise this script could not add "W" for group recursively
chown -hR radio.root /data/vendor/modem_config/*
fi
chmod g-w /data/vendor/modem_config
setprop ro.vendor.ril.mbn_copy_completed 1
#check build variant for printk logging
#current default minimum boot-time-default
buildvariant=`getprop ro.build.type`
case "$buildvariant" in
"userdebug" | "eng")
#set default loglevel to KERN_INFO
echo "6 6 1 7" > /proc/sys/kernel/printk
;;
*)
#set default loglevel to KERN_WARNING
echo "4 4 1 4" > /proc/sys/kernel/printk
;;
esac

View File

@@ -0,0 +1,35 @@
#!/vendor/bin/sh
# Copyright (c) 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 "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.
#
#
while [ "$registered" != "true" ]
do
sleep 0.1
registered="`getprop vendor.sys.listeners.registered`"
done