From 95af3d1371422fd676a99f8518ce856cf1a75c1d Mon Sep 17 00:00:00 2001 From: Droid Sitebots Date: Thu, 6 May 2021 11:36:36 +0200 Subject: [PATCH] final test & bugfixes --- jetson_ppp_connection_manager.service | 0 ppp_install_jetson.sh | 32 +++++++++++-------- src/jetson_configure_modem.sh | 39 +++-------------------- src/jetson_ppp_connection_manager.service | 9 ++++-- src/jetson_ppp_connection_manager.sh | 10 +----- 5 files changed, 31 insertions(+), 59 deletions(-) delete mode 100644 jetson_ppp_connection_manager.service diff --git a/jetson_ppp_connection_manager.service b/jetson_ppp_connection_manager.service deleted file mode 100644 index e69de29..0000000 diff --git a/ppp_install_jetson.sh b/ppp_install_jetson.sh index 0b18b9e..25620b3 100755 --- a/ppp_install_jetson.sh +++ b/ppp_install_jetson.sh @@ -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;; diff --git a/src/jetson_configure_modem.sh b/src/jetson_configure_modem.sh index 6a67cf0..29ab887 100644 --- a/src/jetson_configure_modem.sh +++ b/src/jetson_configure_modem.sh @@ -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 diff --git a/src/jetson_ppp_connection_manager.service b/src/jetson_ppp_connection_manager.service index 7f657ad..b816344 100644 --- a/src/jetson_ppp_connection_manager.service +++ b/src/jetson_ppp_connection_manager.service @@ -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 diff --git a/src/jetson_ppp_connection_manager.sh b/src/jetson_ppp_connection_manager.sh index 802fc8d..6e4227f 100644 --- a/src/jetson_ppp_connection_manager.sh +++ b/src/jetson_ppp_connection_manager.sh @@ -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 \ No newline at end of file