summaryrefslogtreecommitdiff
path: root/recipes-core/mlinux-scripts/mlinux-scripts-1.2/mlinux-switch-apn
diff options
context:
space:
mode:
authorJohn Klug <john.klug@multitech.com>2019-08-14 18:05:49 -0500
committerJohn Klug <john.klug@multitech.com>2019-08-14 18:05:49 -0500
commita4704d2afa37fe9d063a33dad83f1398cb924f40 (patch)
treeb6054b6da9cf970d5339ed7208a666aac30c39d6 /recipes-core/mlinux-scripts/mlinux-scripts-1.2/mlinux-switch-apn
parent1eea5c652209d93746318e80a48d178ffd2905ac (diff)
downloadmeta-mlinux-atmel-a4704d2afa37fe9d063a33dad83f1398cb924f40.tar.gz
meta-mlinux-atmel-a4704d2afa37fe9d063a33dad83f1398cb924f40.tar.bz2
meta-mlinux-atmel-a4704d2afa37fe9d063a33dad83f1398cb924f40.zip
Firmware switching for L4N1
Diffstat (limited to 'recipes-core/mlinux-scripts/mlinux-scripts-1.2/mlinux-switch-apn')
-rwxr-xr-xrecipes-core/mlinux-scripts/mlinux-scripts-1.2/mlinux-switch-apn26
1 files changed, 22 insertions, 4 deletions
diff --git a/recipes-core/mlinux-scripts/mlinux-scripts-1.2/mlinux-switch-apn b/recipes-core/mlinux-scripts/mlinux-scripts-1.2/mlinux-switch-apn
index 689b0a4..be056eb 100755
--- a/recipes-core/mlinux-scripts/mlinux-scripts-1.2/mlinux-switch-apn
+++ b/recipes-core/mlinux-scripts/mlinux-scripts-1.2/mlinux-switch-apn
@@ -23,6 +23,18 @@
MTMODEMS=(LNA3 L4N1)
MODEMS=(LE910-NA1 LE910C4-NF)
+function getactivefirmware
+{
+ /usr/bin/radio-query ${RADIOOPTION} --active-firmware
+# FW=$(/usr/bin/radio-cmd ${RADIOOPTION} 'AT#FWSWITCH?' 2>/dev/null)
+# if (($? != 0)) ; then
+# >&2 echo "FW Query failed"
+# return 1
+# fi
+# [[ $FW =~ \#FWSWITCH:[[:space:]]*([^,]*) ]]
+# echo "${BASH_REMATCH[1]}"
+}
+
# See if string is in array of strings
# parm 1 String
# parm 2 Arrays of strings
@@ -118,8 +130,14 @@ else
>&2 echo Try again later
exit 1
fi
- MODEL=$(radio-query --model)
- if (($? != 0)) ; then
+ MODEL=$(radio-query ${RADIOOPTION} --model 2>&1)
+ result=$?
+ if [[ $MODEL =~ [Ee][Rr][Rr][Oo][Rr] ]] ; then
+ RADIOOPTION="${RADIOOPTION2}"
+ MODEL=$(radio-query ${RADIOOPTION} --model 2>&1)
+ result=$?
+ fi
+ if ((result != 0)) ; then
>&2echo "No radio on this device."
usage
exit 1
@@ -130,11 +148,11 @@ else
fi
if fwreply=$(/usr/sbin/mlinux-switch-cell-fw -1); then
- if [[ $fwreply =~ Cellular[[:space:]]+radio[[:space:]]+firmware[[:space:]]+has[[:space:]]+(already[[:space:]]+)been[[:space:]]+switched[[:space:]]+to[[:space:]]+([^[:space:]]*)[[:space:]]+image\. ]] ; then
+ if [[ $fwreply =~ Cellular[[:space:]]+radio[[:space:]]+firmware[[:space:]]+has[[:space:]]+(already[[:space:]]+)*been[[:space:]]+switched[[:space:]]+to[[:space:]]+([^[:space:]]*)[[:space:]]+image\. ]] ; then
fw=${BASH_REMATCH[2]}
setchat "${mymtmodem}" $fw 0
else
- fw=$(radio-query --active-firmware)
+ fw=$(getactivefirmware)
if (($? == 0)) ; then
setchat "${mymtmodem}" $fw 0
fi