summaryrefslogtreecommitdiff
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-12-07 15:20:05 -0600
commit741cc162ccb373c811a257f28d91b86b2e29ae59 (patch)
treeb1a5b794e5d76e7f8f6807961428c518d1e52940
parenta1b2411811443a9c96bc32f87290d3c2dba171e7 (diff)
downloadmeta-mlinux-741cc162ccb373c811a257f28d91b86b2e29ae59.tar.gz
meta-mlinux-741cc162ccb373c811a257f28d91b86b2e29ae59.tar.bz2
meta-mlinux-741cc162ccb373c811a257f28d91b86b2e29ae59.zip
Quectel thinks a zero IP address is 0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0
-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