sm8250-common: rootdir: add common init sh files
This commit is contained in:
parent
131fe324e7
commit
ccea932fed
155
rootdir/bin/init.class_main.sh
Executable file
155
rootdir/bin/init.class_main.sh
Executable 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`
|
||||
low_ram=`getprop ro.config.low_ram`
|
||||
qcrild_status=true
|
||||
|
||||
case "$baseband" in
|
||||
"apq" | "sda" | "qcs" )
|
||||
setprop ro.vendor.radio.noril yes
|
||||
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
|
||||
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 vendor.ril-daemon
|
||||
|
||||
start vendor.qcrild
|
||||
else
|
||||
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
|
||||
if [ "$low_ram" != "true" ]; then
|
||||
start vendor.dataadpl
|
||||
fi
|
||||
;;
|
||||
"concurrent")
|
||||
start vendor.dataqti
|
||||
if [ "$low_ram" != "true" ]; then
|
||||
start vendor.dataadpl
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
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
|
35
rootdir/bin/init.crda.sh
Executable file
35
rootdir/bin/init.crda.sh
Executable file
@ -0,0 +1,35 @@
|
||||
#! /vendor/bin/sh
|
||||
|
||||
# Copyright (c) 2012, 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.
|
||||
#
|
||||
|
||||
country=`getprop wlan.crda.country`
|
||||
# crda takes input in COUNTRY environment variable
|
||||
if [ $country != "" ]
|
||||
then
|
||||
COUNTRY="$country" /system/bin/crda
|
||||
fi
|
30
rootdir/bin/init.gbmods.sh
Executable file
30
rootdir/bin/init.gbmods.sh
Executable file
@ -0,0 +1,30 @@
|
||||
#!/vendor/bin/sh
|
||||
|
||||
debug=$(getprop ro.boot.gbdebug 2> /dev/null)
|
||||
bootmode=$(getprop ro.bootmode 2> /dev/null)
|
||||
|
||||
# If androidboot.gbdebug is set on command line, skip inserting
|
||||
# the pre-installed modules.
|
||||
if [ "$debug" == "1" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
insmod /vendor/lib/modules/greybus.ko
|
||||
|
||||
# Only support PTP and BATTERY in charge-only mode
|
||||
if [ "$bootmode" == "charger" ]; then
|
||||
insmod /vendor/lib/modules/gb-mods.ko
|
||||
insmod /vendor/lib/modules/gb-battery.ko
|
||||
insmod /vendor/lib/modules/gb-ptp.ko
|
||||
|
||||
return 0
|
||||
fi
|
||||
|
||||
gbmods="/vendor/lib/modules/gb-*"
|
||||
for mod in $gbmods
|
||||
do
|
||||
insmod $mod
|
||||
done
|
||||
|
||||
insmod /vendor/lib/modules/v4l2-hal.ko
|
||||
start vendor.mods_camd
|
34
rootdir/bin/init.mdm.sh
Executable file
34
rootdir/bin/init.mdm.sh
Executable file
@ -0,0 +1,34 @@
|
||||
#! /vendor/bin/sh
|
||||
|
||||
# Copyright (c) 2013, 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 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.
|
||||
#
|
||||
|
||||
baseband=`getprop ro.baseband`
|
||||
if [ "$baseband" = "mdm" ] || [ "$baseband" = "mdm2" ]; then
|
||||
start vendor.mdm_helper
|
||||
fi
|
||||
|
151
rootdir/bin/init.mmi.boot.sh
Executable file
151
rootdir/bin/init.mmi.boot.sh
Executable file
@ -0,0 +1,151 @@
|
||||
#!/vendor/bin/sh
|
||||
|
||||
PATH=/sbin:/vendor/sbin:/vendor/bin:/vendor/xbin
|
||||
export PATH
|
||||
|
||||
scriptname=${0##*/}
|
||||
|
||||
notice()
|
||||
{
|
||||
echo "$*"
|
||||
echo "$scriptname: $*" > /dev/kmsg
|
||||
}
|
||||
|
||||
# We take this from cpuinfo because hex "letters" are lowercase there
|
||||
set -A cinfo `cat /proc/cpuinfo | sed -n "/Revision/p"`
|
||||
hw=${cinfo[2]#?}
|
||||
|
||||
# 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
|
||||
setprop ro.vendor.hw.revision p${hw%??}$minor1$minor2
|
||||
unset hw cinfo m1 m2 minor1 minor2
|
||||
|
||||
# reload UTAGS
|
||||
utag_status=$(cat /proc/config/reload)
|
||||
if [ "$utag_status" == "2" ]; then
|
||||
notice "Utags are not ready, reloading"
|
||||
echo 1 > /proc/config/reload
|
||||
utag_status=$(cat /proc/config/reload)
|
||||
[ "$utag_status" != "0" ] && notice "Utags failed to reload"
|
||||
fi
|
||||
|
||||
# Export these for factory validation purposes
|
||||
iccid=$(cat /proc/config/iccid/ascii 2>/dev/null)
|
||||
if [ ! -z "$iccid" ]; then
|
||||
setprop ro.vendor.mot.iccid $iccid
|
||||
fi
|
||||
unset iccid
|
||||
cust_md5=$(cat /proc/config/cust_md5/ascii 2>/dev/null)
|
||||
if [ ! -z "$cust_md5" ]; then
|
||||
setprop ro.vendor.mot.cust_md5 $cust_md5
|
||||
fi
|
||||
unset cust_md5
|
||||
|
||||
# Get FTI data and catch old units with incorrect/missing UTAG_FTI
|
||||
pds_fti=/mnt/vendor/persist/factory/fti
|
||||
if [ -r $pds_fti ]; then
|
||||
set -A fti $(od -A n -t x1 $pds_fti 2>/dev/null | tr '[A-F]' '[a-f]')
|
||||
else
|
||||
notice "Can not read FTI data in persist"
|
||||
fi
|
||||
|
||||
# If UTAG_FTI is readable, compare checksums
|
||||
# and if they mismatch, assume PDS is valid and overwrite UTAG
|
||||
utag_fti=/proc/config/fti
|
||||
if [ -r $utag_fti/ascii ]; then
|
||||
set -A fti_utag $(cat ${utag_fti}/raw | sed 's/../& /g' | tr '[A-F]' '[a-f]')
|
||||
# Byte 128 is total cksum, if nothing there, PDS data is invalid/missing
|
||||
if [ ! -z "${fti[127]}" ]; then
|
||||
# Make sure fti in UTAG is the same as in persist. Checksum comparison
|
||||
if [ "${fti[126]}" != "${fti_utag[126]}" -o "${fti[127]}" != "${fti_utag[127]}" ]; then
|
||||
notice "Copying FTI data from persist"
|
||||
cat $pds_fti > ${utag_fti}/raw
|
||||
fi
|
||||
else
|
||||
# If PDS data is invalid, take UTAG and hope it is correct
|
||||
notice "Will use FTI from UTAG"
|
||||
set -A fti $(od -A n -t x1 ${utag_fti}/ascii 2>/dev/null)
|
||||
fi
|
||||
else
|
||||
notice "Missing FTI UTAG; copying from persist"
|
||||
echo fti > /proc/config/all/new
|
||||
cat $pds_fti > ${utag_fti}/raw
|
||||
fi
|
||||
|
||||
# Read HW version from FTI data
|
||||
hw_v1="\x${fti[35]}"
|
||||
hw_v2="\x${fti[36]}"
|
||||
hw_v3="\x${fti[37]}"
|
||||
if [ "$hw_v3" == "\x30" ]; then
|
||||
hw_v3=""
|
||||
fi
|
||||
hw_v4="\x${fti[38]}"
|
||||
if [ "$hw_v4" == "\x30" ]; then
|
||||
hw_v4=""
|
||||
fi
|
||||
setprop ro.vendor.hw.boardversion $(printf "$hw_v1$hw_v2$hw_v3$hw_v4")
|
||||
|
||||
# Now we have set fti var either from PDS or UTAG
|
||||
# Get Last Test Station stamp from FTI
|
||||
# and convert to user-friendly date, US format
|
||||
# Real offsets for year/month/day are 63/64/65
|
||||
# If the month/date look reasonable, data is probably OK.
|
||||
mdate="Unknown"
|
||||
y=0x${fti[63]}
|
||||
m=0x${fti[64]}
|
||||
d=0x${fti[65]}
|
||||
let year=$y month=$m day=$d
|
||||
# Invalid data will often have bogus month/date values
|
||||
if [ $month -le 12 -a $day -le 31 -a $year -ge 12 ]; then
|
||||
mdate=$month/$day/20$year
|
||||
else
|
||||
notice "Corrupt FTI data"
|
||||
fi
|
||||
setprop ro.vendor.manufacturedate $mdate
|
||||
unset fti y m d year month day utag_fti pds_fti fti_utag mdate
|
||||
|
||||
t=$(getprop ro.build.tags)
|
||||
if [[ "$t" != *release* ]]; then
|
||||
for p in $(cat /proc/cmdline); do
|
||||
if [ ${p%%:*} = "@" ]; then
|
||||
v=${p#@:}; a=${v%=*}; b=${v#*=}
|
||||
${a%%:*} ${a##*:} $b
|
||||
fi
|
||||
done
|
||||
fi
|
||||
unset p v a b t
|
||||
|
||||
# Cleanup stale/incorrect programmed model value
|
||||
# Real values will never contain substrings matching "internal" device name
|
||||
product=$(getprop ro.vendor.hw.device)
|
||||
model=$(cat /proc/config/model/ascii 2>/dev/null)
|
||||
if [ $? -eq 0 ]; then
|
||||
if [ "${model#*_}" == "$product" -o "${model%_*}" == "$product" ]; then
|
||||
notice "Clearing stale model value"
|
||||
echo "" > /proc/config/model/raw
|
||||
fi
|
||||
fi
|
||||
unset model product
|
||||
|
||||
# set ro.vendor.bootreason, which be used to indicate kpanic/wdt boot status.
|
||||
# When ro.boot.last_powerup_reason is set, it denotes this is a 2nd reboot
|
||||
# after kpanic/wdt, we set ro.bootreason as coldboot to copy logs.
|
||||
# Otherwise, we would set ro.bootreason the same as ro.boot.bootreason.
|
||||
# ro.boot.bootreason is restricted as of android p, so get it another way:
|
||||
bootreason_kvp=$(cat /proc/bootinfo | grep "Last boot reason")
|
||||
last_power_up=$(getprop ro.boot.last_powerup_reason)
|
||||
if [ ! -z "$last_power_up" ]
|
||||
then
|
||||
setprop ro.vendor.bootreason "coldboot"
|
||||
else
|
||||
setprop ro.vendor.bootreason ${bootreason_kvp##* }
|
||||
fi
|
91
rootdir/bin/init.mmi.laser.sh
Executable file
91
rootdir/bin/init.mmi.laser.sh
Executable file
@ -0,0 +1,91 @@
|
||||
#!/vendor/bin/sh
|
||||
scriptname=${0##*/}
|
||||
dbg_on=1
|
||||
debug()
|
||||
{
|
||||
[ $dbg_on ] && echo "Debug: $*"
|
||||
}
|
||||
|
||||
notice()
|
||||
{
|
||||
echo "$*"
|
||||
echo "$scriptname: $*" > /dev/kmsg
|
||||
}
|
||||
|
||||
error_and_leave()
|
||||
{
|
||||
local err_msg
|
||||
local err_code=$1
|
||||
case $err_code in
|
||||
1) err_msg="Error: No response";;
|
||||
2) err_msg="Error: Skip to overwrite xtalk and offset data in factory mode";;
|
||||
3) err_msg="Error: Calibration data file $2 does not exist";;
|
||||
4) err_msg="Error: Calibration sysfs path $2 does not show up";;
|
||||
esac
|
||||
notice "$err_msg"
|
||||
exit $err_code
|
||||
}
|
||||
|
||||
# Change laser sysfs file ownership
|
||||
laser_class_path=/sys/devices/virtual/laser
|
||||
laser_product_string=$(ls $laser_class_path)
|
||||
laser_product_path=$laser_class_path/$laser_product_string
|
||||
for laser_file in $laser_product_path/*; do
|
||||
if [ -f "$laser_file" ]; then
|
||||
chown root:system $laser_file
|
||||
fi
|
||||
done
|
||||
|
||||
if [ ! -d $laser_product_path ]; then
|
||||
error_and_leave 4 "'$laser_product_path'"
|
||||
fi
|
||||
|
||||
# Change laser input sysfs file ownership
|
||||
laser_input_root=/sys/devices/virtual/input
|
||||
laser_input_list=$(ls $laser_input_root)
|
||||
for laser_input_dir in $laser_input_list; do
|
||||
if [ -f "$laser_input_root/$laser_input_dir/calibration_data" ]; then
|
||||
laser_calib_file=$laser_input_root/$laser_input_dir/calibration_data
|
||||
chown root:system $laser_calib_file
|
||||
fi
|
||||
if [ -f "$laser_input_root/$laser_input_dir/xtalk" ]; then
|
||||
laser_xtalk_file=$laser_input_root/$laser_input_dir/xtalk
|
||||
chown root:system $laser_xtalk_file
|
||||
fi
|
||||
if [ -f "$laser_input_root/$laser_input_dir/offset" ]; then
|
||||
laser_offset_file=$laser_input_root/$laser_input_dir/offset
|
||||
chown root:system $laser_offset_file
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -z "$laser_calib_file" ]; then
|
||||
laser_calib_file=$laser_product_path/calibration_data
|
||||
fi
|
||||
if [ -z "$laser_xtalk_file" ]; then
|
||||
laser_xtalk_file=$laser_product_path/xtalk
|
||||
fi
|
||||
if [ -z "$laser_offset_file" ]; then
|
||||
laser_offset_file=$laser_product_path/offset
|
||||
fi
|
||||
|
||||
# Load calibration data
|
||||
calib_data_file=/mnt/vendor/persist/camera/focus/cal_data
|
||||
if [ -f $calib_data_file ]; then
|
||||
chown root:vendor_tcmd $calib_data_file
|
||||
chmod 660 $calib_data_file
|
||||
if [ -z "$laser_calib_file" ]; then
|
||||
error_and_leave 4 "'$laser_calib_file'"
|
||||
else
|
||||
cat $calib_data_file > $laser_calib_file
|
||||
notice "laser calibration data updating complete"
|
||||
fi
|
||||
else
|
||||
notice "laser calib_data_file '$calib_data_file' does not exist"
|
||||
fi
|
||||
|
||||
bootmode=$(getprop ro.bootmode 2> /dev/null)
|
||||
if [ $bootmode != "mot-factory" ]; then
|
||||
# Enable smudge mode
|
||||
echo 1 > $laser_product_path/smudge_correction_mode
|
||||
notice "laser smudge mode enabled"
|
||||
fi
|
617
rootdir/bin/init.mmi.touch.sh
Executable file
617
rootdir/bin/init.mmi.touch.sh
Executable file
@ -0,0 +1,617 @@
|
||||
#!/vendor/bin/sh
|
||||
|
||||
PATH=/sbin:/vendor/sbin:/vendor/bin:/vendor/xbin
|
||||
export PATH
|
||||
|
||||
while getopts cds op;
|
||||
do
|
||||
case $op in
|
||||
c) cal_on=1;;
|
||||
d) dbg_on=1;;
|
||||
s) dump_statistics=1;;
|
||||
esac
|
||||
done
|
||||
shift $(($OPTIND-1))
|
||||
|
||||
# Globals
|
||||
scriptname=${0##*/}
|
||||
touch_class_path=/sys/class/touchscreen
|
||||
touch_status_prop=
|
||||
touch_update_prop=
|
||||
touch_calibration_done_version=persist.vendor.touch.calibration
|
||||
touch_vendor=
|
||||
touch_path=
|
||||
panel_path=/sys/devices/virtual/graphics/fb0
|
||||
oem_panel_script=/vendor/bin/init.oem.panel.sh
|
||||
dlkm_path=/vendor/lib/modules
|
||||
device_property=ro.vendor.hw.device
|
||||
hwrev_property=ro.vendor.hw.revision
|
||||
firmware_path=/vendor/firmware
|
||||
param_path=/data/vendor/param/touch
|
||||
factory_property=ro.vendor.build.motfactory
|
||||
bootmode_property=ro.bootmode
|
||||
let dec_cfg_id_boot=0
|
||||
let dec_cfg_id_latest=0
|
||||
# Whether to search for TP firmware in the parameter path
|
||||
let search_in_param=0
|
||||
# Whether the matching TP firmware is found in the parameter path
|
||||
let find_in_param=0
|
||||
typeset -l product_id
|
||||
panel_ver=
|
||||
supplier=
|
||||
property=
|
||||
config_id=
|
||||
build_id=
|
||||
hwrev_id=
|
||||
str_cfg_id_new=
|
||||
str_cfg_id_boot=
|
||||
str_cfg_id_latest=
|
||||
build_id_new=
|
||||
|
||||
debug()
|
||||
{
|
||||
[ $dbg_on ] && echo "Debug: $*"
|
||||
}
|
||||
|
||||
notice()
|
||||
{
|
||||
echo "$*"
|
||||
echo "$scriptname: $*" > /dev/kmsg
|
||||
}
|
||||
|
||||
sanity_check()
|
||||
{
|
||||
read_touch_property flashprog || return 1
|
||||
[[ ( -z "$property" ) || ( "$property" == "1" ) ]] && return 2
|
||||
read_touch_property productinfo || return 1
|
||||
[[ ( -z "$property" ) || ( "$property" == "0" ) ]] && return 2
|
||||
read_touch_property buildid || return 1
|
||||
config_id=${property#*-}
|
||||
[[ ( -z "$config_id" ) || ( "$config_id" == "0" ) ]] && return 2
|
||||
build_id=${property%-*}
|
||||
[[ ( -z "$build_id" ) || ( "$build_id" == "0" ) ]] && return 2
|
||||
return 0
|
||||
}
|
||||
|
||||
error_msg()
|
||||
{
|
||||
local err_msg
|
||||
local err_code=$1
|
||||
case $err_code in
|
||||
1) err_msg="Error: No response from touch IC";;
|
||||
2) err_msg="Error: Cannot read property $2";;
|
||||
3) err_msg="Error: No matching firmware file found";;
|
||||
4) err_msg="Error: Touch IC is in bootloader mode";;
|
||||
5) err_msg="Error: Touch provides no reflash interface";;
|
||||
6) err_msg="Error: Touch driver is not running";;
|
||||
7) err_msg="Warning: Touch firmware is not the latest";;
|
||||
8) err_msg="Info: Touch class does not exist";;
|
||||
9) err_msg="Error: Touch IC is not ready to flash";;
|
||||
esac
|
||||
notice "$err_msg"
|
||||
}
|
||||
|
||||
error_and_leave()
|
||||
{
|
||||
local err_code=$1
|
||||
local touch_status="unknown"
|
||||
error_msg $err_code
|
||||
case $err_code in
|
||||
1|4) touch_status="dead";;
|
||||
5|6|8) touch_status="absent";;
|
||||
esac
|
||||
|
||||
# perform sanity check and declare touch ready if error is not fatal
|
||||
if [ "$touch_status" == "unknown" ]; then
|
||||
sanity_check
|
||||
case "$?" in
|
||||
0) touch_status="ready";;
|
||||
2) touch_status="dead";;
|
||||
1) touch_status="absent";;
|
||||
esac
|
||||
fi
|
||||
|
||||
# perform recovery if touch is declared dead
|
||||
if [ "$touch_status" == "dead" ]; then
|
||||
notice "Touch needs to go through recovery!!!"
|
||||
reboot_cnt=$(getprop $touch_status_prop 2>/dev/null)
|
||||
[ -z "$reboot_cnt" ] && reboot_cnt=0
|
||||
debug "current reboot counter [$reboot_cnt]"
|
||||
fi
|
||||
|
||||
setprop $touch_status_prop $touch_status
|
||||
notice "property [$touch_status_prop] set to [`getprop $touch_status_prop`]"
|
||||
|
||||
if [ "$touch_status" == "dead" ]; then
|
||||
notice "Touch is not responding; no further action!!!"
|
||||
#if [ $((reboot_cnt)) -lt 2 ]; then
|
||||
# notice "Touch is not working; rebooting..."
|
||||
# debug "sleep 3s to allow touch-dead-sh service to run"
|
||||
# sleep 3
|
||||
# [ -z "$dbg_on" ] && setprop sys.powerctl reboot
|
||||
#else
|
||||
# notice "Although touch is not working, no more reboots"
|
||||
#fi
|
||||
fi
|
||||
|
||||
exit $err_code
|
||||
}
|
||||
|
||||
prepend()
|
||||
{
|
||||
local list=""
|
||||
local prefix=$1
|
||||
shift
|
||||
for name in $*; do
|
||||
list="$list$prefix/$name "
|
||||
done
|
||||
echo $list
|
||||
}
|
||||
|
||||
dump_statistics()
|
||||
{
|
||||
debug "dumping touch statistics"
|
||||
cat $touch_path/ic_ver
|
||||
[ -f $touch_path/stats ] && cat $touch_path/stats
|
||||
return 0
|
||||
}
|
||||
|
||||
wait_for_poweron()
|
||||
{
|
||||
local wait_nomore
|
||||
local readiness
|
||||
local count
|
||||
debug "wait until driver reports <ready to flash>..."
|
||||
wait_nomore=60
|
||||
count=0
|
||||
while true; do
|
||||
readiness=$(cat $touch_path/poweron)
|
||||
if [ "$readiness" == "1" ]; then
|
||||
debug "ready to flash!!!"
|
||||
break;
|
||||
fi
|
||||
count=$((count+1))
|
||||
[ $count -eq $wait_nomore ] && break
|
||||
sleep 1
|
||||
debug "not ready; keep waiting..."
|
||||
done
|
||||
if [ $count -eq $wait_nomore ]; then
|
||||
error_msg 9
|
||||
return 1
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
setup_permissions()
|
||||
{
|
||||
local bootmode=$(getprop $bootmode_property 2> /dev/null)
|
||||
local selinux=$(getprop ro.boot.selinux 2> /dev/null)
|
||||
local key_path
|
||||
local key_files
|
||||
local entry
|
||||
if [[ ("$selinux" == "permissive") || ("$bootmode" == "mot-factory") ]]; then
|
||||
debug "loosen permissions to $touch_vendor files"
|
||||
case $touch_vendor in
|
||||
samsung) key_path="/sys/devices/virtual/sec/sec_ts/"
|
||||
key_files=$(ls $key_path 2>/dev/null)
|
||||
# Set optional permissions to LSI touch tests
|
||||
[ -f $touch_path/size ] && chown root:vendor_tcmd $touch_path/size
|
||||
[ -f $touch_path/address ] && chown root:vendor_tcmd $touch_path/address
|
||||
[ -f $touch_path/write ] && chown root:vendor_tcmd $touch_path/write
|
||||
;;
|
||||
synaptics) key_path=$touch_path
|
||||
key_files=$(prepend f54 `ls $touch_path/f54/ 2>/dev/null`)
|
||||
key_files=$key_files"reporting query stats";;
|
||||
focaltech) key_path="/proc/"
|
||||
key_files="ftxxxx-debug";;
|
||||
ilitek) key_path="/proc/ilitek"
|
||||
key_files="ioctl";;
|
||||
goodix) key_path="/proc/"
|
||||
key_files="gmnode"
|
||||
if [[ "$touch_instance" == "GTx5" ]] || [[ "$touch_instance" == "GTx8" ]]; then
|
||||
key_path="/dev/"
|
||||
key_files="gtp_tools"
|
||||
fi
|
||||
;;
|
||||
stmicro) key_path="/proc/fts/"
|
||||
key_files="driver_test"
|
||||
# Set optional permissions to LSI touch tests
|
||||
[ -f $touch_path/calibrate ] && chown root:vendor_tcmd $touch_path/calibrate
|
||||
;;
|
||||
esac
|
||||
for entry in $key_files; do
|
||||
chmod 0666 $key_path/$entry
|
||||
debug "change permissions of $key_path/$entry"
|
||||
done
|
||||
fi
|
||||
# Set permissions to enable factory touch tests
|
||||
chown root:vendor_tcmd $touch_path/drv_irq
|
||||
chown root:vendor_tcmd $touch_path/hw_irqstat
|
||||
chown root:vendor_tcmd $touch_path/reset
|
||||
|
||||
# Set permissions to allow Bug2Go access to touch statistics
|
||||
chown root:log $touch_path/stats
|
||||
# Erase is optional
|
||||
[ -f $touch_path/erase_all ] && chown root:vendor_tcmd $touch_path/erase_all
|
||||
}
|
||||
|
||||
read_touch_property()
|
||||
{
|
||||
property=""
|
||||
debug "retrieving property: [$touch_path/$1]"
|
||||
property=$(cat $touch_path/$1 2> /dev/null)
|
||||
debug "touch property [$1] is: [$property]"
|
||||
[ -z "$property" ] && return 1
|
||||
return 0
|
||||
}
|
||||
|
||||
read_panel_property()
|
||||
{
|
||||
property=""
|
||||
debug "retrieving panel property: [$panel_path/$1]"
|
||||
property=$(cat $panel_path/$1 2> /dev/null)
|
||||
debug "panel property [$1] is: [$property]"
|
||||
[ -z "$property" ] && return 1
|
||||
return 0
|
||||
}
|
||||
|
||||
find_latest_config_id()
|
||||
{
|
||||
local fw_mask=$1
|
||||
local skip_fields=$2
|
||||
local dec max z str_hex i
|
||||
str_cfg_id_latest=""
|
||||
debug "scanning dir for files matching [$fw_mask]"
|
||||
let dec=0; max=0;
|
||||
for file in $(ls $fw_mask 2>/dev/null); do
|
||||
z=$file
|
||||
i=0
|
||||
while [ ! $i -eq $skip_fields ]; do
|
||||
z=${z#*-}
|
||||
i=$((i+1))
|
||||
done
|
||||
str_hex=${z%%-*};
|
||||
let dec=0x$str_hex
|
||||
if [ $dec -gt $max ]; then
|
||||
let max=$dec; dec_cfg_id_latest=$dec;
|
||||
str_cfg_id_latest=$str_hex
|
||||
fi
|
||||
done
|
||||
[ -z "$str_cfg_id_latest" ] && return 1
|
||||
return 0
|
||||
}
|
||||
|
||||
find_best_match()
|
||||
{
|
||||
local hw_mask=$1
|
||||
local panel_supplier=$2
|
||||
local skip_fields fw_mask
|
||||
local match_best_cfg
|
||||
local match_best_cfg_dec param_cfg_dec
|
||||
let match_best_cfg_dec=0
|
||||
let param_cfg_dec=0
|
||||
|
||||
while [ ! -z "$hw_mask" ]; do
|
||||
if [ "$hw_mask" == "-" ]; then
|
||||
hw_mask=""
|
||||
fi
|
||||
if [ ! -z "$panel_supplier" ]; then
|
||||
skip_fields=3
|
||||
fw_mask="$touch_vendor-$panel_supplier-$touch_product_id-*-$product_id$hw_mask.*"
|
||||
else
|
||||
skip_fields=2
|
||||
fw_mask="$touch_vendor-$touch_product_id-*-$product_id$hw_mask.*"
|
||||
fi
|
||||
find_latest_config_id "$fw_mask" "$skip_fields"
|
||||
if [ "$?" == "0" ]; then
|
||||
let match_best_cfg_dec=$dec_cfg_id_latest
|
||||
match_best_cfg=$str_cfg_id_latest
|
||||
fi
|
||||
if [ "$search_in_param" == "1" ]; then
|
||||
cd $param_path
|
||||
find_latest_config_id "$fw_mask" "$skip_fields"
|
||||
if [ "$?" == "0" ]; then
|
||||
if [ $match_best_cfg_dec -lt $dec_cfg_id_latest ]; then
|
||||
let match_best_cfg_dec=$dec_cfg_id_latest
|
||||
match_best_cfg=$str_cfg_id_latest
|
||||
let find_in_param=1
|
||||
else
|
||||
cd $firmware_path
|
||||
fi
|
||||
else
|
||||
cd $firmware_path
|
||||
fi
|
||||
fi
|
||||
[ $match_best_cfg_dec != 0 ] && break
|
||||
hw_mask=${hw_mask%?}
|
||||
done
|
||||
str_cfg_id_latest=$match_best_cfg
|
||||
dec_cfg_id_latest=$match_best_cfg_dec
|
||||
[ -z "$match_best_cfg" ] && return 1
|
||||
if [ -z "$panel_supplier" ]; then
|
||||
firmware_file=$(ls $touch_vendor-$touch_product_id-$str_cfg_id_latest-*-$product_id$hw_mask.*)
|
||||
else
|
||||
firmware_file=$(ls $touch_vendor-$panel_supplier-$touch_product_id-$str_cfg_id_latest-*-$product_id$hw_mask.*)
|
||||
fi
|
||||
notice "Firmware file for upgrade $firmware_file"
|
||||
return 0
|
||||
}
|
||||
|
||||
query_touch_info()
|
||||
{
|
||||
read_touch_property flashprog
|
||||
bl_mode=$property
|
||||
debug "bl mode: $bl_mode"
|
||||
while true; do
|
||||
read_touch_property productinfo
|
||||
touch_product_id=$property
|
||||
if [ "$touch_product_id" ]; then
|
||||
# driver might not be ready yet, wait
|
||||
debug "touch product id: $touch_product_id"
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
if [ "$touch_product_id" == "0" ]; then
|
||||
debug "touch ic reports invalid product id"
|
||||
error_msg 1
|
||||
return 1
|
||||
fi
|
||||
read_touch_property buildid
|
||||
str_cfg_id_boot=${property#*-}
|
||||
let dec_cfg_id_boot=0x$str_cfg_id_boot
|
||||
debug "touch config id: $str_cfg_id_boot"
|
||||
build_id_boot=${property%-*}
|
||||
debug "touch build id: $build_id_boot"
|
||||
return 0
|
||||
}
|
||||
|
||||
query_panel_info()
|
||||
{
|
||||
supplier=""
|
||||
read_touch_property "panel_supplier"
|
||||
[ -z "$property" ] && read_panel_property "panel_supplier"
|
||||
supplier=$property
|
||||
if [ "$supplier" ]; then
|
||||
read_panel_property "controller_drv_ver"
|
||||
panel_ver=${property#${property%?}}
|
||||
debug "panel supplier: $supplier, ver $panel_ver"
|
||||
else
|
||||
debug "driver does not report panel supplier"
|
||||
fi
|
||||
}
|
||||
|
||||
load_driver_modules()
|
||||
{
|
||||
if [ "$supplier" ]; then
|
||||
if [ -f $oem_panel_script ]; then
|
||||
debug "load_driver_modules()"
|
||||
$oem_panel_script -s $supplier
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
search_firmware_file()
|
||||
{
|
||||
local match_not_found
|
||||
match_not_found=1
|
||||
if [ "$supplier" ]; then
|
||||
for pattern in "$supplier$panel_ver" "$supplier"; do
|
||||
debug "search for best hw revision match with supplier"
|
||||
find_best_match "-$hwrev_id" "$pattern"
|
||||
match_not_found=$?
|
||||
[ "$match_not_found" == "0" ] && break
|
||||
done
|
||||
fi
|
||||
if [ "$match_not_found" != "0" ]; then
|
||||
debug "search for best hw revision match without supplier"
|
||||
find_best_match "-$hwrev_id"
|
||||
if [ "$?" != "0" ]; then
|
||||
error_msg 3
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
reload_modules()
|
||||
{
|
||||
local rc
|
||||
local module
|
||||
for module in $*; do
|
||||
[ -f $dlkm_path/$module.ko ] || continue
|
||||
notice "Reloading [$module.ko]..."
|
||||
rmmod $module
|
||||
rc=$?
|
||||
[ $rc != 0 ] && notice "Unloading [$module] failed: $rc"
|
||||
insmod $dlkm_path/$module.ko
|
||||
rc=$?
|
||||
[ $rc != 0 ] && notice "Loading [$module] failed: $rc"
|
||||
done
|
||||
}
|
||||
|
||||
run_firmware_upgrade()
|
||||
{
|
||||
local recovery
|
||||
recovery=0
|
||||
if [ "$bl_mode" == "1" ] || [ "$build_id_boot" == "0" ]; then
|
||||
recovery=1
|
||||
notice "Initiating touch firmware recovery"
|
||||
notice " bl mode = $bl_mode"
|
||||
notice " build id = $build_id_boot"
|
||||
fi
|
||||
if [ $dec_cfg_id_boot -ne $dec_cfg_id_latest ] || [ "$recovery" == "1" ]; then
|
||||
wait_for_poweron
|
||||
# wait for poweron time is limited, thus in ceratin cases
|
||||
# it can time out. forfeiting firmware update in this case
|
||||
# would be cleaner option, since script cannot indefinitely
|
||||
# delay sysfs permissions setup and cause more troubles
|
||||
if [ "$?" != "0" ]; then
|
||||
notice "Touch firmware update forfeited!!!"
|
||||
return 1
|
||||
fi
|
||||
debug "forcing firmware upgrade"
|
||||
echo 1 > $touch_path/forcereflash
|
||||
debug "sending reflash command"
|
||||
if [ "$find_in_param" == "1" ]; then
|
||||
notice "Start touchUpg service, upgrade tp firmware parameters"
|
||||
echo 1 > $touch_path/flash_mode
|
||||
start vendor.touchUpg
|
||||
else
|
||||
echo 0 > $touch_path/flash_mode
|
||||
fi
|
||||
echo $firmware_file > $touch_path/doreflash
|
||||
read_touch_property flashprog
|
||||
if [ "$?" != "0" ]; then
|
||||
error_msg 1
|
||||
return 1
|
||||
fi
|
||||
bl_mode=$property
|
||||
if [ "$bl_mode" == "1" ]; then
|
||||
error_msg 4
|
||||
return 1
|
||||
fi
|
||||
read_touch_property buildid
|
||||
if [ "$?" != "0" ]; then
|
||||
error_msg 1
|
||||
return 1
|
||||
fi
|
||||
str_cfg_id_new=${property#*-}
|
||||
build_id_new=${property%-*}
|
||||
notice "Touch firmware config id at boot time $str_cfg_id_boot"
|
||||
notice "Touch firmware config id in the file $str_cfg_id_latest"
|
||||
notice "Touch firmware config id currently programmed $str_cfg_id_new"
|
||||
[ "$str_cfg_id_latest" != "$str_cfg_id_new" ] && error_msg 7 && return 1
|
||||
# indicate that update has been completed
|
||||
setprop $touch_update_prop "completed"
|
||||
notice "property [$touch_update_prop] set to [`getprop $touch_update_prop`]"
|
||||
if [ "$touch_vendor" == "synaptics" ]; then
|
||||
notice "forcing F54 registers update"
|
||||
echo 1 > $touch_path/f54/force_update
|
||||
notice "need to reload F54"
|
||||
reload_modules "synaptics_dsx_test_reporting"
|
||||
fi
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
do_sec_calibration()
|
||||
{
|
||||
local __result=$1
|
||||
local info
|
||||
local rc
|
||||
|
||||
sleep 3
|
||||
echo run_force_calibration > /sys/devices/virtual/sec/tsp/cmd
|
||||
rc=$(cat /sys/devices/virtual/sec/tsp/cmd_result)
|
||||
[ "$rc" != "run_force_calibration:OK" ] && return 1
|
||||
info=$(cat $touch_class_path/$touch_instance/buildid)
|
||||
if [ -f $touch_class_path/$touch_instance/mutual_range ]; then
|
||||
info=$info";$(cat $touch_class_path/$touch_instance/mutual_range)"
|
||||
else
|
||||
notice "mutual range unavailable"
|
||||
fi
|
||||
info=$info";forced"
|
||||
eval "$__result='$info'"
|
||||
return 0
|
||||
}
|
||||
|
||||
do_calibration()
|
||||
{
|
||||
local rc
|
||||
local cal_info
|
||||
local factory_build
|
||||
local cal_version
|
||||
|
||||
factory_build=$(getprop $factory_property 2> /dev/null)
|
||||
cal_info=$(getprop $touch_calibration_done_version 2> /dev/null)
|
||||
# new calibration info comes with mutual range and probably was enforced
|
||||
if [[ ("$cal_info" && "${cal_info%%;*}" != "$cal_info") || ("$cal_info" == "enable-autocalibration") ]]; then
|
||||
cal_version=${cal_info%%;*}
|
||||
cal_version=${cal_version#*-}
|
||||
debug "cal_version is '$cal_version'"
|
||||
fi
|
||||
|
||||
if [[ ("$factory_build" != 1 || "$cal_version" != "autocalibration") ]]; then
|
||||
debug "factory='$factory_build', cal_version='$cal_version', latest='$str_cfg_id_latest'"
|
||||
return
|
||||
fi
|
||||
|
||||
notice "Force touch calibration"
|
||||
case $touch_vendor in
|
||||
samsung) do_sec_calibration cal_info
|
||||
rc=$?
|
||||
debug "cal_info='$cal_info'"
|
||||
;;
|
||||
esac
|
||||
notice "Touch calibration result $rc"
|
||||
[ $rc == 0 ] && setprop $touch_calibration_done_version $cal_info
|
||||
}
|
||||
|
||||
process_touch_instance()
|
||||
{
|
||||
touch_vendor=$(cat $touch_class_path/$touch_instance/vendor)
|
||||
debug "touch vendor [$touch_vendor]"
|
||||
touch_path=/sys$(cat $touch_class_path/$touch_instance/path)
|
||||
debug "sysfs touch path: $touch_path"
|
||||
touch_status_prop=vendor.hw.touch.$touch_instance.status
|
||||
touch_update_prop=vendor.hw.touch.$touch_instance.update
|
||||
if [ ! -f $touch_path/doreflash ] ||
|
||||
[ ! -f $touch_path/poweron ] ||
|
||||
[ ! -f $touch_path/flashprog ] ||
|
||||
[ ! -f $touch_path/productinfo ] ||
|
||||
[ ! -f $touch_path/buildid ]; then
|
||||
error_msg 5
|
||||
return
|
||||
fi
|
||||
if [ $dump_statistics ]; then
|
||||
dump_statistics
|
||||
fi
|
||||
if [ -f $touch_path/flash_mode ]; then
|
||||
notice "Support parameter APK for FW upgrade"
|
||||
let search_in_param=1
|
||||
fi
|
||||
|
||||
notice "Checking touch ID [$touch_instance] FW upgrade"
|
||||
touch_vendor=$(cat $touch_class_path/$touch_instance/vendor)
|
||||
debug "touch vendor [$touch_vendor]"
|
||||
touch_path=/sys$(cat $touch_class_path/$touch_instance/path)
|
||||
debug "sysfs touch path: $touch_path"
|
||||
query_touch_info
|
||||
query_panel_info
|
||||
search_firmware_file
|
||||
[ "$?" == "0" ] && run_firmware_upgrade
|
||||
if [ "$?" == "0" ]; then
|
||||
do_calibration
|
||||
notice "Touch firmware is up to date"
|
||||
setprop $touch_status_prop "ready"
|
||||
notice "property [$touch_status_prop] set to [`getprop $touch_status_prop`]"
|
||||
notice "Handling touch ID [$touch_instance] permissions"
|
||||
fi
|
||||
setup_permissions
|
||||
}
|
||||
|
||||
# Main starts here
|
||||
query_panel_info
|
||||
load_driver_modules
|
||||
[ -d $touch_class_path ] || error_and_leave 8
|
||||
debug "sysfs panel path: $panel_path"
|
||||
product_id=$(getprop $device_property 2> /dev/null)
|
||||
[ -z "$product_id" ] && error_and_leave 2 $device_property
|
||||
product_id=${product_id%-*}
|
||||
product_id=${product_id%_*}
|
||||
debug "product id: $product_id"
|
||||
hwrev_id=$(getprop $hwrev_property 2> /dev/null)
|
||||
[ -z "$hwrev_id" ] && notice "hw revision undefined"
|
||||
debug "hw revision: $hwrev_id"
|
||||
cd $firmware_path
|
||||
# Run asynchronously for each instance
|
||||
for touch_instance in $(ls $touch_class_path); do
|
||||
process_touch_instance &
|
||||
done
|
||||
|
||||
# check if need to reload modules
|
||||
wait
|
||||
debug "all background processes completed"
|
||||
|
||||
return 0
|
506
rootdir/bin/init.mmi.usb.sh
Executable file
506
rootdir/bin/init.mmi.usb.sh
Executable file
@ -0,0 +1,506 @@
|
||||
#!/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
|
||||
#
|
||||
|
||||
dbg_on=0
|
||||
log_dbg()
|
||||
{
|
||||
echo "${0##*/}: $*"
|
||||
[ $dbg_on ] && echo "${0##*/}: $*" > /dev/kmsg
|
||||
}
|
||||
|
||||
log_info()
|
||||
{
|
||||
echo "${0##*/}: $*"
|
||||
echo "${0##*/}: $*" > /dev/kmsg
|
||||
}
|
||||
|
||||
target=`getprop ro.board.platform`
|
||||
usb_action=`getprop vendor.usb.mmi-usb-sh.action`
|
||||
log_dbg "mmi-usb-sh: action = \"$usb_action\""
|
||||
sys_usb_config=`getprop vendor.usb.config`
|
||||
factory_usb_config="usbnet"
|
||||
factory_usb_config_adb="usbnet,adb"
|
||||
|
||||
tcmd_ctrl_adb ()
|
||||
{
|
||||
ctrl_adb=`getprop vendor.tcmd.ctrl_adb`
|
||||
log_info "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/}
|
||||
log_info "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"
|
||||
log_info "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
|
||||
setprop vendor.usb.diag.func.name "diag"
|
||||
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"
|
||||
setprop vendor.usb.diag.func.name "diag"
|
||||
;;
|
||||
"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"
|
||||
setprop vendor.usb.diag.func.name "diag"
|
||||
;;
|
||||
"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
|
||||
setprop vendor.usb.diag.func.name "diag"
|
||||
;;
|
||||
"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"
|
||||
setprop vendor.usb.diag.func.name "diag"
|
||||
;;
|
||||
"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"
|
||||
setprop vendor.usb.diag.func.name "diag"
|
||||
;;
|
||||
"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"
|
||||
setprop vendor.usb.diag.func.name "diag"
|
||||
;;
|
||||
"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
|
||||
setprop vendor.usb.diag.func.name "diag"
|
||||
;;
|
||||
"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"
|
||||
setprop vendor.usb.diag.func.name "diag"
|
||||
;;
|
||||
"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"
|
||||
setprop vendor.usb.rndis.func.name "gsi"
|
||||
setprop vendor.usb.rmnet.func.name "gsi"
|
||||
setprop vendor.usb.diag.func.name "diag"
|
||||
;;
|
||||
"lito")
|
||||
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.diag.func.name "diag"
|
||||
;;
|
||||
"bengal")
|
||||
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"
|
||||
setprop vendor.usb.diag.func.name "diag"
|
||||
;;
|
||||
"lahaina")
|
||||
qcom_usb_config="diag,serial_cdev,rmnet,dpl,qdss"
|
||||
qcom_adb_usb_config="diag,serial_cdev,rmnet,dpl,qdss,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.diag.func.name "ffs"
|
||||
factory_usb_config="diag,usbnet"
|
||||
factory_usb_config_adb="diag,usbnet,adb"
|
||||
;;
|
||||
"holi")
|
||||
qcom_usb_config="diag,serial_cdev,rmnet,dpl,qdss"
|
||||
qcom_adb_usb_config="diag,serial_cdev,rmnet,dpl,qdss,adb"
|
||||
bpt_usb_config="diag,serial,rmnet"
|
||||
bpt_adb_usb_config="diag,serial,rmnet,adb"
|
||||
factory_usb_config="diag,usbnet"
|
||||
factory_usb_config_adb="diag,usbnet,adb"
|
||||
setprop vendor.usb.controller "4e00000.dwc3"
|
||||
setprop vendor.usb.rndis.func.name "gsi"
|
||||
setprop vendor.usb.rmnet.func.name "gsi"
|
||||
setprop vendor.usb.diag.func.name "ffs"
|
||||
;;
|
||||
"taro")
|
||||
qcom_usb_config="diag,serial_cdev,rmnet,dpl,qdss"
|
||||
qcom_adb_usb_config="diag,serial_cdev,rmnet,dpl,qdss,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.diag.func.name "ffs"
|
||||
factory_usb_config="diag,usbnet"
|
||||
factory_usb_config_adb="diag,usbnet,adb"
|
||||
;;
|
||||
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`
|
||||
|
||||
log_info "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`
|
||||
log_info "mmi-usb-sh: phonelock.mode=$phonelock_type, usb.policylocked=$usb_restricted, securehw=$securehw, buildtype=$buildtype, cid=$cid"
|
||||
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" != $factory_usb_config_adb ]
|
||||
then
|
||||
setprop persist.vendor.usb.config $factory_usb_config_adb
|
||||
setprop persist.vendor.usb.mot-factory.config $factory_usb_config_adb
|
||||
setprop persist.vendor.usb.mot-factory.func $factory_usb_config_adb
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
if [ "$usb_config" != $factory_usb_config ]
|
||||
then
|
||||
setprop persist.vendor.usb.config $factory_usb_config
|
||||
setprop persist.vendor.usb.mot-factory.config $factory_usb_config
|
||||
setprop persist.vendor.usb.mot-factory.func $factory_usb_config
|
||||
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
|
||||
log_info "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
|
||||
|
||||
ffs_mtp=`getprop vendor.usb.use_ffs_mtp`
|
||||
new_persist_usb_config=`getprop persist.vendor.usb.config`
|
||||
if [ "$ffs_mtp" == "1" ] && [ "$new_persist_usb_config" == "mtp" ]
|
||||
then
|
||||
setprop persist.vendor.usb.config none
|
||||
fi
|
||||
|
||||
adb_early=`getprop ro.boot.adb_early`
|
||||
if [ "$adb_early" == "1" ]; then
|
||||
echo 0 > /sys/class/android_usb/android0/secure
|
||||
log_info "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`
|
||||
log_info "mmi-usb-sh - bootcomplete = $bootcomplete"
|
||||
while [ "$bootcomplete" != "1" ]; do
|
||||
log_dbg "Sleeping till bootup!"
|
||||
sleep 1
|
||||
count=$((count+1))
|
||||
if [ $count -gt 90 ]
|
||||
then
|
||||
log_info "mmi-usb-sh - Timed out waiting for bootup"
|
||||
break
|
||||
fi
|
||||
bootcomplete=`getprop vendor.boot_completed`
|
||||
done
|
||||
echo 0 > /sys/class/android_usb/android0/secure
|
||||
log_info "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
|
735
rootdir/bin/init.oem.hw.sh
Executable file
735
rootdir/bin/init.oem.hw.sh
Executable file
@ -0,0 +1,735 @@
|
||||
#!/vendor/bin/sh
|
||||
|
||||
BASEDIR=vendor
|
||||
|
||||
PATH=/sbin:/$BASEDIR/sbin:/$BASEDIR/bin:/$BASEDIR/xbin
|
||||
export PATH
|
||||
|
||||
while getopts dpfrM op;
|
||||
do
|
||||
case $op in
|
||||
d) dbg_on=1;;
|
||||
p) populate_only=1;;
|
||||
f) dead_touch=1;;
|
||||
r) reset_touch=1;;
|
||||
M) mount_2nd_stage=1;;
|
||||
esac
|
||||
done
|
||||
shift $(($OPTIND-1))
|
||||
|
||||
scriptname=${0##*/}
|
||||
hw_mp=/proc/hw
|
||||
config_mp=/proc/config
|
||||
reboot_utag=$config_mp/.reboot
|
||||
touch_status_prop=vendor.hw.touch.status
|
||||
hw_cfg_file=hw_config.xml
|
||||
vhw_file=/$BASEDIR/etc/vhw.xml
|
||||
bp_file=/system/build.prop
|
||||
oem_file=/oem/oem.prop
|
||||
load_error=3
|
||||
need_to_reload=2
|
||||
reload_in_progress=1
|
||||
reload_done=0
|
||||
ver_utag=".version"
|
||||
version_fs="unknown"
|
||||
xml_version="unknown"
|
||||
device_params=""
|
||||
xml_file=""
|
||||
utag_update_fail="false"
|
||||
modem_ver_prop=ro.vendor.hw.modem_version
|
||||
policy_prop=ro.vendor.super_image_policy
|
||||
|
||||
super_image_detection()
|
||||
{
|
||||
local subsys
|
||||
local file2mount
|
||||
local basefile
|
||||
local version
|
||||
local extention
|
||||
local image_dir
|
||||
local is_super_image
|
||||
local super_image_prop
|
||||
local file_mount_prop
|
||||
local modem_version=$(getprop $modem_ver_prop)
|
||||
local policy=$(getprop $policy_prop)
|
||||
|
||||
debug "'$policy_prop' is '$policy'"
|
||||
for subsys in modem fsg; do
|
||||
debug "Processing [${subsys}]..."
|
||||
is_super_image=""
|
||||
case ${subsys} in
|
||||
modem) image_dir=/vendor/firmware_mnt;;
|
||||
fsg) image_dir=/vendor/fsg;;
|
||||
esac
|
||||
|
||||
[ -f $image_dir/super_modem ] && is_super_image="true"
|
||||
debug "super image '$is_super_image'"
|
||||
|
||||
if [ "$is_super_image" == "true" ]; then
|
||||
file2mount=""
|
||||
case ${subsys} in
|
||||
modem) super_image_prop="ro.vendor.hw.modem_super_image"
|
||||
file_mount_prop="ro.vendor.hw.modem_mount_file"
|
||||
basefile="NON-HLOS.bin"
|
||||
extention=".bin"
|
||||
[ "$modem_version" ] && file2mount=$(printf "NON-HLOS%sbin" $modem_version)
|
||||
;;
|
||||
fsg) super_image_prop="ro.vendor.hw.fsg_super_image"
|
||||
file_mount_prop="ro.vendor.hw.fsg_mount_file"
|
||||
basefile="fsg.mbn"
|
||||
extention=".mbn"
|
||||
[ "$modem_version" ] && file2mount=$(printf "fsg%smbn" $modem_version)
|
||||
;;
|
||||
esac
|
||||
if [ -z "$file2mount" ]; then
|
||||
notice "'$modem_ver_prop' not set, but [$subsys] is super image!"
|
||||
else
|
||||
# modem_version matches existing file in super image
|
||||
if [ -f $image_dir/$file2mount ]; then
|
||||
notice "[$subsys] is super image. '$file2mount' will be mounted"
|
||||
setprop $file_mount_prop $file2mount
|
||||
setprop $super_image_prop yes
|
||||
continue
|
||||
fi
|
||||
notice "[$subsys] is super image. '$file2mount' not found"
|
||||
fi
|
||||
else
|
||||
notice "[$subsys] non-super image"
|
||||
fi
|
||||
|
||||
# check super image policy
|
||||
if [ "$policy" == "enforce" ]; then
|
||||
notice "[$subsys] strict super image policy! Rebooting to recovery..."
|
||||
debug "'ro.vendor.hw.super_image_failure' -> 'yes'"
|
||||
setprop ro.vendor.hw.super_image_failure yes
|
||||
return
|
||||
fi
|
||||
notice "[$subsys] super image policy not enforced"
|
||||
# proceed with non-super image if policy allows
|
||||
if [ -z "$is_super_image" ]; then
|
||||
notice "[$subsys] proceed with non-super image!"
|
||||
continue
|
||||
fi
|
||||
|
||||
# retrieve default version if available
|
||||
version=$(cat $image_dir/super_modem)
|
||||
if [ "$version" ]; then
|
||||
basefile=$version
|
||||
notice "default file override '$basefile'"
|
||||
else
|
||||
notice "use default file: '$basefile' instead of '$file2mount'"
|
||||
fi
|
||||
|
||||
notice "Searching for '$basefile' in $image_dir..."
|
||||
debug "checking file '$image_dir/$basefile'"
|
||||
if [ -f $image_dir/$basefile ]; then
|
||||
notice "[$subsys] is super image! '$basefile' will be mounted"
|
||||
debug "'$file_mount_prop' -> '$basefile'"
|
||||
setprop $file_mount_prop $basefile
|
||||
debug "'$super_image_prop' -> 'yes'"
|
||||
setprop $super_image_prop yes
|
||||
continue
|
||||
fi
|
||||
|
||||
# set to fail
|
||||
notice "Unable to mount '$basefile'! Rebooting to recovery..."
|
||||
debug "'ro.vendor.hw.super_image_failure' -> 'yes'"
|
||||
setprop ro.vendor.hw.super_image_failure yes
|
||||
return
|
||||
done
|
||||
}
|
||||
|
||||
set_reboot_counter()
|
||||
{
|
||||
local value=$1
|
||||
local reboot_cnt=0
|
||||
local reboot_mp=${reboot_utag%.*}
|
||||
local tag_name=${reboot_utag##*/}
|
||||
if [ $((value)) -gt 0 ]; then
|
||||
notice "increase reboot counter"
|
||||
[ -d $reboot_utag ] && reboot_cnt=$(cat $reboot_utag/ascii)
|
||||
value=$(($reboot_cnt + 1))
|
||||
fi
|
||||
if [ ! -d $reboot_utag ]; then
|
||||
echo ${reboot_utag##*/} > $reboot_mp/all/new
|
||||
[ $? != 0 ] && notice "error creating UTAG $tag_name"
|
||||
fi
|
||||
echo "$value" > $reboot_utag/ascii
|
||||
[ $? != 0 ] && notice "error updating UTAG $tag_name"
|
||||
notice "UTAG $tag_name is [`cat $reboot_utag/ascii`]"
|
||||
}
|
||||
|
||||
set_reboot_counter_property()
|
||||
{
|
||||
local reboot_cnt=0
|
||||
local tag_name=${reboot_utag##*/}
|
||||
if [ -d $reboot_utag ]; then
|
||||
reboot_cnt=$(cat $reboot_utag/ascii)
|
||||
notice "UTAG $tag_name has value [$reboot_cnt]"
|
||||
else
|
||||
notice "UTAG $tag_name does not exist"
|
||||
fi
|
||||
setprop $touch_status_prop $reboot_cnt
|
||||
notice "property [$touch_status_prop] is set to [`getprop $touch_status_prop`]"
|
||||
}
|
||||
|
||||
debug()
|
||||
{
|
||||
[ $dbg_on ] && echo "Debug: $*"
|
||||
}
|
||||
|
||||
notice()
|
||||
{
|
||||
echo "$*"
|
||||
echo "$scriptname: $*" > /dev/kmsg
|
||||
}
|
||||
|
||||
add_device_params()
|
||||
{
|
||||
device_params=$device_params" $@"
|
||||
debug "add_device_params='$device_params'"
|
||||
}
|
||||
|
||||
drop_device_parameter()
|
||||
{
|
||||
device_params=${device_params% *}
|
||||
debug "drop_device_parameter='$device_params'"
|
||||
}
|
||||
|
||||
set_xml_file()
|
||||
{
|
||||
xml_file=$@
|
||||
debug "working with XML file='$xml_file'"
|
||||
}
|
||||
|
||||
exec_parser()
|
||||
{
|
||||
eval motobox expat -u -f $xml_file $device_params "$@" 2>/dev/null
|
||||
}
|
||||
|
||||
reload_utags()
|
||||
{
|
||||
local mp=$1
|
||||
local value
|
||||
echo "1" > $mp/reload
|
||||
value=$(cat $mp/reload)
|
||||
while [ "$value" == "$reload_in_progress" ]; do
|
||||
notice "waiting for loading to complete"
|
||||
sleep 1;
|
||||
value=$(cat $mp/reload)
|
||||
notice "'$mp' current status [$value]"
|
||||
done
|
||||
}
|
||||
|
||||
procfs_wait_for_device()
|
||||
{
|
||||
local __result=$1
|
||||
local status
|
||||
local mpi
|
||||
local IFS=' '
|
||||
local device_timeout_count=0
|
||||
while [ ! -f $hw_mp/reload ] || [ ! -f $config_mp/reload ]; do
|
||||
notice "waiting for devices"
|
||||
sleep 1;
|
||||
if [ "$device_timeout_count" -eq "10" ];then
|
||||
notice "waiting for devices timeout"
|
||||
eval $__result=""
|
||||
return
|
||||
fi
|
||||
device_timeout_count=$(($device_timeout_count + 1))
|
||||
done
|
||||
for mpi in $hw_mp $config_mp; do
|
||||
status=$(cat $mpi/reload)
|
||||
notice "mount point '$mpi' status [$status]"
|
||||
if [ "$status" == "$need_to_reload" ]; then
|
||||
notice "force $mpi reloading"
|
||||
reload_utags $mpi
|
||||
fi
|
||||
done
|
||||
for mpi in $hw_mp $config_mp; do
|
||||
status=$(cat $mpi/reload)
|
||||
notice "$mpi reload is [$status]"
|
||||
device_timeout_count=0
|
||||
while [ "$status" != "$reload_done" ]; do
|
||||
notice "waiting for loading $mpi to complete"
|
||||
sleep 1;
|
||||
status=$(cat $mpi/reload)
|
||||
if [ "$device_timeout_count" -eq "10" ]; then
|
||||
notice "error: waiting for loading $mpi timeout"
|
||||
break
|
||||
fi
|
||||
device_timeout_count=$(($device_timeout_count + 1))
|
||||
done
|
||||
done
|
||||
eval $__result=$status
|
||||
}
|
||||
|
||||
get_attr_data_by_name()
|
||||
{
|
||||
local __result=$1
|
||||
local attr=$2
|
||||
shift 2
|
||||
local IFS=' '
|
||||
eval $__result=""
|
||||
for arg in ${@}; do
|
||||
[ "${arg%=*}" == "$attr" ] || continue
|
||||
debug "attr_data='${arg#*=}'"
|
||||
eval $__result="${arg#*=}"
|
||||
break
|
||||
done
|
||||
}
|
||||
|
||||
get_tag_data()
|
||||
{
|
||||
local __name=$1
|
||||
local __value=$2
|
||||
shift 2
|
||||
local dataval
|
||||
local IFS=' '
|
||||
eval $__name=""
|
||||
eval $__value=""
|
||||
for arg in ${@}; do
|
||||
case $arg in
|
||||
string-array | string)
|
||||
debug "---/ skip keyword: '$arg'"
|
||||
continue;;
|
||||
esac
|
||||
debug "---> arg='$arg'"
|
||||
if [ "${arg%=*}" == "name" ]; then
|
||||
eval $__name=${arg#*=}
|
||||
continue
|
||||
fi
|
||||
# eval treats ';' as a separator, thus make it '\;'
|
||||
dataval=$(echo ${arg#?} | sed 's/;/\\;/g')
|
||||
debug "<--- dataval='$dataval'"
|
||||
eval $__value=$dataval
|
||||
done
|
||||
}
|
||||
|
||||
update_utag()
|
||||
{
|
||||
local utag=$1
|
||||
local payload=$2
|
||||
local verify
|
||||
local rc
|
||||
if [ ! -d $hw_mp/$utag ]; then
|
||||
notice "creating utag '$utag'"
|
||||
echo $utag > $hw_mp/all/new
|
||||
rc=$?
|
||||
[ "$rc" != "0" ] && notice "'$utag' create dir failed rc=$rc"
|
||||
fi
|
||||
debug "writing '$payload' to '$hw_mp/$utag/ascii'"
|
||||
echo "$payload" > $hw_mp/$utag/ascii
|
||||
rc=$?
|
||||
if [ "$rc" != "0" ]; then
|
||||
utag_update_fail="true"
|
||||
notice "'$utag' write file failed rc=$rc"
|
||||
fi
|
||||
verify=$(cat $hw_mp/$utag/ascii)
|
||||
debug "read '$verify' from '$hw_mp/$utag/ascii'"
|
||||
[ "$verify" != "$payload" ] && notice "'$utag' payload validation failed"
|
||||
}
|
||||
|
||||
populate_utags()
|
||||
{
|
||||
local selection="$@"
|
||||
local pline
|
||||
local ptag
|
||||
local pvalue
|
||||
for pline in $(exec_parser $selection); do
|
||||
get_tag_data ptag pvalue $pline
|
||||
url_style_off pvalue $pvalue
|
||||
debug "tag='$ptag' value='$pvalue'"
|
||||
update_utag $ptag $pvalue
|
||||
done
|
||||
}
|
||||
|
||||
set_ro_hw_properties_upgrade()
|
||||
{
|
||||
local utag_path
|
||||
local utag_name
|
||||
local prop_prefix
|
||||
local utag_value
|
||||
local verify
|
||||
for hwtag in $(find $hw_mp -name '.system'); do
|
||||
debug "path $hwtag has '.system' in its name"
|
||||
prop_prefix="ro.vendor.hw."
|
||||
utag_path=${hwtag%/*}
|
||||
utag_name=${utag_path##*/}
|
||||
utag_value=$(cat $utag_path/ascii)
|
||||
setprop $prop_prefix$utag_name "$utag_value"
|
||||
notice "ro.vendor.hw.$utag_name='$utag_value'"
|
||||
done
|
||||
}
|
||||
|
||||
set_ro_hw_properties()
|
||||
{
|
||||
local utag_path
|
||||
local utag_name
|
||||
local prop_prefix
|
||||
local utag_value
|
||||
local verify
|
||||
for hwtag in $(find $hw_mp -name '.system'); do
|
||||
debug "path $hwtag has '.system' in its name"
|
||||
prop_prefix=$(cat $hwtag/ascii)
|
||||
verify=${prop_prefix%.}
|
||||
# esure property ends with '.'
|
||||
if [ "$prop_prefix" == "$verify" ]; then
|
||||
prop_prefix="$prop_prefix."
|
||||
debug "added '.' at the end of [$prop_prefix]"
|
||||
|
||||
fi
|
||||
utag_path=${hwtag%/*}
|
||||
utag_name=${utag_path##*/}
|
||||
utag_value=$(cat $utag_path/ascii)
|
||||
setprop $prop_prefix$utag_name "$utag_value"
|
||||
notice "$prop_prefix$utag_name='$utag_value'"
|
||||
done
|
||||
}
|
||||
|
||||
set_ro_vendor_incremental()
|
||||
{
|
||||
local vendor_incremental="ro.vendor.build.version.incremental"
|
||||
local vendor_incremental_value
|
||||
local fetch_prop="ro.build.version.incremental"
|
||||
local fetch_value=$(getprop $fetch_prop)
|
||||
|
||||
[ -z "$fetch_value" ] && prefetch_from_file $fetch_prop vendor_incremental_value
|
||||
setprop $vendor_incremental "$vendor_incremental_value"
|
||||
notice "$vendor_incremental='$vendor_incremental_value'"
|
||||
}
|
||||
|
||||
smart_value()
|
||||
{
|
||||
local mtag=$1
|
||||
local __result=$2
|
||||
local value
|
||||
eval $__result=""
|
||||
local tmp=${mtag#?}
|
||||
# absolute path to the file starts with '/'
|
||||
if [ "${mtag%$tmp}" == "/" ]; then
|
||||
value=$(cat $mtag)
|
||||
# property likely to have '.'
|
||||
elif [ "$mtag" != "${mtag%.*}" ]; then
|
||||
value=$(getprop $mtag)
|
||||
else # tag otherwise
|
||||
value=$(cat $hw_mp/$mtag/ascii)
|
||||
fi
|
||||
eval $__result='$value'
|
||||
}
|
||||
|
||||
url_style_off()
|
||||
{
|
||||
local __arg=$1
|
||||
local value=$2
|
||||
if [[ $value == *%* ]]; then
|
||||
value=$(echo $value | sed 's/%20/ /g')
|
||||
value=$(echo $value | sed 's/%28/\(/g')
|
||||
value=$(echo $value | sed 's/%29/\)/g')
|
||||
fi
|
||||
eval $__arg='$value'
|
||||
}
|
||||
|
||||
match()
|
||||
{
|
||||
local mapping
|
||||
local mline
|
||||
local mtag
|
||||
local fs_value
|
||||
local mvalue
|
||||
local matched
|
||||
url_style_off mapping $1
|
||||
debug "match mapping='$mapping'"
|
||||
# put '\"' around $mapping to ensure XML
|
||||
# parser takes it as a single argument
|
||||
for mline in $(exec_parser \"$mapping\"); do
|
||||
get_tag_data mtag mvalue $mline
|
||||
url_style_off mvalue $mvalue
|
||||
# obtain value based on data source: utag, property or file
|
||||
smart_value $mtag fs_value
|
||||
if [ "$fs_value" == "$mvalue" ]; then
|
||||
matched="true";
|
||||
else
|
||||
matched="false";
|
||||
fi
|
||||
debug "cmp utag='$mtag' values '$mvalue' & '$fs_value' is \"$matched\""
|
||||
[ "$matched" == "false" ] && break
|
||||
done
|
||||
[ "$matched" == "true" ] && return 0
|
||||
return 1
|
||||
}
|
||||
|
||||
find_match()
|
||||
{
|
||||
local __retval=$1
|
||||
local tag_name
|
||||
local fline
|
||||
local line
|
||||
local subsection
|
||||
local matched="false"
|
||||
eval $__retval=""
|
||||
for fline in $(exec_parser); do
|
||||
subsection=${fline%% *}
|
||||
add_device_params $subsection
|
||||
for line in $(exec_parser); do
|
||||
get_attr_data_by_name tag_name "name" $line
|
||||
debug "tag_name='$tag_name'"
|
||||
match $tag_name
|
||||
[ "$?" != "0" ] && continue
|
||||
eval $__retval=$tag_name
|
||||
matched="true"
|
||||
break
|
||||
done
|
||||
drop_device_parameter
|
||||
[ "$matched" == "true" ] && break
|
||||
done
|
||||
}
|
||||
|
||||
prefetch_from_file()
|
||||
{
|
||||
local pname=$1
|
||||
local __result=$2
|
||||
local value
|
||||
local override
|
||||
eval $__result=""
|
||||
value=$(cat $bp_file 2>/dev/null | sed '/^$/d' | sed '/^#/d' | sed '/^import/d' | sed -n "/$pname=/p" | sed 's/.*=//')
|
||||
debug "'$pname' from '$bp_file': '$value'"
|
||||
if [ -f $oem_file ]; then
|
||||
override=$(cat $oem_file 2>/dev/null | sed '/^$/d' | sed '/^#/d' | sed '/^import/d' | sed -n "/$pname=/p" | sed 's/.*=//')
|
||||
[ "$override" ] && value=$override && debug "'$pname' from '$oem_file': '$value'"
|
||||
fi
|
||||
eval $__result=$value
|
||||
}
|
||||
|
||||
append_match()
|
||||
{
|
||||
local prop_list=$1
|
||||
local suffix="$2"
|
||||
local dest_prop
|
||||
local fetched_prop
|
||||
local prop_value
|
||||
local IFS=','
|
||||
# properties list to put the result of appending hw suffix to
|
||||
# example: appended="ro.vendor.product.name,ro.vendor.product.device"
|
||||
for dest_prop in $prop_list; do
|
||||
fetch_prop=${dest_prop}
|
||||
# only alter property name that has "vendor" in it
|
||||
if [ "${fetch_prop//.vendor}" != "$dest_prop" ]; then
|
||||
fetch_prop=${fetch_prop//.vendor}
|
||||
prop_value=$(getprop $fetch_prop)
|
||||
[ -z "$prop_value" ] && prefetch_from_file $fetch_prop prop_value
|
||||
# finally set destination property to appended value
|
||||
setprop $dest_prop "$prop_value$suffix"
|
||||
notice "$dest_prop='$prop_value$suffix'"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
process_mappings()
|
||||
{
|
||||
local pname=""
|
||||
local pexport=""
|
||||
local pdefault=""
|
||||
local pappend=""
|
||||
local putag=""
|
||||
local subsection
|
||||
local pline
|
||||
local matched_val
|
||||
local whitespace_val
|
||||
local export_val
|
||||
local utag_val
|
||||
for pline in $(exec_parser); do
|
||||
subsection=${pline%% *}
|
||||
debug "subsection is '$subsection'"
|
||||
get_attr_data_by_name pname "name" $pline
|
||||
get_attr_data_by_name pexport "export" $pline
|
||||
get_attr_data_by_name pdefault "default" $pline
|
||||
get_attr_data_by_name pappend "append" $pline
|
||||
get_attr_data_by_name putag "writeback" $pline
|
||||
[ "$pname" ] && url_style_off pname $pname && debug "name='$pname'"
|
||||
[ "$pexport" ] && url_style_off pexport $pexport && debug "export='$pexport'"
|
||||
[ "$pdefault" ] && url_style_off pdefault $pdefault && debug "default='$pdefault'"
|
||||
[ "$pappend" ] && url_style_off pappend $pappend && debug "append='$pappend'"
|
||||
# add 'subsection' to permanent parameters
|
||||
add_device_params $subsection
|
||||
# call itself here to handle nonamed subsection, like quirks
|
||||
[ -z "$pname" ] && [ -z "$pexport" ] && [ -z "$pdefault" ] && [ -z "$pappend" ] && [ -z "$putag" ] && process_mappings && continue
|
||||
find_match matched_val
|
||||
[ "$matched_val" ] && url_style_off matched_val $matched_val
|
||||
# append_match handles OEM overrides, thus has to be called even with empty value
|
||||
[ "$pappend" ] && append_match $pappend "$matched_val"
|
||||
if [ "$matched_val" ]; then
|
||||
if [ "$pexport" ]; then
|
||||
setprop $pexport "$matched_val"
|
||||
notice "exporting '$matched_val' into property $pexport"
|
||||
fi
|
||||
elif [ "$pexport" -a "$pdefault" ]; then
|
||||
# if match is not found, proceed with default
|
||||
setprop $pexport "$pdefault"
|
||||
notice "defaulting '$pdefault' into property $pexport"
|
||||
fi
|
||||
|
||||
if [ "$putag" ] && [ -d $hw_mp/$putag ]; then
|
||||
export_val=$(getprop $pexport)
|
||||
utag_val=$(cat $hw_mp/$putag/ascii)
|
||||
debug "writeback compare $utag_val,$export_val"
|
||||
# if property is empty value, clear the utag.
|
||||
# if property and writeback utag are empty value, don't update utag
|
||||
if [ "$export_val" -o "$utag_val" != "(null)" ] && [ "$utag_val" != "$export_val" ]; then
|
||||
update_utag $putag $export_val
|
||||
notice "writeback '$export_val' into utag $putag"
|
||||
fi
|
||||
fi
|
||||
# remove the last added parameter
|
||||
drop_device_parameter
|
||||
done
|
||||
}
|
||||
|
||||
# Main starts here
|
||||
IFS=$'\n'
|
||||
|
||||
if [ ! -z "$mount_2nd_stage" ]; then
|
||||
notice "Super image detection"
|
||||
super_image_detection
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [ ! -z "$reset_touch" ]; then
|
||||
notice "reset reboot counter"
|
||||
set_reboot_counter 0
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [ ! -z "$dead_touch" ]; then
|
||||
notice "property [$touch_status_prop] set to [dead]"
|
||||
set_reboot_counter 1
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [ -f /vendor/lib/modules/utags.ko ]; then
|
||||
notice "loading utag driver"
|
||||
insmod /vendor/lib/modules/utags.ko
|
||||
if [ $? -ne 0 ]; then
|
||||
gki_modules_full_path=`find /vendor/lib/modules -name "*-gki"`
|
||||
if [ -n "$gki_modules_full_path" ]; then
|
||||
gki_modules_path=`basename $gki_modules_full_path`
|
||||
notice "loading gki utag driver in /vendor/lib/modules/$gki_modules_path"
|
||||
insmod /vendor/lib/modules/$gki_modules_path/utags.ko
|
||||
if [ $? -ne 0 ]; then
|
||||
notice "fail to load /vendor/lib/modules/$gki_modules_path/utags.ko"
|
||||
setprop ro.vendor.mot.gki.path "."
|
||||
else
|
||||
notice "successfully load /vendor/lib/modules/$gki_modules_path/utags.ko"
|
||||
setprop ro.vendor.mot.gki.path $gki_modules_path
|
||||
fi
|
||||
else
|
||||
notice "fail to load utag driver"
|
||||
setprop ro.vendor.mot.gki.path "."
|
||||
fi
|
||||
else
|
||||
setprop ro.vendor.mot.gki.path "."
|
||||
fi
|
||||
fi
|
||||
|
||||
notice "checking integrity"
|
||||
# check necessary components exist and just proceed
|
||||
# with RO properties setup otherwise
|
||||
if [ ! -f /$BASEDIR/bin/expat ] || [ ! -f $vhw_file ]; then
|
||||
notice "warning: missing expat or xml"
|
||||
set_ro_hw_properties
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [ ! -z "$populate_only" ]; then
|
||||
# special handling for factory UTAGs provisioning
|
||||
for path in /data/local/tmp /pds/factory; do
|
||||
[ -f $path/$hw_cfg_file ] && break
|
||||
done
|
||||
notice "populating hw config from '$path/$hw_cfg_file'"
|
||||
set_xml_file $path/$hw_cfg_file
|
||||
populate_utags hardware
|
||||
return 0
|
||||
fi
|
||||
|
||||
notice "initializing procfs"
|
||||
procfs_wait_for_device readiness
|
||||
if [ "$readiness" != "0" ]; then
|
||||
notice "no access to hw utags procfs"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# populate touch status property with reboot counter
|
||||
set_reboot_counter_property &
|
||||
|
||||
# XML parsing starts here
|
||||
set_xml_file $vhw_file
|
||||
|
||||
get_attr_data_by_name boot_device_prop "match" $(exec_parser)
|
||||
debug "attr='get' value='$boot_device_prop'"
|
||||
if [ -z $boot_device_prop ]; then
|
||||
notice "fatal: undefined boot device property"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# ensure lower case
|
||||
typeset -l boot_device=$(getprop $boot_device_prop)
|
||||
# drop suffixes
|
||||
boot_device=${boot_device%[_-]*}
|
||||
notice "matching to boot device '$boot_device'"
|
||||
|
||||
# add 'validation' to permanent parameters
|
||||
add_device_params validation
|
||||
|
||||
for line in $(exec_parser); do
|
||||
get_attr_data_by_name product "name" $line
|
||||
debug "attr='name' value='$product'"
|
||||
if [ "$product" == "$boot_device" ]; then
|
||||
get_attr_data_by_name xml_version "version" $line
|
||||
[ "$xml_version" != "unknown" ] && notice "device '$boot_device' xml version='$xml_version'"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
[ "$xml_version" == "unknown" ] && notice "no match found for device '$boot_device'"
|
||||
# delete obsolete 'version' utag if exists
|
||||
[ -d $hw_mp/${ver_utag#?} ] && $(echo ${ver_utag#?} > $hw_mp/all/delete)
|
||||
# read procfs version
|
||||
[ -d $hw_mp/$ver_utag ] && version_fs=$(cat $hw_mp/$ver_utag/ascii)
|
||||
notice "procfs version='$version_fs'"
|
||||
# add 'device' and '$boot_device' to permanent parameters
|
||||
add_device_params device $boot_device
|
||||
[ "$xml_version" == "$version_fs" ] && notice "hw descriptor is up to date"
|
||||
for section in $(exec_parser); do
|
||||
debug "section='$section'"
|
||||
case $section in
|
||||
mappings)
|
||||
# add 'mappings' to permanent parameters
|
||||
add_device_params $section
|
||||
process_mappings &
|
||||
;;
|
||||
*)
|
||||
[ "$xml_version" == "$version_fs" ] && continue
|
||||
populate_utags $section;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ "$xml_version" != "$version_fs" ]; then
|
||||
# create version utag if it's missing
|
||||
[ ! -d $hw_mp/$ver_utag ] && $(echo "$ver_utag" > $hw_mp/all/new)
|
||||
# update procfs version
|
||||
[ -d $hw_mp/$ver_utag ] && $(echo "$xml_version" > $hw_mp/$ver_utag/ascii)
|
||||
fi
|
||||
|
||||
set_ro_vendor_incremental &
|
||||
|
||||
set_ro_hw_properties
|
||||
|
||||
if [ "$utag_update_fail" == "true" ]; then
|
||||
set_ro_hw_properties_upgrade
|
||||
fi
|
||||
|
||||
wait
|
||||
|
||||
notice "script init.oem.hw.sh finish "
|
||||
return 0
|
||||
|
216
rootdir/bin/init.qcom.class_core.sh
Executable file
216
rootdir/bin/init.qcom.class_core.sh
Executable file
@ -0,0 +1,216 @@
|
||||
#!/vendor/bin/sh
|
||||
|
||||
# Copyright (c) 2012-2013, 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.
|
||||
#
|
||||
|
||||
# Set platform variables
|
||||
target=`getprop ro.board.platform`
|
||||
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
|
||||
|
||||
|
||||
# Dynamic Memory Managment (DMM) provides a sys file system to the userspace
|
||||
# that can be used to plug in/out memory that has been configured as unstable.
|
||||
# This unstable memory can be in Active or In-Active State.
|
||||
# Each of which the userspace can request by writing to a sys file.
|
||||
#
|
||||
# ro.dev.dmm = 1; Indicates that DMM is enabled in the Android User Space. This
|
||||
# property is set in the Android system properties file.
|
||||
#
|
||||
# If ro.dev.dmm.dpd.start_address is set here then the target has a memory
|
||||
# configuration that supports DynamicMemoryManagement.
|
||||
init_DMM()
|
||||
{
|
||||
block=-1
|
||||
|
||||
case "$target" in
|
||||
"msm7630_surf" | "msm7630_1x" | "msm7630_fusion" | "msm8960")
|
||||
;;
|
||||
*)
|
||||
return
|
||||
;;
|
||||
esac
|
||||
|
||||
mem="/sys/devices/system/memory"
|
||||
op=`cat $mem/movable_start_bytes`
|
||||
case "$op" in
|
||||
"0")
|
||||
log -p i -t DMM DMM Disabled. movable_start_bytes not set: $op
|
||||
;;
|
||||
|
||||
"$mem/movable_start_bytes: No such file or directory ")
|
||||
log -p i -t DMM DMM Disabled. movable_start_bytes does not exist: $op
|
||||
;;
|
||||
|
||||
*)
|
||||
log -p i -t DMM DMM available. movable_start_bytes at $op
|
||||
movable_start_bytes=0x`cat $mem/movable_start_bytes`
|
||||
block_size_bytes=0x`cat $mem/block_size_bytes`
|
||||
block=$((#${movable_start_bytes}/${block_size_bytes}))
|
||||
|
||||
chown -h system.system $mem/memory$block/state
|
||||
chown -h system.system $mem/probe
|
||||
chown -h system.system $mem/active
|
||||
chown -h system.system $mem/remove
|
||||
|
||||
case "$target" in
|
||||
"msm7630_surf" | "msm7630_1x" | "msm7630_fusion")
|
||||
echo $movable_start_bytes > $mem/probe
|
||||
case "$?" in
|
||||
"0")
|
||||
log -p i -t DMM $movable_start_bytes to physical hotplug succeeded.
|
||||
;;
|
||||
*)
|
||||
log -p e -t DMM $movable_start_bytes to physical hotplug failed.
|
||||
return
|
||||
;;
|
||||
esac
|
||||
|
||||
echo online > $mem/memory$block/state
|
||||
case "$?" in
|
||||
"0")
|
||||
log -p i -t DMM \'echo online\' to logical hotplug succeeded.
|
||||
;;
|
||||
*)
|
||||
log -p e -t DMM \'echo online\' to logical hotplug failed.
|
||||
return
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
|
||||
setprop ro.dev.dmm.dpd.start_address $movable_start_bytes
|
||||
setprop ro.dev.dmm.dpd.block $block
|
||||
;;
|
||||
esac
|
||||
|
||||
case "$target" in
|
||||
"msm8960")
|
||||
return
|
||||
;;
|
||||
esac
|
||||
|
||||
# For 7X30 targets:
|
||||
# ro.dev.dmm.dpd.start_address is set when the target has a 2x256Mb memory
|
||||
# configuration. This is also used to indicate that the target is capable of
|
||||
# setting EBI-1 to Deep Power Down or Self Refresh.
|
||||
op=`cat $mem/low_power_memory_start_bytes`
|
||||
case "$op" in
|
||||
"0")
|
||||
log -p i -t DMM Self-Refresh-Only Disabled. low_power_memory_start_bytes not set:$op
|
||||
;;
|
||||
"$mem/low_power_memory_start_bytes No such file or directory ")
|
||||
log -p i -t DMM Self-Refresh-Only Disabled. low_power_memory_start_bytes does not exist:$op
|
||||
;;
|
||||
*)
|
||||
log -p i -t DMM Self-Refresh-Only available. low_power_memory_start_bytes at $op
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
#
|
||||
# For controlling console and shell on console on 8960 - perist.serial.enable 8960
|
||||
# On other target use default ro.debuggable property.
|
||||
#
|
||||
serial=`getprop persist.serial.enable`
|
||||
dserial=`getprop ro.debuggable`
|
||||
case "$target" in
|
||||
"msm8960")
|
||||
case "$serial" in
|
||||
"0")
|
||||
echo 0 > /sys/devices/platform/msm_serial_hsl.0/console
|
||||
;;
|
||||
"1")
|
||||
echo 1 > /sys/devices/platform/msm_serial_hsl.0/console
|
||||
start console
|
||||
;;
|
||||
*)
|
||||
case "$dserial" in
|
||||
"1")
|
||||
start console
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
|
||||
"msm8610" | "msm8974" | "msm8226")
|
||||
case "$serial" in
|
||||
"0")
|
||||
echo 0 > /sys/devices/f991f000.serial/console
|
||||
;;
|
||||
"1")
|
||||
echo 1 > /sys/devices/f991f000.serial/console
|
||||
start console
|
||||
;;
|
||||
*)
|
||||
case "$dserial" in
|
||||
"1")
|
||||
start console
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
*)
|
||||
case "$dserial" in
|
||||
"1")
|
||||
start console
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
|
||||
case "$target" in
|
||||
"msm7630_surf" | "msm7630_1x" | "msm7630_fusion")
|
||||
insmod /system/lib/modules/ss_mfcinit.ko
|
||||
insmod /system/lib/modules/ss_vencoder.ko
|
||||
insmod /system/lib/modules/ss_vdecoder.ko
|
||||
chmod -h 0666 /dev/ss_mfc_reg
|
||||
chmod -h 0666 /dev/ss_vdec
|
||||
chmod -h 0666 /dev/ss_venc
|
||||
|
||||
init_DMM
|
||||
;;
|
||||
|
||||
"msm8960")
|
||||
init_DMM
|
||||
;;
|
||||
esac
|
115
rootdir/bin/init.qcom.coex.sh
Executable file
115
rootdir/bin/init.qcom.coex.sh
Executable file
@ -0,0 +1,115 @@
|
||||
#! /vendor/bin/sh
|
||||
|
||||
# Copyright (c) 2009-2010, 2012, 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.
|
||||
|
||||
LOG_TAG="qcom-bt-wlan-coex"
|
||||
LOG_NAME="${0}:"
|
||||
|
||||
coex_pid=""
|
||||
ath_wlan_supported=`getprop wlan.driver.ath`
|
||||
|
||||
loge ()
|
||||
{
|
||||
/system/bin/log -t $LOG_TAG -p e "$LOG_NAME $@"
|
||||
}
|
||||
|
||||
logi ()
|
||||
{
|
||||
/system/bin/log -t $LOG_TAG -p i "$LOG_NAME $@"
|
||||
}
|
||||
|
||||
failed ()
|
||||
{
|
||||
loge "$1: exit code $2"
|
||||
exit $2
|
||||
}
|
||||
|
||||
start_coex ()
|
||||
{
|
||||
case "$ath_wlan_supported" in
|
||||
"2")
|
||||
echo "ATH WLAN Chip ID AR6004 is enabled"
|
||||
/system/bin/abtfilt -d -z -n -m -a -w wlan0 &
|
||||
;;
|
||||
"1")
|
||||
echo "ATH WLAN Chip ID is enabled"
|
||||
# Must have -d -z -n -v -s -w wlan0 parameters for atheros btfilter.
|
||||
/system/bin/abtfilt -d -z -n -v -q -s -w wlan0 &
|
||||
;;
|
||||
"0")
|
||||
echo "WCN WLAN Chip ID is enabled"
|
||||
# Must have -o turned on to avoid daemon (otherwise we cannot get pid)
|
||||
/system/bin/btwlancoex -o $opt_flags &
|
||||
;;
|
||||
*)
|
||||
echo "NO WLAN Chip ID is enabled, so enabling ATH as default"
|
||||
# Must have -d -z -n -v -s -w wlan0 parameters for atheros btfilter.
|
||||
/system/bin/abtfilt -d -z -n -v -q -s -w wlan0 &
|
||||
;;
|
||||
esac
|
||||
coex_pid=$!
|
||||
logi "start_coex: pid = $coex_pid"
|
||||
}
|
||||
|
||||
kill_coex ()
|
||||
{
|
||||
logi "kill_coex: pid = $coex_pid"
|
||||
kill -TERM $coex_pid
|
||||
# this shell doesn't exit now -- wait returns for normal exit
|
||||
}
|
||||
|
||||
# mimic coex options parsing -- maybe a waste of effort
|
||||
USAGE="${0} [-o] [-c] [-r] [-i] [-h]"
|
||||
|
||||
while getopts "ocrih" f
|
||||
do
|
||||
case $f in
|
||||
o | c | r | i | h) opt_flags="$opt_flags -$f" ;;
|
||||
\?) echo $USAGE; exit 1;;
|
||||
esac
|
||||
done
|
||||
|
||||
# init does SIGTERM on ctl.stop for service
|
||||
trap "kill_coex" TERM INT
|
||||
|
||||
#Selectively start coex module
|
||||
target=`getprop ro.board.platform`
|
||||
|
||||
if [ "$target" == "msm8960" ] && [ "$ath_wlan_supported" != "2" ]; then
|
||||
logi "btwlancoex/abtfilt is not needed"
|
||||
else
|
||||
# Build settings may not produce the coex executable
|
||||
if ls /system/bin/btwlancoex || ls /system/bin/abtfilt
|
||||
then
|
||||
start_coex
|
||||
wait $coex_pid
|
||||
logi "Coex stopped"
|
||||
else
|
||||
logi "btwlancoex/abtfilt not available"
|
||||
fi
|
||||
fi
|
||||
exit 0
|
551
rootdir/bin/init.qcom.early_boot.sh
Executable file
551
rootdir/bin/init.qcom.early_boot.sh
Executable file
@ -0,0 +1,551 @@
|
||||
#! /vendor/bin/sh
|
||||
|
||||
# Copyright (c) 2012-2013,2016,2018-2020 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|386|436)
|
||||
# Vulkan is not supported for 8917 variants
|
||||
setprop vendor.opengles.version 196608
|
||||
setprop persist.graphics.vulkan.disable true
|
||||
setprop vendor.gralloc.disable_ahardware_buffer 1
|
||||
# Disable adsprpcd_sensorspd daemon
|
||||
setprop vendor.fastrpc.disable.adsprpcd_sensorspd.daemon 1
|
||||
;;
|
||||
*)
|
||||
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
|
||||
*)
|
||||
setprop vendor.media.target_variant "_kona"
|
||||
if [ $fb_width -le 1600 ]; then
|
||||
setprop vendor.display.lcd_density 560
|
||||
else
|
||||
setprop vendor.display.lcd_density 640
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
"lito")
|
||||
case "$soc_hwid" in
|
||||
400|440)
|
||||
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
|
||||
;;
|
||||
434|459)
|
||||
sku_ver=`cat /sys/devices/platform/soc/aa00000.qcom,vidc1/sku_version` 2> /dev/null
|
||||
setprop vendor.media.target.version 2
|
||||
if [ $sku_ver -eq 1 ]; then
|
||||
setprop vendor.media.target.version 3
|
||||
fi
|
||||
;;
|
||||
476)
|
||||
# Fraser soc_id 476
|
||||
setprop vendor.display.enable_qsync_idle 1
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
"bengal")
|
||||
case "$soc_hwid" in
|
||||
441|473)
|
||||
# 441 is for scuba and 473 for scuba iot qcm
|
||||
setprop vendor.fastrpc.disable.cdsprpcd.daemon 1
|
||||
setprop vendor.media.target.version 2
|
||||
setprop vendor.gralloc.disable_ubwc 1
|
||||
setprop vendor.display.enhance_idle_time 1
|
||||
setprop vendor.netflix.bsp_rev ""
|
||||
# 196609 is decimal for 0x30001 to report version 3.1
|
||||
setprop vendor.opengles.version 196609
|
||||
sku_ver=`cat /sys/devices/platform/soc/5a00000.qcom,vidc1/sku_version` 2> /dev/null
|
||||
if [ $sku_ver -eq 1 ]; then
|
||||
setprop vendor.media.target.version 3
|
||||
fi
|
||||
;;
|
||||
471|474)
|
||||
# 471 is for scuba APQ and 474 for scuba iot qcs
|
||||
setprop vendor.fastrpc.disable.cdsprpcd.daemon 1
|
||||
setprop vendor.gralloc.disable_ubwc 1
|
||||
setprop vendor.display.enhance_idle_time 1
|
||||
setprop vendor.netflix.bsp_rev ""
|
||||
;;
|
||||
*)
|
||||
# default case is for bengal
|
||||
setprop vendor.netflix.bsp_rev "Q6115-31409-1"
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
"sdm710" | "msmpeafowl")
|
||||
case "$soc_hwplatform" in
|
||||
*)
|
||||
if [ $fb_width -le 1600 ]; then
|
||||
setprop vendor.display.lcd_density 560
|
||||
else
|
||||
setprop vendor.display.lcd_density 640
|
||||
fi
|
||||
|
||||
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_hwplatform" in
|
||||
*)
|
||||
if [ $fb_width -le 1600 ]; then
|
||||
setprop vendor.display.lcd_density 560
|
||||
else
|
||||
setprop vendor.display.lcd_density 640
|
||||
fi
|
||||
|
||||
if [ $soc_hwid -eq 385 ]; then
|
||||
setprop vendor.media.target.version 1
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
"holi")
|
||||
setprop vendor.media.target_variant "_holi"
|
||||
;;
|
||||
esac
|
||||
case "$target" in
|
||||
"msm8937")
|
||||
case "$soc_hwid" in
|
||||
386|354|353|303)
|
||||
# enable qrtr-ns service for kernel 4.14 or above
|
||||
KernelVersionStr=`cat /proc/sys/kernel/osrelease`
|
||||
KernelVersionS=${KernelVersionStr:2:2}
|
||||
KernelVersionA=${KernelVersionStr:0:1}
|
||||
KernelVersionB=${KernelVersionS%.*}
|
||||
|
||||
if [ $KernelVersionA -ge 4 ] && [ $KernelVersionB -ge 14 ]; then
|
||||
setprop init.svc.vendor.qrtrns.enable 1
|
||||
fi
|
||||
;;
|
||||
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
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
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
|
||||
# Remove turbo freq from prop
|
||||
gpu_freq=`cat /sys/class/kgsl/kgsl-3d0/gpu_available_frequencies | sed 's/905000000 //g'` 2> /dev/null
|
||||
setprop vendor.gpu.available_frequencies "$gpu_freq"
|
||||
fi
|
||||
|
||||
# GPU turbo
|
||||
gpu_max_freq=`cat /sys/class/kgsl/kgsl-3d0/devfreq/max_freq` 2> /dev/null
|
||||
if [ ${gpu_max_freq} == '905000000' ]; then
|
||||
setprop vendor.gpu.turbo_supported 1
|
||||
setprop vendor.gpu.turbo_enabled 0
|
||||
fi
|
6120
rootdir/bin/init.qcom.post_boot.sh
Executable file
6120
rootdir/bin/init.qcom.post_boot.sh
Executable file
File diff suppressed because it is too large
Load Diff
78
rootdir/bin/init.qcom.sdio.sh
Executable file
78
rootdir/bin/init.qcom.sdio.sh
Executable file
@ -0,0 +1,78 @@
|
||||
#! /vendor/bin/sh
|
||||
|
||||
# Copyright (c) 2010, 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.
|
||||
#
|
||||
|
||||
# For successful WLAN card detection, WLAN needs SDIO polling turned on.
|
||||
# This script can be used to turn on/off SDIO polling on appropriate
|
||||
# SDIO slot on the MSM target (e.g. slot 3 on 7x30 surf).
|
||||
|
||||
arg=$1
|
||||
target=`getprop ro.board.platform`
|
||||
|
||||
case "$target" in
|
||||
"msm7627_6x")
|
||||
echo 1 > /sys/devices/platform/msm_sdcc.1/polling
|
||||
echo 1 > /sys/devices/platform/msm_sdcc.2/polling
|
||||
;;
|
||||
|
||||
"msm7627_ffa")
|
||||
echo 1 > /sys/devices/platform/msm_sdcc.2/polling
|
||||
;;
|
||||
|
||||
"msm7627_surf")
|
||||
echo 1 > /sys/devices/platform/msm_sdcc.1/polling
|
||||
echo 1 > /sys/devices/platform/msm_sdcc.2/polling
|
||||
;;
|
||||
|
||||
"msm7627a")
|
||||
echo 1 > /sys/devices/platform/msm_sdcc.2/polling
|
||||
;;
|
||||
|
||||
"msm7630_surf")
|
||||
echo 1 > /sys/devices/platform/msm_sdcc.3/polling
|
||||
;;
|
||||
|
||||
"msm7630_1x")
|
||||
echo 1 > /sys/devices/platform/msm_sdcc.3/polling
|
||||
;;
|
||||
|
||||
"msm7630_fusion")
|
||||
echo 1 > /sys/devices/platform/msm_sdcc.3/polling
|
||||
;;
|
||||
|
||||
"msm8660")
|
||||
echo 1 > /sys/devices/platform/msm_sdcc.4/polling
|
||||
;;
|
||||
|
||||
"msm8660_csfb")
|
||||
echo 1 > /sys/devices/platform/msm_sdcc.4/polling
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
465
rootdir/bin/init.qcom.sh
Executable file
465
rootdir/bin/init.qcom.sh
Executable file
@ -0,0 +1,465 @@
|
||||
#! /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
|
||||
}
|
||||
|
||||
baseband=`getprop ro.baseband`
|
||||
echo 1 > /proc/sys/net/ipv6/conf/default/accept_ra_defrtr
|
||||
|
||||
case "$baseband" in
|
||||
"svlte2a")
|
||||
start bridgemgrd
|
||||
;;
|
||||
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 "7 4 1 7" > /proc/sys/kernel/printk
|
||||
;;
|
||||
*)
|
||||
#set default loglevel to KERN_WARNING
|
||||
echo "4 4 1 4" > /proc/sys/kernel/printk
|
||||
;;
|
||||
esac
|
77
rootdir/bin/init.qti.dcvs.sh
Executable file
77
rootdir/bin/init.qti.dcvs.sh
Executable file
@ -0,0 +1,77 @@
|
||||
#! /vendor/bin/sh
|
||||
#
|
||||
# Copyright (c) 2020, 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.
|
||||
#
|
||||
for device in /sys/devices/platform/soc
|
||||
do
|
||||
for memlat in $device/*qcom,devfreq-l3/*cpu*-lat/devfreq/*cpu*-lat
|
||||
do
|
||||
echo "mem_latency" > $memlat/governor
|
||||
echo 8 > $memlat/polling_interval
|
||||
echo 400 > $memlat/mem_latency/ratio_ceil
|
||||
done
|
||||
|
||||
#Enable mem_latency governor for LLCC and DDR scaling
|
||||
for memlat in $device/*cpu*-lat/devfreq/*cpu*-lat
|
||||
do
|
||||
echo "mem_latency" > $memlat/governor
|
||||
echo 8 > $memlat/polling_interval
|
||||
echo 400 > $memlat/mem_latency/ratio_ceil
|
||||
done
|
||||
|
||||
#Enable compute governor for gold latfloor
|
||||
for latfloor in $device/*cpu-ddr-latfloor*/devfreq/*cpu-ddr-latfloor*
|
||||
do
|
||||
echo "compute" > $latfloor/governor
|
||||
echo 8 > $latfloor/polling_interval
|
||||
done
|
||||
|
||||
for qoslat in $device/*qoslat/devfreq/*qoslat
|
||||
do
|
||||
echo "mem_latency" > $qoslat/governor
|
||||
echo 10 > $qoslat/polling_interval
|
||||
echo 50 > $qoslat/mem_latency/ratio_ceil
|
||||
done
|
||||
|
||||
for l3cdsp in $device/*qcom,devfreq-l3/*cdsp-l3-lat/devfreq/*cdsp-l3-lat
|
||||
do
|
||||
echo "cdspl3" > $l3cdsp/governor
|
||||
done
|
||||
|
||||
#Gold L3 ratio ceil
|
||||
for l3gold in $device/*qcom,devfreq-l3/*cpu4-cpu-l3-lat/devfreq/*cpu4-cpu-l3-lat
|
||||
do
|
||||
echo 4000 > $l3gold/mem_latency/ratio_ceil
|
||||
done
|
||||
|
||||
#Prime L3 ratio ceil
|
||||
for l3prime in $device/*qcom,devfreq-l3/*cpu7-cpu-l3-lat/devfreq/*cpu7-cpu-l3-lat
|
||||
do
|
||||
echo 20000 > $l3prime/mem_latency/ratio_ceil
|
||||
done
|
||||
done;
|
61
rootdir/bin/init.qti.media.sh
Executable file
61
rootdir/bin/init.qti.media.sh
Executable file
@ -0,0 +1,61 @@
|
||||
#! /vendor/bin/sh
|
||||
#==============================================================================
|
||||
# init.qti.media.sh
|
||||
#
|
||||
# Copyright (c) 2020-2021, 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.
|
||||
#===============================================================================
|
||||
|
||||
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
|
||||
|
||||
target=`getprop ro.board.platform`
|
||||
case "$target" in
|
||||
"bengal")
|
||||
case "$soc_hwid" in
|
||||
441|471|473|474)
|
||||
setprop vendor.media.target.version 2
|
||||
sku_ver=`cat /sys/devices/platform/soc/5a00000.qcom,vidc1/sku_version` 2> /dev/null
|
||||
if [ $sku_ver -eq 1 ]; then
|
||||
setprop vendor.media.target.version 3
|
||||
fi
|
||||
;;
|
||||
518)
|
||||
setprop vendor.media.target.version 3
|
||||
;;
|
||||
*)
|
||||
sku_ver=`cat /sys/devices/platform/soc/5a00000.qcom,vidc/sku_version` 2> /dev/null
|
||||
if [ $sku_ver -eq 1 ]; then
|
||||
setprop vendor.media.target.version 1
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
24
rootdir/bin/init.qti.qcv.sh
Executable file
24
rootdir/bin/init.qti.qcv.sh
Executable file
@ -0,0 +1,24 @@
|
||||
#! /vendor/bin/sh
|
||||
#=============================================================================
|
||||
# Copyright (c) 2020-21 Qualcomm Technologies, Inc.
|
||||
# All Rights Reserved.
|
||||
# Confidential and Proprietary - Qualcomm Technologies, Inc.
|
||||
#=============================================================================
|
||||
|
||||
soc_id=`cat /sys/devices/soc0/soc_id` 2> /dev/null
|
||||
|
||||
# Store soc_id in ro.vendor.qti.soc_id
|
||||
setprop ro.vendor.qti.soc_id $soc_id
|
||||
|
||||
# For chipsets in QCV family, convert soc_id to soc_name
|
||||
# and store it in ro.vendor.qti.soc_name.
|
||||
if [ "$soc_id" -eq 415 ] || [ "$soc_id" -eq 439 ] || [ "$soc_id" -eq 456 ] ||
|
||||
[ "$soc_id" -eq 501 ] || [ "$soc_id" -eq 502 ]; then
|
||||
setprop ro.vendor.qti.soc_name lahaina
|
||||
elif [ "$soc_id" -eq 450 ]; then
|
||||
setprop ro.vendor.qti.soc_name shima
|
||||
elif [ "$soc_id" -eq 475 ] || [ "$soc_id" -eq 499 ] ||
|
||||
[ "$soc_id" -eq 497 ] || [ "$soc_id" -eq 498 ] ||
|
||||
[ "$soc_id" -eq 515 ]; then
|
||||
setprop ro.vendor.qti.soc_name yupik
|
||||
fi
|
Loading…
x
Reference in New Issue
Block a user