diff options
author | John Klug <john.klug@multitech.com> | 2019-08-14 18:05:49 -0500 |
---|---|---|
committer | John Klug <john.klug@multitech.com> | 2019-11-11 11:33:19 -0600 |
commit | d980ad74d67e01027e366c35cd2161ad0214e320 (patch) | |
tree | bc5390acbbe6475d7568bdc78a83211d2df087ec /recipes-core/mlinux-scripts/mlinux-scripts-1.2/mlinux-switch-apn | |
parent | e57551edc77306fdc6ba570c633298fa412dea0b (diff) | |
download | meta-mlinux-d980ad74d67e01027e366c35cd2161ad0214e320.tar.gz meta-mlinux-d980ad74d67e01027e366c35cd2161ad0214e320.tar.bz2 meta-mlinux-d980ad74d67e01027e366c35cd2161ad0214e320.zip |
Firmware switching for L4N1
Diffstat (limited to 'recipes-core/mlinux-scripts/mlinux-scripts-1.2/mlinux-switch-apn')
-rwxr-xr-x | recipes-core/mlinux-scripts/mlinux-scripts-1.2/mlinux-switch-apn | 26 |
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 |