summaryrefslogtreecommitdiff
path: root/recipes-core/mlinux-scripts/mlinux-scripts-1.2/mlinux-switch-apn
diff options
context:
space:
mode:
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