summaryrefslogtreecommitdiff
path: root/recipes-core
diff options
context:
space:
mode:
authorJohn Klug <john.klug@multitech.com>2021-09-03 14:06:24 -0500
committerJohn Klug <john.klug@multitech.com>2021-09-07 10:08:43 -0500
commit2469ebfd5ed1a75e36c8a40fa27633714300a46c (patch)
tree0c4a65a9fd70d381d6eab642381b893df7a95108 /recipes-core
parentcf6753d62d97e18c54096c1963f0234716a6f93b (diff)
downloadmeta-mlinux-2469ebfd5ed1a75e36c8a40fa27633714300a46c.tar.gz
meta-mlinux-2469ebfd5ed1a75e36c8a40fa27633714300a46c.tar.bz2
meta-mlinux-2469ebfd5ed1a75e36c8a40fa27633714300a46c.zip
Fix chat_wrapper for radio-reset notification and bump the config package version
Diffstat (limited to 'recipes-core')
-rwxr-xr-xrecipes-core/multitech/config/chat_wrapper26
-rw-r--r--recipes-core/multitech/config_2.4.bb (renamed from recipes-core/multitech/config_2.3.bb)2
2 files changed, 20 insertions, 8 deletions
diff --git a/recipes-core/multitech/config/chat_wrapper b/recipes-core/multitech/config/chat_wrapper
index 04ea17f..8c2edcc 100755
--- a/recipes-core/multitech/config/chat_wrapper
+++ b/recipes-core/multitech/config/chat_wrapper
@@ -22,11 +22,15 @@
# On entry to this script, file descriptor 0 is the modem.
# For ppp to work, stty must work on file descriptor 0.
# If stty fails, so will ppp.
+. /usr/libexec/ppp/wait_for_reset
NAME=chat_wrapper
CONFIG=/etc/default/${NAME}
CHAT_WRAPPER_RECURSION=/run/chat_wrapper_recursion
RQCMD="/usr/bin/radio-query ${RADIOOPTION}"
+
+: ${LOG:="/usr/bin/logger -t ${NAME} -p daemon.notice"}
+
function finish
{
${LOG} "Launch:" "$@"
@@ -48,7 +52,7 @@ function sanity
if ! log=$(stty 2>&1) || ! [[ $($RQCMD --iccid) =~ $id ]] ; then
${LOG} "Modem has response issues, so see if we can try again"
if ((${#log} > 0)); then
- ${LOG} "stty error: $(log)"
+ ${LOG} "stty error: ${log}"
fi
array=( )
# our parent is PPID, which is pppd. Get the pppd
@@ -80,7 +84,8 @@ function sanity
# we will be sent a SIGHUP. Ignore it (:).
trap : SIGHUP
/usr/sbin/mts-io-sysfs store radio-reset 0
- sleep 5
+ wait_for_reset
+ ${LOG} "Completed wait_for_reset"
count=0
while ((count < 60)) ; do
# Wait for radio-reset to get the modem responding
@@ -89,9 +94,11 @@ function sanity
for f in /run/lock/LCK..modem_at0 /run/lock/LCK..modem_at1 ; do
if [[ -f $f ]] ; then
mypid=$(cat $f)
+ mypid="${mypid#"${mypid%%[![:space:]]*}"}"
+ mypid="${mypid%"${mypid##*[![:space:]]}"}"
${LOG} "PPID is $PPID, pid is $mypid"
# Remove the lock, if it belongs to our parent, pppd
- if [ $mypid = $PPID ] ; then
+ if ((${#mypid} == 0)) || [[ $mypid = $PPID ]] ; then
${LOG} "match $mypid $PPID"
sleep 60
rm -f $f
@@ -127,9 +134,13 @@ WAITREG=0
: ${COPSWAIT:=10}
: ${CFUNWAIT:=10}
-: ${LOG:="/usr/bin/logger -t ${NAME} -p daemon.notice"}
-${LOG} Timeout is $REGWAITTIME, execute "$@"
+${LOG} Timeout is $REGWAITTIME, execute "$@"
+
+# Wait for udev to discover modem has been reset.
+
+wait_for_reset
+
((i=$#))
chatscript="${!i}"
@@ -150,7 +161,7 @@ if ((${#CONTEXT} == 0)) ; then
finish "$@"
# NOTREACHED
fi
-((CONTEXTNUM=${BASH_REMATCH[2]}))
+CONTEXTNUM=${BASH_REMATCH[2]}
# Make sure CFUN=1, in case the last pppd was aborted with it set to 0.
${LOG} "Verify CFUN=1"
@@ -223,10 +234,11 @@ 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"
+Q1ADDR="0.0.0.0"
ADDRMATCH=1
if [[ $MADDR != $ADDR ]] ; then
ADDRMATCH=0
- if [[ $MADDR = $Q0ADDR ]] ; then
+ if [[ $MADDR = $Q0ADDR ]] || [[ $MADDR = $Q1ADDR ]] ; then
if [[ -z $ADDR ]] || [[ $ADDR = 0 ]] ; then
ADDRMATCH=1
fi
diff --git a/recipes-core/multitech/config_2.3.bb b/recipes-core/multitech/config_2.4.bb
index 41187e9..7929115 100644
--- a/recipes-core/multitech/config_2.3.bb
+++ b/recipes-core/multitech/config_2.4.bb
@@ -4,7 +4,7 @@ LICENSE = "MIT"
RDEPENDS_${PN} += "bash"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
PACKAGE_ARCH = "all"
-PR = "r11"
+PR = "r1"
PACKAGES =+ "${PN}-mths"
inherit update-rc.d
inherit allarch