merothh | 32be688 | 2022-01-03 01:54:57 +0530 | [diff] [blame] | 1 | #! /vendor/bin/sh |
| 2 | |
| 3 | # Copyright (c) 2013-2014, 2019 The Linux Foundation. All rights reserved. |
| 4 | # |
| 5 | # Redistribution and use in source and binary forms, with or without |
| 6 | # modification, are permitted provided that the following conditions are met: |
| 7 | # * Redistributions of source code must retain the above copyright |
| 8 | # notice, this list of conditions and the following disclaimer. |
| 9 | # * Redistributions in binary form must reproduce the above copyright |
| 10 | # notice, this list of conditions and the following disclaimer in the |
| 11 | # documentation and/or other materials provided with the distribution. |
| 12 | # * Neither the name of The Linux Foundation nor |
| 13 | # the names of its contributors may be used to endorse or promote |
| 14 | # products derived from this software without specific prior written |
| 15 | # permission. |
| 16 | # |
| 17 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| 18 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 19 | # IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
| 20 | # NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
| 21 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| 22 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 23 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; |
| 24 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
| 25 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
| 26 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF |
| 27 | # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 28 | # |
| 29 | |
| 30 | # |
| 31 | # start ril-daemon only for targets on which radio is present |
| 32 | # |
| 33 | baseband=`getprop ro.baseband` |
| 34 | sgltecsfb=`getprop persist.vendor.radio.sglte_csfb` |
| 35 | datamode=`getprop persist.vendor.data.mode` |
| 36 | low_ram=`getprop ro.config.low_ram` |
| 37 | qcrild_status=true |
| 38 | |
| 39 | case "$baseband" in |
| 40 | "apq" | "sda" | "qcs" ) |
| 41 | setprop ro.vendor.radio.noril yes |
| 42 | stop vendor.ril-daemon |
| 43 | stop vendor.qcrild |
| 44 | esac |
| 45 | |
| 46 | case "$baseband" in |
| 47 | "msm" | "csfb" | "svlte2a" | "mdm" | "mdm2" | "sglte" | "sglte2" | "dsda2" | "unknown" | "dsda3" | "sdm" | "sdx" | "sm6") |
| 48 | |
| 49 | # For older modem packages launch ril-daemon. |
| 50 | if [ -f /vendor/firmware_mnt/verinfo/ver_info.txt ]; then |
| 51 | modem=`cat /vendor/firmware_mnt/verinfo/ver_info.txt | |
| 52 | sed -n 's/^[^:]*modem[^:]*:[[:blank:]]*//p' | |
| 53 | sed 's/.*MPSS.\(.*\)/\1/g' | cut -d \. -f 1` |
| 54 | if [ "$modem" = "AT" ]; then |
| 55 | version=`cat /vendor/firmware_mnt/verinfo/ver_info.txt | |
| 56 | sed -n 's/^[^:]*modem[^:]*:[[:blank:]]*//p' | |
| 57 | sed 's/.*AT.\(.*\)/\1/g' | cut -d \- -f 1` |
| 58 | if [ ! -z $version ]; then |
| 59 | if [ "$version" \< "3.1" ]; then |
| 60 | qcrild_status=false |
| 61 | fi |
| 62 | fi |
| 63 | elif [ "$modem" = "TA" ]; then |
| 64 | version=`cat /vendor/firmware_mnt/verinfo/ver_info.txt | |
| 65 | sed -n 's/^[^:]*modem[^:]*:[[:blank:]]*//p' | |
| 66 | sed 's/.*TA.\(.*\)/\1/g' | cut -d \- -f 1` |
| 67 | if [ ! -z $version ]; then |
| 68 | if [ "$version" \< "3.0" ]; then |
| 69 | qcrild_status=false |
| 70 | fi |
| 71 | fi |
| 72 | elif [ "$modem" = "JO" ]; then |
| 73 | version=`cat /vendor/firmware_mnt/verinfo/ver_info.txt | |
| 74 | sed -n 's/^[^:]*modem[^:]*:[[:blank:]]*//p' | |
| 75 | sed 's/.*JO.\(.*\)/\1/g' | cut -d \- -f 1` |
| 76 | if [ ! -z $version ]; then |
| 77 | if [ "$version" \< "3.2" ]; then |
| 78 | qcrild_status=false |
| 79 | fi |
| 80 | fi |
| 81 | elif [ "$modem" = "TH" ]; then |
| 82 | qcrild_status=false |
| 83 | fi |
| 84 | fi |
| 85 | |
| 86 | if [ "$qcrild_status" = "true" ]; then |
| 87 | # Make sure both rild, qcrild are not running at same time. |
| 88 | # This is possible with vanilla aosp system image. |
| 89 | stop vendor.ril-daemon |
| 90 | |
| 91 | start vendor.qcrild |
| 92 | else |
| 93 | start vendor.ril-daemon |
| 94 | fi |
| 95 | |
| 96 | case "$baseband" in |
| 97 | "svlte2a" | "csfb") |
| 98 | start qmiproxy |
| 99 | ;; |
| 100 | "sglte" | "sglte2" ) |
| 101 | if [ "x$sgltecsfb" != "xtrue" ]; then |
| 102 | start qmiproxy |
| 103 | else |
| 104 | setprop persist.vendor.radio.voice.modem.index 0 |
| 105 | fi |
| 106 | ;; |
| 107 | esac |
| 108 | |
| 109 | multisim=`getprop persist.radio.multisim.config` |
| 110 | |
| 111 | if [ "$multisim" = "dsds" ] || [ "$multisim" = "dsda" ]; then |
| 112 | if [ "$qcrild_status" = "true" ]; then |
| 113 | start vendor.qcrild2 |
| 114 | else |
| 115 | start vendor.ril-daemon2 |
| 116 | fi |
| 117 | elif [ "$multisim" = "tsts" ]; then |
| 118 | if [ "$qcrild_status" = "true" ]; then |
| 119 | start vendor.qcrild2 |
| 120 | start vendor.qcrild3 |
| 121 | else |
| 122 | start vendor.ril-daemon2 |
| 123 | start vendor.ril-daemon3 |
| 124 | fi |
| 125 | fi |
| 126 | |
| 127 | case "$datamode" in |
| 128 | "tethered") |
| 129 | start vendor.dataqti |
| 130 | if [ "$low_ram" != "true" ]; then |
| 131 | start vendor.dataadpl |
| 132 | fi |
| 133 | ;; |
| 134 | "concurrent") |
| 135 | start vendor.dataqti |
| 136 | if [ "$low_ram" != "true" ]; then |
| 137 | start vendor.dataadpl |
| 138 | fi |
| 139 | ;; |
| 140 | *) |
| 141 | ;; |
| 142 | esac |
| 143 | esac |
| 144 | |
| 145 | # |
| 146 | # Allow persistent faking of bms |
| 147 | # User needs to set fake bms charge in persist.vendor.bms.fake_batt_capacity |
| 148 | # |
| 149 | fake_batt_capacity=`getprop persist.vendor.bms.fake_batt_capacity` |
| 150 | case "$fake_batt_capacity" in |
| 151 | "") ;; #Do nothing here |
| 152 | * ) |
| 153 | echo "$fake_batt_capacity" > /sys/class/power_supply/battery/capacity |
| 154 | ;; |
| 155 | esac |