From 76fe40bdc7b6c466f946cfdbe3ee3352d09fb587 Mon Sep 17 00:00:00 2001 From: Yasin Kaya Date: Fri, 20 Nov 2020 04:06:57 -0800 Subject: [PATCH] atcom line updated with suitable new atcom version --- install.sh | 16 ++++++++++++++++ install_ppp_jetson.sh | 16 ++++++++++++++++ install_supersim.sh | 17 +++++++++++++++++ src/configure_modem.sh | 8 ++++---- src/functions.sh | 6 +++--- 5 files changed, 56 insertions(+), 7 deletions(-) diff --git a/install.sh b/install.sh index 554ca8b..ab75856 100755 --- a/install.sh +++ b/install.sh @@ -61,6 +61,22 @@ case $shield_hat in *) colored_echo "Wrong Selection, exiting" ${RED}; exit 1; esac +colored_echo "Checking requiremments..." + +colored_echo "Installing python3 if it is required..." +if ! [ -x "$(command -v python3)" ]; then + sudo apt-get install python3 -y >/dev/null +fi + +colored_echo "Installing pip3 if it is required..." +if ! [ -x "$(command -v pip3)" ]; then + sudo apt-get install python3-pip -y >/dev/null +fi + +colored_echo "Installing or upgrading atcom if it is required..." +pip3 install -U atcom && source ~/.profile + + colored_echo "Downloading setup files..." wget --no-check-certificate $SOURCE_PATH/chat-connect -O chat-connect diff --git a/install_ppp_jetson.sh b/install_ppp_jetson.sh index c01e719..32170c4 100755 --- a/install_ppp_jetson.sh +++ b/install_ppp_jetson.sh @@ -62,6 +62,22 @@ case $shield_hat in *) colored_echo "Wrong Selection, exiting" ${RED}; exit 1; esac +colored_echo "Checking requiremments..." + +colored_echo "Installing python3 if it is required..." +if ! [ -x "$(command -v python3)" ]; then + sudo apt-get install python3 -y >/dev/null +fi + +colored_echo "Installing pip3 if it is required..." +if ! [ -x "$(command -v pip3)" ]; then + sudo apt-get install python3-pip -y >/dev/null +fi + +colored_echo "Installing or upgrading atcom if it is required..." +pip3 install -U atcom && source ~/.profile + + colored_echo "Downloading setup files..." wget --no-check-certificate $SOURCE_PATH/chat-connect -O chat-connect if [[ $? -ne 0 ]]; then colored_echo "Download failed" ${RED}; exit 1; fi diff --git a/install_supersim.sh b/install_supersim.sh index 7006210..2f06b56 100644 --- a/install_supersim.sh +++ b/install_supersim.sh @@ -42,6 +42,23 @@ fi colored_echo "Installing PPP for Sixfab Cellular IoT Shield/HAT with Twilio Super SIM" + +colored_echo "Checking requiremments..." + +colored_echo "Installing python3 if it is required..." +if ! [ -x "$(command -v python3)" ]; then + sudo apt-get install python3 -y >/dev/null +fi + +colored_echo "Installing pip3 if it is required..." +if ! [ -x "$(command -v pip3)" ]; then + sudo apt-get install python3-pip -y >/dev/null +fi + +colored_echo "Installing or upgrading atcom if it is required..." +pip3 install -U atcom && source ~/.profile + + colored_echo "Downloading setup files..." wget --no-check-certificate $SOURCE_PATH/chat-connect -O chat-connect if [[ $? -ne 0 ]]; then colored_echo "Download failed" ${RED}; exit 1; fi diff --git a/src/configure_modem.sh b/src/configure_modem.sh index 9867337..3c21282 100644 --- a/src/configure_modem.sh +++ b/src/configure_modem.sh @@ -6,17 +6,17 @@ source functions.sh debug "Checking APN and Modem Mode..." # APN -atcom "AT+CGDCONT?" "OK" "ERROR" 10 | grep super >> /dev/null +atcom "AT+CGDCONT?" | grep super >> /dev/null if [[ $? -ne 0 ]]; then - atcom "AT+CGDCONT=1,\"IP\",\"super\"" "OK" "ERROR" 10 + atcom "AT+CGDCONT=1,\"IP\",\"super\"" debug "APN is updated." fi -atcom "AT#USBCFG?" "OK" "ERROR" 10 | grep 0 >> /dev/null +atcom "AT#USBCFG?" | grep 0 >> /dev/null if [[ $? -ne 0 ]]; then - atcom "AT#USBCFG=0" "OK" "ERROR" 10 + atcom "AT#USBCFG=0" debug "RMNET/PPP mode is activated." debug "Modem restarting..." diff --git a/src/functions.sh b/src/functions.sh index 89a5acd..23d3885 100644 --- a/src/functions.sh +++ b/src/functions.sh @@ -16,15 +16,15 @@ function check_network() NETWORK_OK=0 debug "SIM Status:" - atcom AT+CPIN? OK ERROR 10 | grep "CPIN: READY" + atcom AT+CPIN? | grep "CPIN: READY" SIM_READY=$? debug "Network Registeration Status:" # For super SIM - atcom AT+CREG? OK ERROR 10 | grep "CREG: 0,5" + atcom AT+CREG? | grep "CREG: 0,5" NETWORK_REG=$? # For native SIM - atcom AT+CREG? OK ERROR 10 | grep "CREG: 0,1" + atcom AT+CREG? | grep "CREG: 0,1" NETWORK_REG_2=$? # Combined network registeration status NETWORK_REG=$((NETWORK_REG+NETWORK_REG_2))