| ReStranger | 3d63ad7 | 2025-09-30 04:05:06 +0300 | [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 | |
| 38 | case "$baseband" in |
| 39 | "apq" | "sda" | "qcs" ) |
| 40 | setprop ro.vendor.radio.noril yes |
| 41 | stop vendor.qcrild |
| 42 | stop vendor.qcrild2 |
| 43 | stop vendor.qcrild3 |
| 44 | esac |
| 45 | |
| 46 | case "$baseband" in |
| 47 | "msm" | "csfb" | "svlte2a" | "mdm" | "mdm2" | "sglte" | "sglte2" | "dsda2" | "unknown" | "dsda3" | "sdm" | "sdx" | "sm6") |
| 48 | |
| 49 | # start qcrild only for targets on which modem is present |
| 50 | # modemvalue 0x0 indicates Modem online |
| 51 | # modemvalue 0x1 indicates Modem IP is not functional or disabled |
| 52 | # modemvalue 0x2 indicates Modem offline |
| 53 | modemvalue="0x0" |
| 54 | if [ -f /sys/devices/soc0/modem ]; then |
| 55 | modemvalue=`cat /sys/devices/soc0/modem` |
| 56 | fi |
| 57 | |
| 58 | if [ $modemvalue != "0x1" ] && [ $modemvalue != "0x2" ]; then |
| 59 | start vendor.qcrild |
| 60 | |
| 61 | case "$baseband" in |
| 62 | "svlte2a" | "csfb") |
| 63 | start qmiproxy |
| 64 | ;; |
| 65 | "sglte" | "sglte2" ) |
| 66 | if [ "x$sgltecsfb" != "xtrue" ]; then |
| 67 | start qmiproxy |
| 68 | else |
| 69 | setprop persist.vendor.radio.voice.modem.index 0 |
| 70 | fi |
| 71 | ;; |
| 72 | esac |
| 73 | |
| 74 | multisim=`getprop persist.radio.multisim.config` |
| 75 | |
| 76 | if [ "$multisim" = "dsds" ] || [ "$multisim" = "dsda" ]; then |
| 77 | start vendor.qcrild2 |
| 78 | elif [ "$multisim" = "tsts" ]; then |
| 79 | start vendor.qcrild2 |
| 80 | start vendor.qcrild3 |
| 81 | fi |
| 82 | |
| 83 | case "$datamode" in |
| 84 | "tethered") |
| 85 | start vendor.dataqti |
| 86 | if [ "$low_ram" != "true" ]; then |
| 87 | start vendor.dataadpl |
| 88 | fi |
| 89 | ;; |
| 90 | "concurrent") |
| 91 | start vendor.dataqti |
| 92 | if [ "$low_ram" != "true" ]; then |
| 93 | start vendor.dataadpl |
| 94 | fi |
| 95 | ;; |
| 96 | *) |
| 97 | ;; |
| 98 | esac |
| 99 | else |
| 100 | setprop ro.vendor.radio.noril yes |
| 101 | stop vendor.qcrild |
| 102 | stop vendor.qcrild2 |
| 103 | stop vendor.qcrild3 |
| 104 | fi |
| 105 | esac |
| 106 | |
| 107 | # |
| 108 | # Allow persistent faking of bms |
| 109 | # User needs to set fake bms charge in persist.vendor.bms.fake_batt_capacity |
| 110 | # |
| 111 | fake_batt_capacity=`getprop persist.vendor.bms.fake_batt_capacity` |
| 112 | case "$fake_batt_capacity" in |
| 113 | "") ;; #Do nothing here |
| 114 | * ) |
| 115 | echo "$fake_batt_capacity" > /sys/class/power_supply/battery/capacity |
| 116 | ;; |
| 117 | esac |