Fixed network reg. problem on ppp_connection_manager

This commit is contained in:
Yasin Kaya 2020-11-26 12:59:34 +00:00
parent 763b8c6802
commit e0c6edf847
4 changed files with 13 additions and 13 deletions

View File

@ -3,4 +3,4 @@
INTERVAL=60 # Seconds, Interval between two connection check of internet INTERVAL=60 # Seconds, Interval between two connection check of internet
DOUBLE_CHECK_WAIT=10 # Seconds, wait time for double check when the connection is down DOUBLE_CHECK_WAIT=10 # Seconds, wait time for double check when the connection is down
PING_TIMEOUT=9 # Seconds, Timeout of ping command PING_TIMEOUT=9 # Seconds, Timeout of ping command
NETWORK_CHECK_TIMEOUT=300 # Count, Check network for ($NETWORK_TIMEOUT x 2 Seconds) NETWORK_CHECK_TIMEOUT=150 # Count, Check network for ($NETWORK_TIMEOUT x 2 Seconds)

View File

@ -52,7 +52,7 @@ else
fi fi
### Modem configuration for RMNET/PPP mode ################################## ### Modem configuration for RMNET/PPP mode ##################################
debug "Checking APN and Modem Mode..." debug "Checking APN and Modem Modem..."
# APN Configuration # APN Configuration
# ----------------- # -----------------
@ -177,5 +177,5 @@ fi
# Check the network is ready # Check the network is ready
# -------------------------- # --------------------------
if check_network -eq 0; then exit 0; else debug "Network registeration is failed!"; exit 1; fi if check_network -eq 0; then exit 0; else debug "Network registeration is failed!. Modem configuration is unsuccesfully ended!"; exit 1; fi

View File

@ -21,7 +21,7 @@ function check_network()
# Check the network is ready # Check the network is ready
debug "Checking the network is ready..." debug "Checking the network is ready..."
for i in {1..$NETWORK_CHECK_TIMEOUT}; do for n in $(seq 1 $NETWORK_CHECK_TIMEOUT); do
NETWORK_OK=0 NETWORK_OK=0
debug "SIM Status: " "-n" # no line break debug "SIM Status: " "-n" # no line break
@ -32,17 +32,18 @@ function check_network()
debug "Network Registeration Status: " "-n" # no line break debug "Network Registeration Status: " "-n" # no line break
NR_TEXT=`atcom AT+CREG? | grep "CREG:"`
echo $NR_TEXT
# For super SIM # For super SIM
atcom AT+CREG? | grep "CREG: 0,5" > /dev/null echo $NR_TEXT | grep "CREG: 0,5" > /dev/null
NETWORK_REG=$? NETWORK_REG=$?
# For native SIM # For native SIM
atcom AT+CREG? | grep "CREG: 0,1" > /dev/null echo $NR_TEXT | grep "CREG: 0,1" > /dev/null
NETWORK_REG_2=$? NETWORK_REG_2=$?
# Combined network registeration status # Combined network registeration status
NETWORK_REG=$((NETWORK_REG+NETWORK_REG_2)) NETWORK_REG=$((NETWORK_REG+NETWORK_REG_2))
if [[ $NETWORK_REG -ne 0 ]] || [[ $NETWORK_REG_2 -ne 0 ]]; then atcom AT+CREG? | grep "CREG:"; fi
if [[ $SIM_READY -eq 0 ]] && [[ $NETWORK_REG -le 1 ]]; then if [[ $SIM_READY -eq 0 ]] && [[ $NETWORK_REG -le 1 ]]; then
debug "Network is ready." debug "Network is ready."
NETWORK_OK=1 NETWORK_OK=1
@ -53,6 +54,6 @@ function check_network()
fi fi
sleep 2 sleep 2
done done
debug "Retwork registeration is failed! Please check SIM card, data plan, antennas etc." debug "Network registeration is failed! Please check SIM card, data plan, antennas etc."
return 1 return 1
} }

View File

@ -12,14 +12,13 @@ else
debug "Log folder is created." debug "Log folder is created."
fi fi
for i in {1..120}; do for i in {1..4}; do
bash configure_modem.sh |& sudo tee -a ./logs/$LOG_FILE_NAME.log bash configure_modem.sh |& sudo tee -a ./logs/$LOG_FILE_NAME.log
MODEM_CONFIG=$? MODEM_CONFIG=${PIPESTATUS[0]} # compatible with only bash
if [[ $MODEM_CONFIG -eq 0 ]]; then if [[ $MODEM_CONFIG -eq 0 ]]; then
break break
fi fi
sleep 1 sleep 1
done done
@ -27,6 +26,6 @@ if [[ $MODEM_CONFIG -eq 0 ]]; then
bash ppp_reconnect.sh |& sudo tee -a ./logs/$LOG_FILE_NAME.log bash ppp_reconnect.sh |& sudo tee -a ./logs/$LOG_FILE_NAME.log
else else
debug "Modem configuration is failed multiple times!" debug "Modem configuration is failed multiple times!"
debug "Checkout other troubleshooting step on docs.sixfab.com." debug "Checkout other troubleshooting steps on docs.sixfab.com."
exit 1 exit 1
fi fi