From e57551edc77306fdc6ba570c633298fa412dea0b Mon Sep 17 00:00:00 2001 From: John Klug Date: Wed, 14 Aug 2019 18:04:07 -0500 Subject: Move to L4N1 and L4E1 support, temporarily on gitlab --- recipes-core/multitech/config/chat_wrapper | 21 +++++++++++++++------ recipes-core/multitech/config/chat_wrapper.default | 8 ++++++++ .../multitech/config/ppp/peers/README.fwswitch | 9 +++++---- recipes-core/multitech/config/ppp/peers/gsm | 2 +- recipes-core/multitech/config/ppp/peers/gsm_chat | 6 +++--- recipes-core/multitech/config/ppp/peers/l4e1 | 2 +- recipes-core/multitech/config/ppp/peers/l4e1_chat | 6 +++--- recipes-core/multitech/config/ppp/peers/l4n1 | 2 +- .../multitech/config/ppp/peers/l4n1_chat_non_vz | 8 ++++---- recipes-core/multitech/config/ppp/peers/lap3 | 2 +- recipes-core/multitech/config/ppp/peers/lap3_chat | 6 +++--- recipes-core/multitech/config/ppp/peers/leu1 | 2 +- recipes-core/multitech/config/ppp/peers/leu1_chat | 6 +++--- recipes-core/multitech/config/ppp/peers/lna3 | 2 +- .../multitech/config/ppp/peers/lna3_chat_non_vz | 6 +++--- recipes-core/multitech/config/ppp/peers/lsp3 | 2 +- 16 files changed, 54 insertions(+), 36 deletions(-) diff --git a/recipes-core/multitech/config/chat_wrapper b/recipes-core/multitech/config/chat_wrapper index 9db3188..51f8cc1 100755 --- a/recipes-core/multitech/config/chat_wrapper +++ b/recipes-core/multitech/config/chat_wrapper @@ -66,8 +66,16 @@ ${LOG} "Using Context ${CONTEXTNUM} based on chat script: ${CONTEXT}" # At this point if there is no context number, we can skip everything else. # Get Modem's context settings -MCONTEXT=$(/usr/bin/radio-cmd -t10 'AT+CGDCONT?' 2>&1 | tr -d '\r') -[[ $MCONTEXT =~ \+CGDCONT:[[:space:]]+${CONTEXTNUM},\"([^\"]*)\",\"([^\"]*)\",\"([^\"]*)\",([0-9]+),([0-9]+)([^$'\n']*) ]] +MCONTEXT=$(/usr/bin/radio-cmd ${RADIOOPTION} -t10 'AT+CGDCONT?' 2>&1 | tr -d '\r') +if [[ $MCONTEXT =~ [Ee][Rr][Rr][Oo][Rr] ]] ; then + RADIOOPTION="${RADIOOPTION2}" + MCONTEXT=$(/usr/bin/radio-cmd ${RADIOOPTION} -t10 '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 +fi MPDP="${BASH_REMATCH[1]}" MAPN="${BASH_REMATCH[2]}" @@ -100,21 +108,22 @@ if [[ $MPDP != $PDP ]] || [[ $MAPN != $APN ]] || \ ${LOG} "$MCONTEXT" ${LOG} "Dropping registration with carrier to set context" # Need to deregister - /usr/bin/radio-cmd -t10 'AT+COPS=2' - /usr/bin/radio-cmd -t10 "AT+CGDCONT=${CONTEXTNUM},\"${PDP}\",\"${APN}\",\"${ADDR}\",$DCOMP,${HCOMP}${FULLBOAT}" - /usr/bin/radio-cmd -t10 'AT+COPS=0' + /usr/bin/radio-cmd ${RADIOOPTION} -t10 'AT+COPS=2' + /usr/bin/radio-cmd ${RADIOOPTION} -t10 "AT+CGDCONT=${CONTEXTNUM},\"${PDP}\",\"${APN}\",\"${ADDR}\",$DCOMP,${HCOMP}${FULLBOAT}" + /usr/bin/radio-cmd ${RADIOOPTION} -t10 'AT+COPS=0' ${LOG} "New context is set. Wait up to $REGWAITTIME seconds to register" # Wait for registration uptime=$(cat /proc/uptime) [[ $uptime =~ ^([^\.]*) ]] t0=${BASH_REMATCH[1]} - while ! [[ $(/usr/bin/radio-query --netreg) =~ ^REGISTERED$ ]] ; do + while ! [[ $(/usr/bin/radio-query ${RADIOOPTION} --netreg) =~ ^REGISTERED$ ]] ; do sleep 5 uptime=$(cat /proc/uptime) [[ $uptime =~ ^([^\.]*) ]] t1=${BASH_REMATCH[1]} if ((t1-t0 > REGWAITTIME)) ; then ${LOG} "$((t1-t0)) seconds has expired" + exit 1 fi done uptime=$(cat /proc/uptime) diff --git a/recipes-core/multitech/config/chat_wrapper.default b/recipes-core/multitech/config/chat_wrapper.default index 941c008..a1b4e41 100644 --- a/recipes-core/multitech/config/chat_wrapper.default +++ b/recipes-core/multitech/config/chat_wrapper.default @@ -10,3 +10,11 @@ REGWAITTIME=300 # This is ignored if the context is # already set correctly in the modem. FINALWAIT=5 + +# Option for radio-query, radio-cmd +# Used by /usr/libexec/ppp/chat_wrapper, +# mlinux-switch-apn, mlinux-switch-cell-fw +RADIOOPTION="-d /dev/modem_at1" + +# Device to use if RADIOOPTION fails: +RADIOOPTION2="-d /dev/modem_at0" diff --git a/recipes-core/multitech/config/ppp/peers/README.fwswitch b/recipes-core/multitech/config/ppp/peers/README.fwswitch index 3e6e5fb..47ef5ef 100644 --- a/recipes-core/multitech/config/ppp/peers/README.fwswitch +++ b/recipes-core/multitech/config/ppp/peers/README.fwswitch @@ -1,4 +1,4 @@ -LNA3 firmware/SIM switching instructions +LNA3/L4N1 firmware/SIM switching instructions To automatically set the APN, bring up the system with the desired SIM installed (AT&T or Verizon). @@ -50,11 +50,12 @@ Put the desired SIM into the device. The default APN is "phone" for the LNA3. -Set the APN using: +Set the APN using (does nothing for Sprint or Verizon chat scripts): -kkk # mlinux-set-apn "YOURAPN" +# mlinux-set-apn "YOURAPN" -Do not put a "AT+CGDCONT" in the lna3_chat_vz script. It will cause trouble. +Do not put a "AT+CGDCONT" in the lna3_chat_vz script or +l4n1_chat_vz script. It will cause trouble. To pick a firmware based on the diff --git a/recipes-core/multitech/config/ppp/peers/gsm b/recipes-core/multitech/config/ppp/peers/gsm index c456764..4fc4361 100644 --- a/recipes-core/multitech/config/ppp/peers/gsm +++ b/recipes-core/multitech/config/ppp/peers/gsm @@ -8,4 +8,4 @@ ipcp-restart 10 noauth crtscts novj -connect '/usr/libexec/chat_wrapper /usr/sbin/chat -v -t 90 -f /etc/ppp/peers/gsm_chat' +connect '/usr/libexec/ppp/chat_wrapper /usr/sbin/chat -v -t 90 -f /etc/ppp/peers/gsm_chat' diff --git a/recipes-core/multitech/config/ppp/peers/gsm_chat b/recipes-core/multitech/config/ppp/peers/gsm_chat index a92c938..d952a89 100644 --- a/recipes-core/multitech/config/ppp/peers/gsm_chat +++ b/recipes-core/multitech/config/ppp/peers/gsm_chat @@ -15,18 +15,18 @@ OK 'AT+CSQ' # Note that a comment starting with # #MT AT+CGDCONT= # will be interpretted by -# /usr/libexec/chat_wrapper +# /usr/libexec/ppp/chat_wrapper # as the intended context # setting. Make the context number # (after the =) match the # dialer number context. -# If the context changes, chat_wrapper +# If the context changes, ppp/chat_wrapper # handles disconnecting the modem # from the network during the update, # which is required # by some modem firmware. # The chat script will be executed -# after the chat_wrapper script +# after the ppp/chat_wrapper script # re-registers the modem. # The context will only be set if the # modem settings do not match the diff --git a/recipes-core/multitech/config/ppp/peers/l4e1 b/recipes-core/multitech/config/ppp/peers/l4e1 index 2996e6e..9638398 100644 --- a/recipes-core/multitech/config/ppp/peers/l4e1 +++ b/recipes-core/multitech/config/ppp/peers/l4e1 @@ -8,4 +8,4 @@ ipcp-restart 10 noauth crtscts novj -connect '/usr/libexec/chat_wrapper /usr/sbin/chat -v -t 90 -f /etc/ppp/peers/l4e1_chat' +connect '/usr/libexec/ppp/chat_wrapper /usr/sbin/chat -v -t 90 -f /etc/ppp/peers/l4e1_chat' diff --git a/recipes-core/multitech/config/ppp/peers/l4e1_chat b/recipes-core/multitech/config/ppp/peers/l4e1_chat index 6b6be44..bb95881 100644 --- a/recipes-core/multitech/config/ppp/peers/l4e1_chat +++ b/recipes-core/multitech/config/ppp/peers/l4e1_chat @@ -15,18 +15,18 @@ OK 'AT+CSQ' # Note that a comment starting with # #MT AT+CGDCONT= # will be interpretted by -# /usr/libexec/chat_wrapper +# /usr/libexec/ppp/chat_wrapper # as the intended context # setting. Make the context number # (after the =) match the # dialer number context. -# If the context changes, chat_wrapper +# If the context changes, ppp/chat_wrapper # handles disconnecting the modem # from the network during the update, # which is required # by some modem firmware. # The chat script will be executed -# after the chat_wrapper script +# after the ppp/chat_wrapper script # re-registers the modem. # The context will only be set if the # modem settings do not match the diff --git a/recipes-core/multitech/config/ppp/peers/l4n1 b/recipes-core/multitech/config/ppp/peers/l4n1 index 2e0b501..5c011e0 100644 --- a/recipes-core/multitech/config/ppp/peers/l4n1 +++ b/recipes-core/multitech/config/ppp/peers/l4n1 @@ -8,4 +8,4 @@ ipcp-restart 10 noauth crtscts novj -connect '/usr/libexec/chat_wrapper /usr/sbin/chat -v -t 90 -f /etc/ppp/peers/l4n1_chat' +connect '/usr/libexec/ppp/chat_wrapper /usr/sbin/chat -v -t 90 -f /etc/ppp/peers/l4n1_chat' diff --git a/recipes-core/multitech/config/ppp/peers/l4n1_chat_non_vz b/recipes-core/multitech/config/ppp/peers/l4n1_chat_non_vz index 2839f40..76f3aae 100644 --- a/recipes-core/multitech/config/ppp/peers/l4n1_chat_non_vz +++ b/recipes-core/multitech/config/ppp/peers/l4n1_chat_non_vz @@ -36,18 +36,18 @@ OK 'AT+CSQ' # Note that a comment starting with # #MT AT+CGDCONT= # will be interpretted by -# /usr/libexec/chat_wrapper +# /usr/libexec/ppp/chat_wrapper # as the intended context # setting. Make the context number # (after the =) match the # dialer number context. -# If the context changes, chat_wrapper +# If the context changes, ppp/chat_wrapper # handles disconnecting the modem # from the network during the update, # which is required # by some modem firmware. # The chat script will be executed -# after the chat_wrapper script +# after the ppp/chat_wrapper script # re-registers the modem. # The context will only be set if the # modem settings do not match the @@ -60,7 +60,7 @@ OK 'AT+CSQ' #MT AT+CGDCONT=1,"IP","phone" OK 'AT+CGDCONT?' SAY "Dialing...\n" -OK 'ATD*99***3#' +OK 'ATD*99***1#' SAY "Waiting for CONNECT...\n" TIMEOUT 120 CONNECT '' diff --git a/recipes-core/multitech/config/ppp/peers/lap3 b/recipes-core/multitech/config/ppp/peers/lap3 index 9b56aae..ddd75a5 100644 --- a/recipes-core/multitech/config/ppp/peers/lap3 +++ b/recipes-core/multitech/config/ppp/peers/lap3 @@ -8,4 +8,4 @@ ipcp-restart 10 noauth crtscts novj -connect '/usr/libexec/chat_wrapper /usr/sbin/chat -v -t 90 -f /etc/ppp/peers/lap3_chat' +connect '/usr/libexec/ppp/chat_wrapper /usr/sbin/chat -v -t 90 -f /etc/ppp/peers/lap3_chat' diff --git a/recipes-core/multitech/config/ppp/peers/lap3_chat b/recipes-core/multitech/config/ppp/peers/lap3_chat index 92a5e54..0f7adf6 100644 --- a/recipes-core/multitech/config/ppp/peers/lap3_chat +++ b/recipes-core/multitech/config/ppp/peers/lap3_chat @@ -15,18 +15,18 @@ OK 'AT+CSQ' # Note that a comment starting with # #MT AT+CGDCONT= # will be interpretted by -# /usr/libexec/chat_wrapper +# /usr/libexec/ppp/chat_wrapper # as the intended context # setting. Make the context number # (after the =) match the # dialer number context. -# If the context changes, chat_wrapper +# If the context changes, ppp/chat_wrapper # handles disconnecting the modem # from the network during the update, # which is required # by some modem firmware. # The chat script will be executed -# after the chat_wrapper script +# after the ppp/chat_wrapper script # re-registers the modem. # The context will only be set if the # modem settings do not match the diff --git a/recipes-core/multitech/config/ppp/peers/leu1 b/recipes-core/multitech/config/ppp/peers/leu1 index 2e247b3..5a3baec 100644 --- a/recipes-core/multitech/config/ppp/peers/leu1 +++ b/recipes-core/multitech/config/ppp/peers/leu1 @@ -8,4 +8,4 @@ ipcp-restart 10 noauth crtscts novj -connect '/usr/libexec/chat_wrapper /usr/sbin/chat -v -t 90 -f /etc/ppp/peers/leu1_chat' +connect '/usr/libexec/ppp/chat_wrapper /usr/sbin/chat -v -t 90 -f /etc/ppp/peers/leu1_chat' diff --git a/recipes-core/multitech/config/ppp/peers/leu1_chat b/recipes-core/multitech/config/ppp/peers/leu1_chat index 817f75d..6aef877 100644 --- a/recipes-core/multitech/config/ppp/peers/leu1_chat +++ b/recipes-core/multitech/config/ppp/peers/leu1_chat @@ -15,18 +15,18 @@ OK 'AT+CSQ' # Note that a comment starting with # #MT AT+CGDCONT= # will be interpretted by -# /usr/libexec/chat_wrapper +# /usr/libexec/ppp/chat_wrapper # as the intended context # setting. Make the context number # (after the =) match the # dialer number context. -# If the context changes, chat_wrapper +# If the context changes, ppp/chat_wrapper # handles disconnecting the modem # from the network during the update, # which is required # by some modem firmware. # The chat script will be executed -# after the chat_wrapper script +# after the ppp/chat_wrapper script # re-registers the modem. # The context will only be set if the # modem settings do not match the diff --git a/recipes-core/multitech/config/ppp/peers/lna3 b/recipes-core/multitech/config/ppp/peers/lna3 index 022e4fc..4f6a628 100644 --- a/recipes-core/multitech/config/ppp/peers/lna3 +++ b/recipes-core/multitech/config/ppp/peers/lna3 @@ -8,4 +8,4 @@ ipcp-restart 10 noauth crtscts novj -connect '/usr/libexec/chat_wrapper /usr/sbin/chat -v -t 90 -f /etc/ppp/peers/lna3_chat' +connect '/usr/libexec/ppp/chat_wrapper /usr/sbin/chat -v -t 90 -f /etc/ppp/peers/lna3_chat' diff --git a/recipes-core/multitech/config/ppp/peers/lna3_chat_non_vz b/recipes-core/multitech/config/ppp/peers/lna3_chat_non_vz index 33fd377..a3da519 100644 --- a/recipes-core/multitech/config/ppp/peers/lna3_chat_non_vz +++ b/recipes-core/multitech/config/ppp/peers/lna3_chat_non_vz @@ -36,18 +36,18 @@ OK 'AT+CSQ' # Note that a comment starting with # #MT AT+CGDCONT= # will be interpretted by -# /usr/libexec/chat_wrapper +# /usr/libexec/ppp/chat_wrapper # as the intended context # setting. Make the context number # (after the =) match the # dialer number context. -# If the context changes, chat_wrapper +# If the context changes, ppp/chat_wrapper # handles disconnecting the modem # from the network during the update, # which is required # by some modem firmware. # The chat script will be executed -# after the chat_wrapper script +# after the ppp/chat_wrapper script # re-registers the modem. # The context will only be set if the # modem settings do not match the diff --git a/recipes-core/multitech/config/ppp/peers/lsp3 b/recipes-core/multitech/config/ppp/peers/lsp3 index 4a3da2f..50433ab 100644 --- a/recipes-core/multitech/config/ppp/peers/lsp3 +++ b/recipes-core/multitech/config/ppp/peers/lsp3 @@ -8,4 +8,4 @@ ipcp-restart 10 noauth crtscts novj -connect '/usr/libexec/chat_wrapper /usr/sbin/chat -v -t 90 -f /etc/ppp/peers/lsp3_chat' +connect '/usr/libexec/ppp/chat_wrapper /usr/sbin/chat -v -t 90 -f /etc/ppp/peers/lsp3_chat' -- cgit v1.2.3