init.class_main.sh 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. #! /vendor/bin/sh
  2. # Copyright (c) 2013-2018, 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. qcrild_status=true
  35. case "$baseband" in
  36. "apq" | "sda" | "qcs" )
  37. setprop ro.vendor.radio.noril yes
  38. stop ril-daemon
  39. stop vendor.ril-daemon
  40. stop vendor.qcrild
  41. start vendor.ipacm
  42. esac
  43. case "$baseband" in
  44. "sa8")
  45. start vendor.ipacm
  46. esac
  47. case "$baseband" in
  48. "msm" | "csfb" | "svlte2a" | "mdm" | "mdm2" | "sglte" | "sglte2" | "dsda2" | "unknown" | "dsda3")
  49. start vendor.qmuxd
  50. esac
  51. case "$baseband" in
  52. "msm" | "csfb" | "svlte2a" | "mdm" | "mdm2" | "sglte" | "sglte2" | "dsda2" | "unknown" | "dsda3" | "sdm" | "sdx" | "sm6")
  53. # For older modem packages launch ril-daemon.
  54. if [ -f /vendor/firmware_mnt/verinfo/ver_info.txt ]; then
  55. modem=`cat /vendor/firmware_mnt/verinfo/ver_info.txt |
  56. sed -n 's/^[^:]*modem[^:]*:[[:blank:]]*//p' |
  57. sed 's/.*MPSS.\(.*\)/\1/g' | cut -d \. -f 1`
  58. if [ "$modem" = "AT" ]; then
  59. version=`cat /vendor/firmware_mnt/verinfo/ver_info.txt |
  60. sed -n 's/^[^:]*modem[^:]*:[[:blank:]]*//p' |
  61. sed 's/.*AT.\(.*\)/\1/g' | cut -d \- -f 1`
  62. if [ ! -z $version ]; then
  63. if [ "$version" \< "3.1" ]; then
  64. qcrild_status=false
  65. fi
  66. fi
  67. elif [ "$modem" = "TA" ]; then
  68. version=`cat /vendor/firmware_mnt/verinfo/ver_info.txt |
  69. sed -n 's/^[^:]*modem[^:]*:[[:blank:]]*//p' |
  70. sed 's/.*TA.\(.*\)/\1/g' | cut -d \- -f 1`
  71. if [ ! -z $version ]; then
  72. if [ "$version" \< "3.0" ]; then
  73. qcrild_status=false
  74. fi
  75. fi
  76. elif [ "$modem" = "JO" ]; then
  77. version=`cat /vendor/firmware_mnt/verinfo/ver_info.txt |
  78. sed -n 's/^[^:]*modem[^:]*:[[:blank:]]*//p' |
  79. sed 's/.*JO.\(.*\)/\1/g' | cut -d \- -f 1`
  80. if [ ! -z $version ]; then
  81. if [ "$version" \< "3.2" ]; then
  82. qcrild_status=false
  83. fi
  84. fi
  85. elif [ "$modem" = "TH" ]; then
  86. qcrild_status=false
  87. fi
  88. fi
  89. if [ "$qcrild_status" = "true" ]; then
  90. # Make sure both rild, qcrild are not running at same time.
  91. # This is possible with vanilla aosp system image.
  92. stop ril-daemon
  93. stop vendor.ril-daemon
  94. start vendor.qcrild
  95. else
  96. start ril-daemon
  97. start vendor.ril-daemon
  98. fi
  99. start vendor.ipacm-diag
  100. start vendor.ipacm
  101. case "$baseband" in
  102. "svlte2a" | "csfb")
  103. start qmiproxy
  104. ;;
  105. "sglte" | "sglte2" )
  106. if [ "x$sgltecsfb" != "xtrue" ]; then
  107. start qmiproxy
  108. else
  109. setprop persist.vendor.radio.voice.modem.index 0
  110. fi
  111. ;;
  112. esac
  113. multisim=`getprop persist.radio.multisim.config`
  114. if [ "$multisim" = "dsds" ] || [ "$multisim" = "dsda" ]; then
  115. if [ "$qcrild_status" = "true" ]; then
  116. start vendor.qcrild2
  117. else
  118. start vendor.ril-daemon2
  119. fi
  120. elif [ "$multisim" = "tsts" ]; then
  121. if [ "$qcrild_status" = "true" ]; then
  122. start vendor.qcrild2
  123. start vendor.qcrild3
  124. else
  125. start vendor.ril-daemon2
  126. start vendor.ril-daemon3
  127. fi
  128. fi
  129. case "$datamode" in
  130. "tethered")
  131. start vendor.dataqti
  132. start vendor.dataadpl
  133. start vendor.port-bridge
  134. ;;
  135. "concurrent")
  136. start vendor.dataqti
  137. start vendor.dataadpl
  138. start vendor.netmgrd
  139. start vendor.port-bridge
  140. ;;
  141. *)
  142. start vendor.netmgrd
  143. ;;
  144. esac
  145. esac
  146. #
  147. # Allow persistent faking of bms
  148. # User needs to set fake bms charge in persist.vendor.bms.fake_batt_capacity
  149. #
  150. fake_batt_capacity=`getprop persist.vendor.bms.fake_batt_capacity`
  151. case "$fake_batt_capacity" in
  152. "") ;; #Do nothing here
  153. * )
  154. echo "$fake_batt_capacity" > /sys/class/power_supply/battery/capacity
  155. ;;
  156. esac