From d980ad74d67e01027e366c35cd2161ad0214e320 Mon Sep 17 00:00:00 2001 From: John Klug Date: Wed, 14 Aug 2019 18:05:49 -0500 Subject: Firmware switching for L4N1 --- .../mlinux-scripts-1.2/mlinux-switch-apn | 26 ++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) (limited to 'recipes-core/mlinux-scripts/mlinux-scripts-1.2/mlinux-switch-apn') 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 -- cgit v1.2.3