summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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