From 5615160d7debfbf3aad5ba2b82a57ef20082fee2 Mon Sep 17 00:00:00 2001 From: John Klug Date: Mon, 28 Aug 2017 17:05:39 -0500 Subject: Since Telit LE910-NA1 can have a single firmware, key off of product-id --- recipes-core/mlinux-scripts/mlinux-scripts-1.1/mlinux-set-apn | 9 ++++++++- .../mlinux-scripts/mlinux-scripts-1.1/mlinux-switch-apn | 11 ++++++----- .../mlinux-scripts/mlinux-scripts-1.1/mlinux-switch-cell-fw | 5 +++-- 3 files changed, 17 insertions(+), 8 deletions(-) (limited to 'recipes-core/mlinux-scripts') diff --git a/recipes-core/mlinux-scripts/mlinux-scripts-1.1/mlinux-set-apn b/recipes-core/mlinux-scripts/mlinux-scripts-1.1/mlinux-set-apn index a588587..8e4d3d2 100755 --- a/recipes-core/mlinux-scripts/mlinux-scripts-1.1/mlinux-set-apn +++ b/recipes-core/mlinux-scripts/mlinux-scripts-1.1/mlinux-set-apn @@ -46,13 +46,17 @@ lvw2_chat_file=/etc/ppp/peers/lvw2_chat leu1_chat_file=/etc/ppp/peers/leu1_chat lna3_chat_file=/etc/ppp/peers/lna3_chat +radioproduct=$(/usr/sbin/mts-io-sysfs show product-id) # LNA3? + model=$(radio-query --model 2>/dev/null) if (($? != 0)) ; then echo "Radio is not ready or not found and cannot determine the type" exit 1 fi -if [[ $model == "LE910-NA1" ]] ; then +# Only support LNA3 + +if [[ $model == LE910-NA1 ]] && [[ $radioproduct =~ -LNA3- ]] ; then if ((clear != 1)) ; then if sed -r -i "s/^(#comment by mlinux-set-apn )*OK\s+'AT\+CGDCONT=3,\"([^\"]*)\",\"[^\"]*\"'$/OK 'AT\+CGDCONT=3,\"\2\",\"${apn}\"'/" $lna3_chat_file ; then echo "Set APN to \"${apn}\" in $lna3_chat_file" @@ -78,6 +82,9 @@ if [[ $model == "LE910-NA1" ]] ; then fi fi exit 0 +else + echo "Radio in product-id must be -LNA3- for LE910-NA1" + echo "Radio model is \"$model\", product-id is \"$radioproduct\"" fi diff --git a/recipes-core/mlinux-scripts/mlinux-scripts-1.1/mlinux-switch-apn b/recipes-core/mlinux-scripts/mlinux-scripts-1.1/mlinux-switch-apn index 8a70036..f6b1894 100755 --- a/recipes-core/mlinux-scripts/mlinux-scripts-1.1/mlinux-switch-apn +++ b/recipes-core/mlinux-scripts/mlinux-scripts-1.1/mlinux-switch-apn @@ -26,7 +26,7 @@ function usage { echo "The firmware image SKU is optional." echo "If not specified, the image SKU is queried (recommended)." echo "Current valid SKU's are 0 and 1" - echo "Only LE910-NA1 is supported" + echo "Only LE910-NA1 is supported on product-ids containing string -LNA3-" exit 1 } @@ -44,12 +44,13 @@ if (($# > 0)) ; then fi fi else - + radioproduct=$(/usr/sbin/mts-io-sysfs show product-id) # Hopefully LNA3 ((query=0)) lna3_chat_file=/etc/ppp/peers/lna3_chat model=$(radio-query --model 2>/dev/null) - if [[ $model != "LE910-NA1" ]] ; then - # Nothing to do + if [[ $model != "LE910-NA1" ]] || ! [[ $radioproduct =~ "-LNA3-" ]] ; then + [[ $VERBOSE ]] && echo "Firmware switch is supported only on LE910-NA1 models with product-id containing -LNA3-." + # Nothing to do exit 0 fi fw=$(radio-query --active-firmware 2>/dev/null) || ((fw=-1)) @@ -67,7 +68,7 @@ else # Set non-Verizon APN in chat file # if sed -r -i "s/^(#comment by mlinux-set-apn )* OK\s+'AT\+CGDCONT=3,\"IPV4V6\",\"[^\"]*\"'$/OK 'AT\+CGDCONT=3,\"IPV4V6\",\"${apn}\"'/" $lna3_chat_file ; then # (OK\s+'AT\+CGDCONT=3,\"IPV4V6\",\"(^\"]*\"'$) - if sed -r -i "s/^(#comment by mlinux-set-apn )*(OK\s+'AT\+CGDCONT=3,\"IPV4V6\",\"[^\"]*\"'$)/\2/" $lna3_chat_file ; then + if sed -r -i "s/^(#comment by mlinux-set-apn )*(OK\s+'AT\+CGDCONT=3,\"[^\"]*\",\"[^\"]*\"'$)/\2/" $lna3_chat_file ; then echo "Set APN in $lna3_chat_file" else echo "Failed to set APN in $lna3_chat_file" diff --git a/recipes-core/mlinux-scripts/mlinux-scripts-1.1/mlinux-switch-cell-fw b/recipes-core/mlinux-scripts/mlinux-scripts-1.1/mlinux-switch-cell-fw index a101e56..ee58d66 100755 --- a/recipes-core/mlinux-scripts/mlinux-scripts-1.1/mlinux-switch-cell-fw +++ b/recipes-core/mlinux-scripts/mlinux-scripts-1.1/mlinux-switch-cell-fw @@ -34,8 +34,9 @@ fi # # Applicable for LTE910-NA1 with dual FW images only # -if [ "$MODEL" != "LE910-NA1" ]; then - [ "$VERBOSE" ] && echo "Firmware switch is supported only on LE910-NA1 models." +productid=$(/usr/sbin/mts-io-sysfs show product-id) +if [[ $MODEL != LE910-NA1 ]] || ! [[ $productid =~ -LNA3- ]] ; then + [ "$VERBOSE" ] && echo "Firmware switch is supported only on LE910-NA1 models with product-id containing -LNA3-." exit 0 fi -- cgit v1.2.3