final test & bugfixes

This commit is contained in:
Droid Sitebots 2021-05-06 11:36:36 +02:00
parent 0093511768
commit 95af3d1371
5 changed files with 31 additions and 59 deletions

View File

@ -3,14 +3,16 @@
# Created on July 12, 2019 by Saeed Johar (saeedjohar)
# Revised on November 19, 2020 by Yasin Kaya (selengalp)
source src/functions.sh
SIXFAB_PATH="/opt/sixfab"
PPP_PATH="/opt/sixfab/ppp_connection_manager"
# NEEDS TO BE CHANGED TO SIXFAB IF PULLED
REPO_PATH="https://raw.githubusercontent.com/bzt/Sixfab_PPP_Installer"
BRANCH=master
SOURCE_PATH="$REPO_PATH/$BRANCH/src"
SCRIPT_PATH="$REPO_PATH/$BRANCH/src/reconnect_scripts"
RECONNECT_SCRIPT_NAME="ppp_reconnect.sh"
MANAGER_SCRIPT_NAME="jetson_ppp_connection_manager.sh"
SERVICE_NAME="jetson_ppp_connection_manager.service"
@ -139,10 +141,10 @@ fi
while [ 1 ]
do
colored_echo "Do you want to activate auto connect/reconnect service at R.Pi boot up? [Y/n]"
colored_echo "Do you want to activate auto connect service at boot up? [Y/n]"
read auto_reconnect
colored_echo "You chose $auto_reconnect" ${GREEN}
colored_echo "You chose $auto_connect" ${GREEN}
case $auto_reconnect in
[Yy]* ) colored_echo "Copying setup file..."
@ -164,18 +166,20 @@ do
# APN Configuration
sed -i "s/SIM_APN/$carrierapn/" jetson_configure_modem.sh
# Devicename
sed -i "s/DEVICE/$devicename/" jetson_configure_modem.sh
mv functions.sh $PPP_PATH
mv configs.sh $PPP_PATH
mv jetson_configure_modem.sh $PPP_PATH
mv $RECONNECT_SCRIPT_NAME $PPP_PATH
mv $MANAGER_SCRIPT_NAME $PPP_PATH
mv $SERVICE_NAME /etc/systemd/system/
systemctl daemon-reload
systemctl enable $SERVICE_NAME
break;;
mv functions.sh $PPP_PATH
mv configs.sh $PPP_PATH
mv jetson_configure_modem.sh $PPP_PATH
mv $MANAGER_SCRIPT_NAME $PPP_PATH
mv $SERVICE_NAME /etc/systemd/system/
systemctl daemon-reload
systemctl enable $SERVICE_NAME
break;;
[Nn]* ) echo -e "${YELLOW}To connect to internet run ${BLUE}\"sudo pon\"${YELLOW} and to disconnect run ${BLUE}\"sudo poff\" ${SET}"
break;;

View File

@ -5,17 +5,18 @@ source functions.sh
# only for "2: 3G, 4G/LTE Base Shield"
# default arguments
APN=${SIM_APN:-super}
APN=SIM_APN
PORT=/dev/DEVICE
### Modem configuration for RMNET/PPP mode ##################################
debug "Checking APN and Modem Modem..."
# APN Configuration
# -----------------
atcom "AT+CGDCONT?" | grep $APN > /dev/null
atcom -p $PORT "AT+CGDCONT?" | grep $APN > /dev/null
if [[ $? -ne 0 ]]; then
atcom "AT+CGDCONT=1,\"IPV4V6\",\"$APN\""
atcom -p $PORT "AT+CGDCONT=1,\"IPV4V6\",\"$APN\""
debug "APN is updated."
fi
@ -37,38 +38,8 @@ if [[ $IS_QUECTEL -eq 0 ]]; then
if [[ $MODEL_EC25E -eq 0 ]]; then
# EC25 or derives.
atcom "AT+QCFG=\"usbnet\"" | grep 0 > /dev/null
sudo pon
if [[ $? -ne 0 ]]; then
atcom "AT+QCFG=\"usbnet\",0"
debug "PPP mode is activated."
debug "Modem restarting..."
sleep 20
# Check modem is started
route -n | grep wwan0 >> /dev/null
if [[ $? -eq 0 ]]; then
echo
else
# If modem don't reboot automatically, reset manually
atcom "AT+CFUN=1,1" # rebooting modem
sleep 20
fi
# Check modem is started!
for i in {1..120}; do
route -n | grep wwan0 >> /dev/null
if [[ $? -eq 0 ]]; then
echo
debug "Modem is restarted."
break
fi
sleep 1
printf "*"
done
sleep 5 # wait until modem is ready
fi
fi
# Unknown

View File

@ -1,13 +1,18 @@
[Unit]
Description=Jetson PPP Connection Manager
After=network.target
# NEEDS TO BE CHANGED TO YOUR DEVICE
After=dev-sixfab03.device
# OR
# After=network.target
[Service]
Type=simple
ExecStart=/bin/bash jetson_ppp_connection_manager.sh
WorkingDirectory=/opt/sixfab/ppp_connection_manager
StandardOutput=inherit
StandardError=inherit
Restart=always
RemainAfterExit=true
Restart=on-failure
[Install]
WantedBy=multi-user.target

View File

@ -9,12 +9,4 @@ for i in {1..4}; do
break
fi
sleep 1
done
if [[ $MODEM_CONFIG -eq 0 ]]; then
bash ppp_reconnect.sh
else
debug "Modem configuration is failed multiple times!"
debug "Checkout other troubleshooting steps on docs.sixfab.com."
exit 1
fi
done