summaryrefslogtreecommitdiff
path: root/recipes-core/multitech
diff options
context:
space:
mode:
authorJohn Klug <john.klug@multitech.com>2020-10-06 16:18:43 -0500
committerJohn Klug <john.klug@multitech.com>2020-10-06 16:18:43 -0500
commit19e2143fce260acf66a09f919fb1a84e78c6c34c (patch)
tree284aa0594b2806e2812e6ff3fdad48c196e9a797 /recipes-core/multitech
parent8bfd4d3474d0a33f2493c7b1df3a9ed6aa770fb6 (diff)
downloadmeta-mlinux-19e2143fce260acf66a09f919fb1a84e78c6c34c.tar.gz
meta-mlinux-19e2143fce260acf66a09f919fb1a84e78c6c34c.tar.bz2
meta-mlinux-19e2143fce260acf66a09f919fb1a84e78c6c34c.zip
Quectel thinks a zero IP address is 0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0
Diffstat (limited to 'recipes-core/multitech')
-rwxr-xr-xrecipes-core/multitech/config/chat_wrapper18
-rwxr-xr-xrecipes-core/multitech/config/test.sh15
2 files changed, 31 insertions, 2 deletions
diff --git a/recipes-core/multitech/config/chat_wrapper b/recipes-core/multitech/config/chat_wrapper
index c65dd81..dae3183 100755
--- a/recipes-core/multitech/config/chat_wrapper
+++ b/recipes-core/multitech/config/chat_wrapper
@@ -174,7 +174,7 @@ if [[ $MCONTEXT =~ [Ee][Rr][Rr][Oo][Rr] ]] ; then
RADIOOPTION="${RADIOOPTION2}"
MCONTEXT=$(/usr/bin/radio-cmd ${RADIOOPTION} -t10000 'AT+CGDCONT?' 2>&1 | tr -d '\r')
fi
-
+
if ! [[ $MCONTEXT =~ \+CGDCONT:[[:space:]]+${CONTEXTNUM},\"([^\"]*)\",\"([^\"]*)\",\"([^\"]*)\",([0-9]+),([0-9]+)([^$'\n']*) ]] ; then
logger -s -p daemon.error "No valid context in modem. Is it ready?"
echo "$MCONTEXT" | logger -s -p daemon.error
@@ -209,9 +209,21 @@ if ((${#HCOMP} == 0)) ; then
((HCOMP=0)) # Default
fi
+# For Quectel, address 0 is expressed as "0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0"
+Q0ADDR="0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0"
+ADDRMATCH=1
+if [[ $MADDR != $ADDR ]] ; then
+ ADDRMATCH=0
+ if [[ $MADDR = $Q0ADDR ]] ; then
+ if [[ -z $ADDR ]] || [[ $ADDR = 0 ]] ; then
+ ADDRMATCH=1
+ fi
+ fi
+fi
+
# Only update context on a mismatch between chat and modem.
if [[ $MPDP != $PDP ]] || [[ $MAPN != $APN ]] || \
- [[ $MADDR != $ADDR ]] || ((MDCOMP != DCOMP)) || \
+ (( $ADDRMATCH == 0 )) || ((MDCOMP != DCOMP)) || \
((MHCOMP != HCOMP)) ; then
${LOG} "Modem context $MPDP,$MAPN,$MADDR,$MDCOMP,$MHCOMP does not match chat script"
${LOG} "Chat script context $PDP,$APN,$ADDR,$DCOMP,$HCOMP does not match the modem"
@@ -223,6 +235,8 @@ if [[ $MPDP != $PDP ]] || [[ $MAPN != $APN ]] || \
fi
if [[ $MADDR != $ADDR ]] ; then
${LOG} "ADDR mismatch"
+ ${LOG} "Modem Address $MADDR"
+ ${LOG} "Chat Address $ADDR"
fi
if [[ $MDCOMP != $DCOMP ]] ; then
${LOG} "DCOMP mismatch"
diff --git a/recipes-core/multitech/config/test.sh b/recipes-core/multitech/config/test.sh
new file mode 100755
index 0000000..7cc865d
--- /dev/null
+++ b/recipes-core/multitech/config/test.sh
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+# For Quectel, address 0 is expressed as "0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0"
+Q0ADDR="0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0"
+ADDRMATCH=1
+if [[ $MADDR != $ADDR ]] ; then
+ ADDRMATCH=0
+ if [[ $MADDR = $Q0ADDR ]] ; then
+ if [[ -z $ADDR ]] || [[ $ADDR = 0 ]] ; then
+ ADDRMATCH=1
+ fi
+ fi
+fi
+
+echo Addrmatch $ADDRMATCH