diff --git a/README.md b/README.md index 04fb65a..e930535 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,6 @@ Please PR to this branch instead of main :) Fork development, and PR development to development :) - #### [JUMP TO HOW TO USE](#how-to-use) **Currently:** This will allow you to install or if already installed, update, remove, or modify: - Simple Admin: A simple web interface for managing your Quectel m.2 modem through it's gateway address @@ -147,6 +146,8 @@ Thank You to: [dr-dolomite](https://github.com/dr-dolomite) for some major stat page improvements and this repos first approved external PR! +[tarunVreddy](https://github.com/tarunVreddy) for helping with the SA band aggregation parse + ### Existing projects: Simpleadmin heavily uses the AT Command Parsing Scripts (Basically a copy with new changes and tweaks) of Dairyman's Rooter Source https://github.com/ofmodemsandmen/ROOterSource2203 diff --git a/simpleadmin/scripts/build_modem_status b/simpleadmin/scripts/build_modem_status index 1429771..627ec3e 100644 --- a/simpleadmin/scripts/build_modem_status +++ b/simpleadmin/scripts/build_modem_status @@ -6,16 +6,16 @@ while true; do sleep 2 # Run AT+CGCONTRDP once then proceed to while loop - echo -en "AT+CGCONTRDP\r\n" | microcom -t 1000 /dev/ttyOUT > /tmp/apn.txt + echo -en "AT+CGCONTRDP=1\r\n" | microcom -t 1000 /dev/ttyOUT > /tmp/apn.txt sleep 2 # Run AT+QUIMSLOT? to get the current sim slot echo -en "AT+QUIMSLOT?\r\n" | microcom -t 1000 /dev/ttyOUT > /tmp/simslot.txt sleep 2 - # Send request to modem and wait 5 seconds for data + # Send request to modem and wait 3 seconds for data echo -en "AT+QSPN;+CEREG=2;+CEREG?;+CEREG=0;+C5GREG=2;+C5GREG?;+C5GREG=0;+CSQ;+QENG=\"servingcell\";+QRSRP;+QCAINFO;+QNWPREFCFG=\"mode_pref\";+QTEMP\r\n" \ - | microcom -t 5000 /dev/ttyOUT > /tmp/modemstatus.txt + | microcom -t 3000 /dev/ttyOUT > /tmp/modemstatus.txt if [ $? -eq 0 ] then # Parse diff --git a/simpleadmin/scripts/modemstatus_parse.sh b/simpleadmin/scripts/modemstatus_parse.sh index e6e5581..e323006 100644 --- a/simpleadmin/scripts/modemstatus_parse.sh +++ b/simpleadmin/scripts/modemstatus_parse.sh @@ -36,7 +36,7 @@ nr_bw() { esac } -# Function to get the secondary LTE bands +# Function to get the secondary LTE & NR5G bands get_secondary_bands() { # Extract LTE BANDs from SCC lines SCC_BANDS=$(echo "$OX" | grep '+QCAINFO: "SCC"' | grep -o '"LTE BAND [0-9]\+"' | tr -d '"' | sed '1d') @@ -52,9 +52,6 @@ get_secondary_bands() { # Set SC_BANDS to the non-empty variable or empty if both are empty SC_BANDS="${SCC_BANDS}${NR_BAND}" fi - - # Get the PCI value. For example: 264 based on this +QCAINFO: "PCC",1775,75,"LTE BAND 3",1,264,-103,-13,-71,0 - MAIN_PCI=$(echo "$OX" | grep '+QCAINFO: "PCC"' | grep -o ',[0-9]\{1,5\},' | tr -d ',') } # Get the modem model from /tmp/modemmodel.txt and parse it @@ -516,4 +513,4 @@ MODEZ=$(echo $MODE | tr -d '"') } > /tmp/signal.txt # Pregenerate JSON File -/usrdata/simpleadmin/scripts/tojson.sh /tmp/signal.txt > /tmp/modemstatus.json +/usrdata/simpleadmin/scripts/tojson.sh /tmp/signal.txt > /tmp/modemstatus.json \ No newline at end of file diff --git a/simpleadmin/scripts/tojson.sh b/simpleadmin/scripts/tojson.sh index 80295ad..ba963e3 100644 --- a/simpleadmin/scripts/tojson.sh +++ b/simpleadmin/scripts/tojson.sh @@ -19,6 +19,13 @@ while IFS='=' read -r key value || [[ -n "$key" ]]; do key=$(echo "$key" | awk '{$1=$1};1') value=$(echo "$value" | awk '{$1=$1};1') + # Check if value includes double quotes inside it like: "value,"value"". If there is, remove the inner double quotes. + if [[ "$value" == *\"* ]]; then + value=$(echo "$value" | sed 's/\"//g') + # enclose the value in double quotes again + value="\"$value\"" + fi + # Print key-value pair in JSON format without surrounding double quotes on value printf ' "%s" : %s' "$key" "$value" diff --git a/simpleadmin/www/atcommander.html b/simpleadmin/www/atcommander.html index fd76614..81f64cb 100644 --- a/simpleadmin/www/atcommander.html +++ b/simpleadmin/www/atcommander.html @@ -1,179 +1,303 @@ + - - - - - + + + + RM5xxx AT Commands - - - - - + + + +
-
-
-
-
-
-
-

- AT Command -

-
-
-
-
- -
- -
-
-
-

- -

-
-
-
-
+
+
+
+
+
+
+

AT Command

+
+
+
+
+ +
+ +
-
-
-
-

- ATI Response -

-
-
-
- -
-
-
+
+

+ + + +

+
- +
- +
+
+
+

ATI Response

+
+
+
+ +
+
+
+
+
+
-
-
-
-
-

- Useful Commands -

-
-
-
- -

Here are some useful commands:

-
    -
  • See https://github.com/iamromulan/RM520N-GL#at-commands for more
  • -
  • AT+CFUN=1,1 (reboot)
  • -
  • AT+QMAPWAC? (get current status of auto connect, 0=disabled 1=enabled)
  • -
  • AT+QMAPWAC=1 (enable auto connect internet for ethernet)
  • -
  • AT+QMAPWAC=0 (disable auto connect for ethernet; use when you want internet over usb to work; IPPT must be disabled)
  • -
  • AT+QUIMSLOT? (get active sim slot; 1=Slot 1; 2=Slot 2)
  • -
  • AT+QUIMSLOT=1 (switch to sim slot 1)
  • -
  • AT+QUIMSLOT=2 (switch to sim slot 2)
  • -
  • AT+CGDCONT? (Get active APN profle list 1 through 8)
  • -
  • AT+CGDCONT=1,"IPV4V6","APNHERE" (Sets APN profle 1 to APNHERE using both IPV4 and IPV6)
  • -
  • AT+GSN (Show current IMEI)
  • -
  • AT+EGMR=1,7,"IMEIGOESHERE" (sets/repairs IMEI)
  • -
  • AT+QCAINFO (Show all connected bands/CA info)
  • -
  • AT+QNWPREFCFG="mode_pref" (Check what the current network search mode is set to)
  • -
  • AT+QNWPREFCFG="mode_pref",AUTO (Set network search mode to automatic)
  • -
  • AT+QNWPREFCFG="mode_pref",NR5G:LTE (Set network search mode to 5G/NR and 4G/LTE only)
  • -
  • AT+QNWPREFCFG="mode_pref",NR5G (Set network search mode to 5G/NR only)
  • -
  • AT+QNWPREFCFG="mode_pref",LTE (Set network search mode to 4G/LTE only)
  • -
  • AT+QNWPREFCFG="nr5g_disable_mode" (Check to see if SA or NSA NR5G is disabled)
  • -
  • AT+QNWPREFCFG="nr5g_disable_mode",0 (Enable Both SA and NSA 5G/NR)
  • -
  • AT+QNWPREFCFG="nr5g_disable_mode",1 (Disable SA 5G/NR only)
  • -
  • AT+QNWPREFCFG="nr5g_disable_mode",2 (Disable NSA 5G/NR only)
  • -
  • AT+QNWPREFCFG="nr5g_band" (Get current 5G/NR bandlock settings)
  • -
  • AT+QNWPREFCFG="nr5g_band",1:2:3:4:5:6 (Example: Lock to 5G/NR bands n1,n2,n3,n4,n5, and n6)
  • -
  • AT+QNWPREFCFG="lte_band" (Get current 4G/LTE bandlock settings)
  • -
  • AT+QNWPREFCFG="lte_band",1:2:3:4:5:6 (Example: Lock to 4G/LTE bands 1,2,3,4,5, and 6)
  • -
  • AT+QMAP="WWAN" (Show currently assigned IPv4 and IPv6 from the provider)
  • -
  • AT+QMAP="LANIP" (Show current DHCP range and Gateway address for VLAN0)
  • -
  • AT+QMAP="LANIP",IP_start_range,IP_end_range,Gateway_IP (Set IPv4 Start/End range and Gateway IP of DHCP for VLAN0)
  • -
  • AT+QMAP="DHCPV4DNS","disable" (disable the onboard DNS proxy; recommended for IPPT)
  • -
  • AT+QMAP="MPDN_rule",0,1,0,1,1,"FF:FF:FF:FF:FF:FF" (Turn on IP Passthrough for Ethernet)
  • -
  • AT+QMAP="MPDN_rule",0 (turn off IPPT/clear MPDN rule 0; Remember to run AT+QMAPWAC=1 and reboot after)
  • -
-
-
-
+
+
+
+
+

Useful Commands

+
+
+
+ + +

Here are some useful commands:

+
    +
  • + See https://github.com/iamromulan/RM520N-GL#at-commands for + more +
  • +
  • AT+CFUN=1,1 (reboot)
  • +
  • + AT+QMAPWAC? (get current status of auto connect, 0=disabled + 1=enabled) +
  • +
  • + AT+QMAPWAC=1 (enable auto connect internet for ethernet) +
  • +
  • + AT+QMAPWAC=0 (disable auto connect for ethernet; use when + you want internet over usb to work; IPPT must be disabled) +
  • +
  • + AT+QUIMSLOT? (get active sim slot; 1=Slot 1; 2=Slot 2) +
  • +
  • AT+QUIMSLOT=1 (switch to sim slot 1)
  • +
  • AT+QUIMSLOT=2 (switch to sim slot 2)
  • +
  • AT+CGDCONT? (Get active APN profle list 1 through 8)
  • +
  • + AT+CGDCONT=1,"IPV4V6","APNHERE" (Sets APN profle 1 to + APNHERE using both IPV4 and IPV6) +
  • +
  • AT+GSN (Show current IMEI)
  • +
  • AT+EGMR=1,7,"IMEIGOESHERE" (sets/repairs IMEI)
  • +
  • AT+QCAINFO (Show all connected bands/CA info)
  • +
  • + AT+QNWPREFCFG="mode_pref" (Check what the current network + search mode is set to) +
  • +
  • + AT+QNWPREFCFG="mode_pref",AUTO (Set network search mode to + automatic) +
  • +
  • + AT+QNWPREFCFG="mode_pref",NR5G:LTE (Set network search mode + to 5G/NR and 4G/LTE only) +
  • +
  • + AT+QNWPREFCFG="mode_pref",NR5G (Set network search mode to + 5G/NR only) +
  • +
  • + AT+QNWPREFCFG="mode_pref",LTE (Set network search mode to + 4G/LTE only) +
  • +
  • + AT+QNWPREFCFG="nr5g_disable_mode" (Check to see if SA or NSA + NR5G is disabled) +
  • +
  • + AT+QNWPREFCFG="nr5g_disable_mode",0 (Enable Both SA and NSA + 5G/NR) +
  • +
  • + AT+QNWPREFCFG="nr5g_disable_mode",1 (Disable SA 5G/NR only) +
  • +
  • + AT+QNWPREFCFG="nr5g_disable_mode",2 (Disable NSA 5G/NR only) +
  • +
  • + AT+QNWPREFCFG="nr5g_band" (Get current 5G/NR bandlock + settings) +
  • +
  • + AT+QNWPREFCFG="nr5g_band",1:2:3:4:5:6 (Example: Lock to + 5G/NR bands n1,n2,n3,n4,n5, and n6) +
  • +
  • + AT+QNWPREFCFG="lte_band" (Get current 4G/LTE bandlock + settings) +
  • +
  • + AT+QNWPREFCFG="lte_band",1:2:3:4:5:6 (Example: Lock to + 4G/LTE bands 1,2,3,4,5, and 6) +
  • +
  • + AT+QMAP="WWAN" (Show currently assigned IPv4 and IPv6 from + the provider) +
  • +
  • + AT+QMAP="LANIP" (Show current DHCP range and Gateway address + for VLAN0) +
  • +
  • + AT+QMAP="LANIP",IP_start_range,IP_end_range,Gateway_IP (Set + IPv4 Start/End range and Gateway IP of DHCP for VLAN0) +
  • +
  • + AT+QMAP="DHCPV4DNS","disable" (disable the onboard DNS + proxy; recommended for IPPT) +
  • +
  • + AT+QMAP="MPDN_rule",0,1,0,1,1,"FF:FF:FF:FF:FF:FF" (Turn on + IP Passthrough for Ethernet) +
  • +
  • + AT+QMAP="MPDN_rule",0 (turn off IPPT/clear MPDN rule 0; + Remember to run AT+QMAPWAC=1 and reboot after) +
  • +
+
+
+
- - + diff --git a/simpleadmin/www/cgi-bin/get_atcommand b/simpleadmin/www/cgi-bin/get_atcommand index 150f0e6..a4b13ad 100644 --- a/simpleadmin/www/cgi-bin/get_atcommand +++ b/simpleadmin/www/cgi-bin/get_atcommand @@ -3,24 +3,30 @@ QUERY_STRING=$(echo "${QUERY_STRING}" | sed 's/;//g') function urldecode() { : "${*//+/ }"; echo -e "${_//%/\\x}"; } if [ "${QUERY_STRING}" ]; then - - export IFS="&" - for cmd in ${QUERY_STRING}; do - - if [ "$(echo $cmd | grep '=')" ]; then - key=$(echo $cmd | awk -F '=' '{print $1}') - value=$(echo $cmd | awk -F '=' '{print $2}') - eval $key=$value - fi - - done - + export IFS="&" + for cmd in ${QUERY_STRING}; do + if [ "$(echo $cmd | grep '=')" ]; then + key=$(echo $cmd | awk -F '=' '{print $1}') + value=$(echo $cmd | awk -F '=' '{print $2}') + eval $key=$value + fi + done fi MYATCMD=$(printf '%b\n' "${atcmd//%/\\x}") if [ -n "${MYATCMD}" ]; then - x=$(urldecode "$atcmd") - runcmd=$(echo -en "$x\r\n" | microcom -t 2000 /dev/ttyOUT2) + x=$(urldecode "$atcmd") + # Initialize wait time to 2 seconds + wait_time=2 + while true; do + runcmd=$(echo -en "$x\r\n" | microcom -t $wait_time /dev/ttyOUT2) + # Check if "OK" or "ERROR" is present in the response + if [[ $runcmd =~ "OK" ]] || [[ $runcmd =~ "ERROR" ]]; then + break # Exit the loop if "OK" or "ERROR" is found + fi + # If neither "OK" nor "ERROR" is found, increment wait time by 1 second + ((wait_time++)) + done fi echo "Content-type: text/plain" diff --git a/simpleadmin/www/index.html b/simpleadmin/www/index.html index 90cf979..27d5cfb 100644 --- a/simpleadmin/www/index.html +++ b/simpleadmin/www/index.html @@ -17,7 +17,7 @@