modemInit.sh 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #!/bin/sh
  2. execPath=`readlink -f "$0"`
  3. dirPath="${execPath%/*}"
  4. modemFunc="${dirPath}/modemFunc.sh"
  5. [ -f "${modemFunc}" ] && . "${modemFunc}" || exit 1
  6. PORT="2"
  7. TAG="${execPath##*/}"
  8. SYSLOG=`Config Syslog "0"`
  9. LOG=`Config InitLOG "/dev/null"`
  10. MaxNum=`Config MaxNum "120"`
  11. Notice=`Config NoticeFile`
  12. NoticePID=`Config NoticePID "/tmp/run/modemNotice.pid"`
  13. Log "START"
  14. [ -n "${Notice}" ] && {
  15. NoticeFile="${dirPath}/${Notice}"
  16. [ -f "$NoticeFile" ] && {
  17. DeadPID "$NoticePID" && {
  18. /bin/sh "$NoticeFile" >/dev/null 2>&1 &
  19. Log "Notice PID: $!"
  20. }
  21. }
  22. }
  23. for i in $(seq 1 $MaxNum); do
  24. n=$(($i/2))
  25. m=$(($i%2))
  26. [ $m -eq 1 ] && {
  27. [ $n -eq 0 ] && {
  28. Driver
  29. Cell `Config CellMode` `Config BandNR5G` `Config BandLTE`
  30. COPS || continue
  31. }
  32. Modem `Config SIMCard 1` "$n"
  33. WaitSIM
  34. }
  35. [ `Config StaticPCI 0` -eq "0" ] && LockNR5G "0"
  36. [ `Config StaticPCI 0` -gt "0" ] && LockNR5G `Config LockPCINR5G`
  37. MPDN && break || continue
  38. done
  39. Log "FINISH"
  40. exit 0