init.class_main.sh 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. #! /vendor/bin/sh
  2. # Copyright (c) 2013-2014, 2019 The Linux Foundation. All rights reserved.
  3. #
  4. # Redistribution and use in source and binary forms, with or without
  5. # modification, are permitted provided that the following conditions are met:
  6. # * Redistributions of source code must retain the above copyright
  7. # notice, this list of conditions and the following disclaimer.
  8. # * Redistributions in binary form must reproduce the above copyright
  9. # notice, this list of conditions and the following disclaimer in the
  10. # documentation and/or other materials provided with the distribution.
  11. # * Neither the name of The Linux Foundation nor
  12. # the names of its contributors may be used to endorse or promote
  13. # products derived from this software without specific prior written
  14. # permission.
  15. #
  16. # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  17. # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  18. # IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  19. # NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
  20. # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  21. # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  22. # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  23. # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  24. # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  25. # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  26. # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  27. #
  28. #
  29. # start ril-daemon only for targets on which radio is present
  30. #
  31. baseband=`getprop ro.baseband`
  32. sgltecsfb=`getprop persist.vendor.radio.sglte_csfb`
  33. datamode=`getprop persist.vendor.data.mode`
  34. low_ram=`getprop ro.config.low_ram`
  35. case "$baseband" in
  36. "apq" | "sda" | "qcs" )
  37. setprop ro.vendor.radio.noril yes
  38. stop vendor.qcrild
  39. stop vendor.qcrild2
  40. stop vendor.qcrild3
  41. esac
  42. case "$baseband" in
  43. "msm" | "csfb" | "svlte2a" | "mdm" | "mdm2" | "sglte" | "sglte2" | "dsda2" | "unknown" | "dsda3" | "sdm" | "sdx" | "sm6")
  44. # start qcrild only for targets on which modem is present
  45. # modemvalue 0x0 indicates Modem online
  46. # modemvalue 0x1 indicates Modem IP is not functional or disabled
  47. # modemvalue 0x2 indicates Modem offline
  48. modemvalue="0x0"
  49. if [ -f /sys/devices/soc0/modem ]; then
  50. modemvalue=`cat /sys/devices/soc0/modem`
  51. fi
  52. if [ $modemvalue != "0x1" ] && [ $modemvalue != "0x2" ]; then
  53. start vendor.qcrild
  54. case "$baseband" in
  55. "svlte2a" | "csfb")
  56. start qmiproxy
  57. ;;
  58. "sglte" | "sglte2" )
  59. if [ "x$sgltecsfb" != "xtrue" ]; then
  60. start qmiproxy
  61. else
  62. setprop persist.vendor.radio.voice.modem.index 0
  63. fi
  64. ;;
  65. esac
  66. multisim=`getprop persist.radio.multisim.config`
  67. if [ "$multisim" = "dsds" ] || [ "$multisim" = "dsda" ]; then
  68. start vendor.qcrild2
  69. elif [ "$multisim" = "tsts" ]; then
  70. start vendor.qcrild2
  71. start vendor.qcrild3
  72. fi
  73. case "$datamode" in
  74. "tethered")
  75. start vendor.dataqti
  76. if [ "$low_ram" != "true" ]; then
  77. start vendor.dataadpl
  78. fi
  79. ;;
  80. "concurrent")
  81. start vendor.dataqti
  82. if [ "$low_ram" != "true" ]; then
  83. start vendor.dataadpl
  84. fi
  85. ;;
  86. *)
  87. ;;
  88. esac
  89. else
  90. setprop ro.vendor.radio.noril yes
  91. stop vendor.qcrild
  92. stop vendor.qcrild2
  93. stop vendor.qcrild3
  94. fi
  95. esac
  96. #
  97. # Allow persistent faking of bms
  98. # User needs to set fake bms charge in persist.vendor.bms.fake_batt_capacity
  99. #
  100. fake_batt_capacity=`getprop persist.vendor.bms.fake_batt_capacity`
  101. case "$fake_batt_capacity" in
  102. "") ;; #Do nothing here
  103. * )
  104. echo "$fake_batt_capacity" > /sys/class/power_supply/battery/capacity
  105. ;;
  106. esac