summaryrefslogtreecommitdiff
path: root/recipes-core/mlinux-scripts
diff options
context:
space:
mode:
authorMykyta Dorokhin <mykyta.dorokhin@globallogic.com>2020-02-19 15:40:44 +0200
committerSerhii Kostiuk <serhii.o.kostiuk@globallogic.com>2020-05-21 10:40:11 +0300
commit19ca401463153a7694a320f543852412d74cbd8f (patch)
treee3720d485786f1f2fc78c909fc2ad2f97829ab8d /recipes-core/mlinux-scripts
parented016261befcdc421ae1ac5d28d21066b56f42f2 (diff)
parent92cbb8fb30c624d3be98d6408d6ff7f03264a2c9 (diff)
downloadmeta-mlinux-19ca401463153a7694a320f543852412d74cbd8f.tar.gz
meta-mlinux-19ca401463153a7694a320f543852412d74cbd8f.tar.bz2
meta-mlinux-19ca401463153a7694a320f543852412d74cbd8f.zip
mpower-dev-thud: merge meta-mlinux:master (92cbb8fb Feb 11 2020) to meta-mlinux:multiarch5-thud (ed01626 Feb 3 2020)
Diffstat (limited to 'recipes-core/mlinux-scripts')
-rwxr-xr-xrecipes-core/mlinux-scripts/mlinux-scripts-1.1/mlinux-set-apn119
-rwxr-xr-xrecipes-core/mlinux-scripts/mlinux-scripts-1.1/mlinux-switch-apn110
-rwxr-xr-xrecipes-core/mlinux-scripts/mlinux-scripts-1.1/mlinux-switch-cell-fw149
-rw-r--r--recipes-core/mlinux-scripts/mlinux-scripts-1.2/mlinux-cell-radio-ready (renamed from recipes-core/mlinux-scripts/mlinux-scripts-1.1/mlinux-cell-radio-ready)0
-rwxr-xr-xrecipes-core/mlinux-scripts/mlinux-scripts-1.2/mlinux-cell-router (renamed from recipes-core/mlinux-scripts/mlinux-scripts-1.1/mlinux-cell-router)0
-rwxr-xr-xrecipes-core/mlinux-scripts/mlinux-scripts-1.2/mlinux-dhcpd (renamed from recipes-core/mlinux-scripts/mlinux-scripts-1.1/mlinux-dhcpd)0
-rwxr-xr-xrecipes-core/mlinux-scripts/mlinux-scripts-1.2/mlinux-firmware-upgrade (renamed from recipes-core/mlinux-scripts/mlinux-scripts-1.1/mlinux-firmware-upgrade)0
-rwxr-xr-xrecipes-core/mlinux-scripts/mlinux-scripts-1.2/mlinux-set-apn117
-rwxr-xr-xrecipes-core/mlinux-scripts/mlinux-scripts-1.2/mlinux-switch-apn161
-rwxr-xr-xrecipes-core/mlinux-scripts/mlinux-scripts-1.2/mlinux-switch-cell-fw211
-rwxr-xr-xrecipes-core/mlinux-scripts/mlinux-scripts-1.2/mlinux-wifi-ap (renamed from recipes-core/mlinux-scripts/mlinux-scripts-1.1/mlinux-wifi-ap)0
-rw-r--r--recipes-core/mlinux-scripts/mlinux-scripts_1.2.bb (renamed from recipes-core/mlinux-scripts/mlinux-scripts_1.1.bb)2
12 files changed, 490 insertions, 379 deletions
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
deleted file mode 100755
index 317a3d7..0000000
--- a/recipes-core/mlinux-scripts/mlinux-scripts-1.1/mlinux-set-apn
+++ /dev/null
@@ -1,119 +0,0 @@
-#!/bin/bash
-
-# Copyright (C) 2014,2017 Multi-Tech Systems
-
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-gsm_chat_file=/etc/ppp/peers/gsm_chat
-lvw2_chat_file=/etc/ppp/peers/lvw2_chat
-leu1_chat_file=/etc/ppp/peers/leu1_chat
-lna3_chat_file=/etc/ppp/peers/lna3_chat_non_vz
-lna3_chat_link=/etc/ppp/peers/lna3_chat
-lna3_readme=/etc/ppp/peers/README.lna3
-lap3_chat_file=/etc/ppp/peers/lap3_chat
-lsp3_chat_file=/etc/ppp/peers/lsp3_chat
-
-function usage {
- echo "Usage: $(basename $0) [--] APN"
- echo "Or $(basename $0) -c to clear the APN line"
- echo "-- is requied if the APN begins with -"
- exit 1
-}
-
-
-((clear=0))
-if (($# < 1)); then
- usage
-fi
-if [[ $1 == "--" ]] ; then
- apn=$2
-elif [[ $1 == "-c" ]] ; then
- clear=1
-elif [[ $1 =~ ^- ]] ; then
- usage
-else
- apn=$1
-fi
-
-radioproduct=$(/usr/sbin/mts-io-sysfs show product-id) # LNA3?
-
-if (($? != 0)) ; then
- echo "Radio is not ready or not found and cannot determine the type"
- exit 1
-fi
-
-# Disable the LNA3 chat script
-if ! [[ -L $lna3_chat_link ]] || [[ $(basename $(readlink -f $lna3_chat_link)) != README.lna3 ]] ; then
- ln -sf "${lna3_readme}" "${lna3_chat_link}"
- echo Disabling LNA3 chat script.
-fi
-
-if ((clear != 1)) ; then
- if sed -r -i "s/^(#comment by mlinux-set-apn )*OK\s+'AT\+CGDCONT=([0-9]*),\"([^\"]*)\",\"[^\"]*\"'$/OK 'AT\+CGDCONT=\2,\"\3\",\"${apn}\"'/" $gsm_chat_file ; then
- echo "Set APN to \"${apn}\" in $gsm_chat_file"
- else
- echo "Failed to set APN in $gsm_chat_file"
- fi
- echo "Not allowed to set APN for $lsp3_chat_file"
- echo "Not allowed to set APN for $lvw2_chat_file"
- # We cannot set the APN for a Verizon modem
- # sed -r -i "s/^(#comment by mlinux-set-apn )*OK\s+'AT\+CGDCONT=3,\"IPV4V6\",\"[^\"]*\"'$/OK 'AT\+CGDCONT=3,\"IPV4V6\",\"${apn}\"'/" $lvw2_chat_file
- if sed -r -i "s/^(#comment by mlinux-set-apn )*OK\s+'AT\+CGDCONT=([0-9]*),\"([^\"]*)\",\"[^\"]*\"'$/OK 'AT\+CGDCONT=\2,\"\3\",\"${apn}\"'/" $leu1_chat_file ; then
- echo "Set APN to \"${apn}\" in $leu1_chat_file"
- else
- echo "Failed to set APN in $leu1_chat_file"
- fi
- if sed -r -i "s/^(#comment by mlinux-set-apn )*OK\s+'AT\+CGDCONT=([0-9]*),\"([^\"]*)\",\"[^\"]*\"'$/OK 'AT\+CGDCONT=\2,\"\3\",\"${apn}\"'/" $lna3_chat_file ; then
- echo "Set APN to \"${apn}\" in $lna3_chat_file"
- else
- echo "Failed to set APN in $lna3_chat_file"
- fi
- if sed -r -i "s/^(#comment by mlinux-set-apn )*OK\s+'AT\+CGDCONT=([0-9]*),\"([^\"]*)\",\"[^\"]*\"'$/OK 'AT\+CGDCONT=\2,\"\3\",\"${apn}\"'/" $lap3_chat_file ; then
- echo "Set APN to \"${apn}\" in $lap3_chat_file"
- else
- echo "Failed to set APN in $lap3_chat_file"
- fi
-else
- if sed -r -i "s/^(OK\s+'AT\+CGDCONT=[0-9]*,\"[^\"]*\",\"[^\"]*\"'$)/#comment by mlinux-set-apn \1/" $gsm_chat_file ; then
- echo "Commented out APN in $gsm_chat_file"
- else
- echo "Failed to comment out APN in $gsm_chat_file"
- fi
- # Not setting APN in lvw2 is OK, since Verizon should not have an APN in a chat file.
- if sed -r -i "s/^(OK\s+'AT\+CGDCONT=[0-9]*,\"[^\"]*\",\"[^\"]*\"'$)/#comment by mlinux-set-apn \1/" $lvw2_chat_file ; then
- echo "Commented out APN in $lvw2_chat_file"
- fi
- if sed -r -i "s/^(OK\s+'AT\+CGDCONT=[0-9]*,\"[^\"]*\",\"[^\"]*\"'$)/#comment by mlinux-set-apn \1/" $leu1_chat_file ; then
- echo "Commented out APN in $leu1_chat_file"
- else
- echo "Failed to comment out APN in $leu1_chat_file"
- fi
- if sed -r -i "s/^(OK\s+'AT\+CGDCONT=[0-9]*,\"[^\"]*\",\"[^\"]*\"'$)/#comment by mlinux-set-apn \1/" $lna3_chat_file ; then
- echo "Commented out APN in $lna3_chat_file"
- else
- echo "Failed to comment out APN in $lna3_chat_file"
- fi
- if sed -r -i "s/^(OK\s+'AT\+CGDCONT=[0-9]*,\"[^\"]*\",\"[^\"]*\"'$)/#comment by mlinux-set-apn \1/" $lap3_chat_file ; then
- echo "Commented out APN in $lap3_chat_file"
- else
- echo "Failed to comment out APN in $lap3_chat_file"
- fi
-fi
-
-exit 0
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
deleted file mode 100755
index 535ab17..0000000
--- a/recipes-core/mlinux-scripts/mlinux-scripts-1.1/mlinux-switch-apn
+++ /dev/null
@@ -1,110 +0,0 @@
-#!/bin/bash
-
-# Copyright (C) 2014, 2017 Multi-Tech Systems
-
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-lna3_chat_file[0]=/etc/ppp/peers/lna3_chat_non_vz
-lna3_chat_file[1]=/etc/ppp/peers/lna3_chat_vz
-lna3_chat_link=/etc/ppp/peers/lna3_chat
-
-function setchat {
- fw=$1
- silent=$2
- if ((${#lna3_chat_file[$fw]} == 0)) ; then
- >&2 echo "Invalid firmware SKU $fw"
- return 1
- else
- canon_src=$(readlink -f "${lna3_chat_file[$fw]}")
- canon_dest=$(readlink -f "${lna3_chat_link}")
- if [[ ${canon_src} != ${canon_dest} ]] ; then
- if ((silent == 0)) ; then
- echo "Setting chat script to ${lna3_chat_file[$fw]}"
- fi
- ln -sf "${lna3_chat_file[$fw]}" "${lna3_chat_link}"
- fi
- fi
-}
-
-function usage {
- >&2 echo "$(basename $0) [firmware image SKU]"
- >&2 echo "The firmware image SKU is optional."
- >&2 echo "If not specified, the image SKU will be determined"
- >&2 echo "from the SIM, and automatically switched with the"
- >&2 echo "APN. Current valid SKU's are 0 and 1"
- >&2 echo "Only LE910-NA1 is supported on product-ids containing string -LNA3-"
- exit 1
-}
-
-function not_ready {
- >&2 echo "Radio is not ready"
- >&2 echo "Try executing mlinux-switch-apn once the radio is ready"
- exit 1
-}
-productid=$(/usr/sbin/mts-io-sysfs show product-id)
-if ! [[ $productid =~ -LNA3- ]] ; then
- echo "Firmware switch is supported only on LE910-NA1 models with product-id containing -LNA3-."
- usage
- exit 1
-fi
-
-if (($# > 0)) ; then
- fw="$1"
- if [[ fw =~ ^[0-9]+$ ]] ; then
- if ((fw < 0)) || ((fw > 1)) ; then
- usage
- fi
- else
- if ((fw > 1)) || ((fw < 0)) ; then
- >&2 echo "Invalid firmware SKU value"
- usage
- fi
- fi
- echo "Switching chat script to firmware SKU $fw"
- setchat $fw 0
- exit $?
-else
- if ! /usr/sbin/mlinux-cell-radio-ready ; then
- >&2 echo Radio is not ready
- >&2 echo Try again later
- exit 1
- fi
- MODEL=$(radio-query --model)
- if (($? != 0)) ; then
- >&2echo "Assume no radio on this device."
- usage
- exit 1
- fi
- if [[ $MODEL != LE910-NA1 ]] ; then
- >&2 echo "Firmware switch is supported only on LE910-NA1 models with product-id containing -LNA3-."
- usage
- 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
- fw=${BASH_REMATCH[2]}
- setchat $fw 0
- else
- fw=$(radio-query --active-firmware)
- if (($? == 0)) ; then
- setchat $fw 0
- fi
- fi
- fi
-fi \ No newline at end of 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
deleted file mode 100755
index 9edacac..0000000
--- a/recipes-core/mlinux-scripts/mlinux-scripts-1.1/mlinux-switch-cell-fw
+++ /dev/null
@@ -1,149 +0,0 @@
-#!/bin/bash
-lna3_chat_link=/etc/ppp/peers/lna3_chat
-lna3_readme=/etc/ppp/peers/README.lna3
-function usage {
->&2 echo "\
-Usage: $0 <image_id> [timeout]
- image_id <0|1|-1> : for dual FW image SKU-s, the id of the image to switch to
- (LTE910-NA1 is the only supported radio for now).
- -1 is based on SIM
- timeout : wait time for radio to come up if set (default : 15 sec)
-
-"
- exit 1
-}
-
-if [ $# -gt 2 ] ; then
- usage
-fi
-
-#
-# Load args (don't wait for the radio by default)
-#
-FWIMAGE=$1
-if ((FWIMAGE < -2)) || ((FWIMAGE > 1)) ; then
- usage
-fi
-if ! >&2 /usr/sbin/mlinux-cell-radio-ready ; then
- [ "$VERBOSE" ] && >&2 echo Radio is not ready
- [ "$VERBOSE" ] && >&2 echo Try again later
- exit 1
-fi
-if ((FWIMAGE == -1)) ; then
- iccid=$(radio-query --iccid)
- if (($? == 0)); then
- if ((${#iccid} == 0)) ; then
- [ "$VERBOSE" ] && >&2 echo "No carrier. Maybe no SIM?"
- [ "$VERBOSE" ] && >&2 echo "ERROR: Cannot decide on firmware"
- exit 1
- fi
- if [[ "$iccid" =~ ^89148.* ]] ; then
- ((FWIMAGE=1))
- else
- ((FWIMAGE=0))
- fi
- else
- >&2 echo "Cannot get ICCID from SIM"
- >&2 echo "Try again later"
- exit 1
- fi
-fi
-
-
-TIMEOUT=${2:-15}
-if [ "$VERBOSE" != "yes" ]; then
- VERBOSE=""
-fi
-
-[ "$VERBOSE" ] && >&2 echo -n "Switching the radio firmware image: "
-
-#
-# Check if the radio present
-#
-MODEL=$(radio-query --model)
-if [ $? -ne 0 ]; then
- [ "$VERBOSE" ] && >&2 echo "Assume no radio on this device."
- exit 0
-fi
-
-#
-# Applicable for LTE910-NA1 with dual FW images only
-#
-productid=$(/usr/sbin/mts-io-sysfs show product-id)
-if [[ $MODEL != LE910-NA1 ]] || ! [[ $productid =~ -LNA3- ]] ; then
- [ "$VERBOSE" ] && >&2 echo "Firmware switch is supported only on LE910-NA1 models with product-id containing -LNA3-."
- exit 0
-fi
-
-#
-# Check if firmware switch is required
-#
-FWACTIVE=$(radio-query --active-firmware)
-if [ $? -ne 0 ] || [ "$FWACTIVE" == "" ]; then
- [ "$VERBOSE" ] && >&2 echo "The $MODEL radio does not support firmware switching."
- exit 0
-fi
-
-if (( FWACTIVE == FWIMAGE )); then
- echo "Cellular radio firmware has already been switched to $FWIMAGE image."
- exit 0
-fi
-
-# Disable the LNA3 chat script in case of failure.
-if ! [[ -L $lna3_chat_link ]] || [[ $(basename $(readlink -f $lna3_chat_link)) != README.lna3 ]] ; then
- ln -sf "${lna3_readme}" "${lna3_chat_link}"
- echo "Chat script is now disabled."
-fi
-
-#
-# Switch the firmware
-#
-RESULT=$(radio-cmd --set-active-firmware "$FWIMAGE")
-if [ $? -ne 0 ]; then
- [ "$VERBOSE" ] && >&2 echo "$RESULT"
- exit 1
-fi
-
-
-#
-# Exit if no TIMEOUT set
-#
-# This is somewhat dangerous in that we assume the radio
-# will switch.
-if ((TIMEOUT == 0)) ; then
- if ((FWIMAGE == 0)) ; then
- [ "$VERBOSE" ] && >&2 echo "Use mlinux-switch-apn to switch the APN when the radio is ready, before dialing"
- exit 0
- fi
-fi
-#
-#
-# Wait for the radio to be ready before continuing
-#
-COUNTER=0
-
-[ "$VERBOSE" ] && echo -n "Wait..."
-
-#
-# Give it some time
-#
-sleep 5
-
-while [ $COUNTER -lt $TIMEOUT ]; do
- MODEL=$(radio-query --model)
- if [ $? -eq 0 ]; then
- echo "Cellular radio firmware has been switched to $FWIMAGE image."
- exit 0
- fi
-
- let COUNTER=COUNTER+1
-
- [ "$VERBOSE" ] && echo -n "."
-
- sleep 1
-done
-
->&2 echo "Cellular radio is not ready."
->&2 echo "When it becomes ready, invoke /usr/sbin/mlinux-switch-apn"
->&2 echo "to set the APN"
-exit 1
diff --git a/recipes-core/mlinux-scripts/mlinux-scripts-1.1/mlinux-cell-radio-ready b/recipes-core/mlinux-scripts/mlinux-scripts-1.2/mlinux-cell-radio-ready
index 42c5cdc..42c5cdc 100644
--- a/recipes-core/mlinux-scripts/mlinux-scripts-1.1/mlinux-cell-radio-ready
+++ b/recipes-core/mlinux-scripts/mlinux-scripts-1.2/mlinux-cell-radio-ready
diff --git a/recipes-core/mlinux-scripts/mlinux-scripts-1.1/mlinux-cell-router b/recipes-core/mlinux-scripts/mlinux-scripts-1.2/mlinux-cell-router
index 1607c32..1607c32 100755
--- a/recipes-core/mlinux-scripts/mlinux-scripts-1.1/mlinux-cell-router
+++ b/recipes-core/mlinux-scripts/mlinux-scripts-1.2/mlinux-cell-router
diff --git a/recipes-core/mlinux-scripts/mlinux-scripts-1.1/mlinux-dhcpd b/recipes-core/mlinux-scripts/mlinux-scripts-1.2/mlinux-dhcpd
index 976b138..976b138 100755
--- a/recipes-core/mlinux-scripts/mlinux-scripts-1.1/mlinux-dhcpd
+++ b/recipes-core/mlinux-scripts/mlinux-scripts-1.2/mlinux-dhcpd
diff --git a/recipes-core/mlinux-scripts/mlinux-scripts-1.1/mlinux-firmware-upgrade b/recipes-core/mlinux-scripts/mlinux-scripts-1.2/mlinux-firmware-upgrade
index a377309..a377309 100755
--- a/recipes-core/mlinux-scripts/mlinux-scripts-1.1/mlinux-firmware-upgrade
+++ b/recipes-core/mlinux-scripts/mlinux-scripts-1.2/mlinux-firmware-upgrade
diff --git a/recipes-core/mlinux-scripts/mlinux-scripts-1.2/mlinux-set-apn b/recipes-core/mlinux-scripts/mlinux-scripts-1.2/mlinux-set-apn
new file mode 100755
index 0000000..ebe8096
--- /dev/null
+++ b/recipes-core/mlinux-scripts/mlinux-scripts-1.2/mlinux-set-apn
@@ -0,0 +1,117 @@
+#!/bin/bash
+
+# Copyright (C) 2014,2017,2019 Multi-Tech Systems
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+noapn_modems=(lvw2 lsp3 cdma)
+
+# Comment out AT+CGDCONT= statement
+remove_apn_sedcmd="s/^(OK[[:space:]]+'|#MT[[:space:]]+)(AT\+CGDCONT=[0-9]+[^\']*)'*/#comment by mlinux-set-apn \2/"
+
+
+
+function usage {
+ echo "Usage: $(basename $0) [--] APN"
+ echo "Or $(basename $0) -c to clear the APN line"
+ echo "-- is requied if the APN begins with -"
+ exit 1
+}
+
+
+((clear=0))
+if (($# < 1)); then
+ usage
+fi
+if [[ $1 == "--" ]] ; then
+ apn=$2
+elif [[ $1 == "-c" ]] ; then
+ clear=1
+elif [[ $1 =~ ^- ]] ; then
+ usage
+else
+ apn=$1
+fi
+
+
+set_apn_sedcmd="s/^(#comment by mlinux-set-apn )*(OK[[:space:]]+'|#MT[[:space:]]+)*AT\+CGDCONT=([0-9]+),\"([^\"]*)\",\"[^\"]*\".*/#MT AT\+CGDCONT=\3,\"\4\",\"${apn}\"/"
+
+
+
+getmodem()
+{
+ radioproduct=$(/usr/sbin/mts-io-sysfs show product-id) # LNA3?
+ if (($? != 0)) ; then
+ echo "Radio is not ready or not found and cannot determine the type"
+ exit 1
+ fi
+ if [[ $radioproduct =~ [^-]*-([^-]*)- ]] ; then
+ echo "${BASH_REMATCH[1]}"
+ fi
+}
+function findItem
+{
+ local s check="$1"
+ shift
+ for s ; do [[ "$s" == "$check" ]] && return 0; done
+ return 1
+}
+
+
+cd /var/config/ppp/peers
+if ((clear != 1)) ; then
+ for f in $noapn ; do
+ echo "Not allowed to set APN for $f"
+ done
+
+ for f in *_chat *_chat_non_vz ; do
+ if [[ -L $f ]] ; then
+ continue
+ fi
+ [[ $f =~ ([^_]*) ]]
+ m=${BASH_REMATCH[1]}
+ if findItem "$m" "${noapn_modems[@]}" ; then
+ continue
+ fi
+
+ if sed -r -i "${set_apn_sedcmd}" ${f}; then
+ echo "Set APN to \"${apn}\" in ${f}"
+ if ! grep -q /usr/libexec/ppp/chat_wrapper ${m} ; then
+ sed -i "s?connect '/usr/sbin/chat?connect '/usr/libexec/ppp/chat_wrapper /usr/sbin/chat?" ${m}
+ fi
+ else
+ echo "Failed to set APN in $f_chat"
+ fi
+ done
+else
+ for f in *_chat *_chat_non_vz ; do
+ if sed -i -r "${remove_apn_sedcmd}" $f ; then
+ echo "Commented out APN in $f"
+ else
+ if [[ $f =~ ([^_]*) ]] ; then
+ m=${BASH_REMATCH[1]}
+ if ! findItem "$m" "${noapn_modems[@]}" ; then
+ echo "Failed to remove APN setting in $f"
+ fi
+ fi
+ fi
+ done
+fi
+
+exit 0
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
new file mode 100755
index 0000000..be056eb
--- /dev/null
+++ b/recipes-core/mlinux-scripts/mlinux-scripts-1.2/mlinux-switch-apn
@@ -0,0 +1,161 @@
+#!/bin/bash
+
+# Copyright (C) 2014, 2017, 2019 Multi-Tech Systems
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+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
+function findItem {
+ local s check="$1"
+ shift
+ for s ; do
+ [[ "$s" == "$check" ]] && return 0;
+ done
+ return 1
+}
+
+function usage {
+ >&2 echo "$(basename $0) [firmware image SKU]"
+ >&2 echo "The firmware image SKU is optional."
+ >&2 echo "If not specified, the image SKU will be determined"
+ >&2 echo "from the SIM, and automatically switched with the"
+ >&2 echo "APN. Current valid SKU's are 0, 1 and 2"
+ exit 1
+}
+
+function setchat {
+ m=$1
+ m=${m,,}
+ fw=$2
+ silent=$3
+ case $fw in
+ 0)
+ ending="non_vz"
+ ;;
+ 1)
+ ending="vz"
+ ;;
+ 2)
+ # Currently L4N1 only
+ ending="non_vz"
+ ;;
+ *)
+ >&2 echo 'Invalid firmware number $fw'
+ usage
+ exit 1
+ ;;
+ esac
+ source="/etc/ppp/peers/${m}_chat_${ending}"
+ target="/etc/ppp/peers/${m}_chat"
+ canon_src=$(readlink -f "${source}")
+ canon_target=$(readlink -f "${target}")
+ if [[ ${canon_src} != ${canon_target} ]] ; then
+ if ((silent == 0)) ; then
+ echo "Setting chat script to ${source}"
+ fi
+ ln -sf "${source}" "${target}"
+ fi
+}
+
+function not_ready {
+ >&2 echo "Radio is not ready"
+ >&2 echo "Try executing mlinux-switch-apn once the radio is ready"
+ exit 1
+}
+
+productid=$(/usr/sbin/mts-io-sysfs show product-id)
+if [[ $productid =~ [^-]*-([^-]*)- ]] ; then
+ mymtmodem="${BASH_REMATCH[1],,}"
+else
+ >&2 echo "Cannot find the modem in the $productid string"
+ exit 1
+fi
+
+if ! findItem "${mymtmodem^^}" "${MTMODEMS[@]}" ; then
+ echo "Firmware switch is not supported on ${mymtmodem}."
+ usage
+ exit 1
+fi
+
+if (($# > 0)) ; then
+ fw="$1"
+ if [[ $fw =~ ^[0-9]+$ ]] ; then
+ echo fw is $fw
+ if ((fw < 0)) || ((fw > 2)) ; then
+ usage
+ fi
+ else
+ >&2 echo "Invalid firmware SKU value"
+ usage
+ fi
+ echo "Switching chat script to firmware SKU $fw"
+ setchat $mymtmodem $fw 0
+ exit $?
+else
+ if ! /usr/sbin/mlinux-cell-radio-ready ; then
+ >&2 echo Radio is not ready
+ >&2 echo Try again later
+ exit 1
+ fi
+ 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
+ fi
+ if ! findItem $MODEL "${MODEMS[@]}" ; then
+ >&2 echo "Firmware switch is supported only on ${MODEMS[@]} and this modem is $MODEL"
+ usage
+ 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
+ fw=${BASH_REMATCH[2]}
+ setchat "${mymtmodem}" $fw 0
+ else
+ fw=$(getactivefirmware)
+ if (($? == 0)) ; then
+ setchat "${mymtmodem}" $fw 0
+ fi
+ fi
+ fi
+fi \ No newline at end of file
diff --git a/recipes-core/mlinux-scripts/mlinux-scripts-1.2/mlinux-switch-cell-fw b/recipes-core/mlinux-scripts/mlinux-scripts-1.2/mlinux-switch-cell-fw
new file mode 100755
index 0000000..4065ccb
--- /dev/null
+++ b/recipes-core/mlinux-scripts/mlinux-scripts-1.2/mlinux-switch-cell-fw
@@ -0,0 +1,211 @@
+#!/bin/bash
+# This script assumes Verizon SIMS ICCID start with 89148 and is firmware 1.
+# This script assumes T-Mobile SIMS start with 8901260 and is firmware 2.
+
+fwsw_modems=(LE910-NA1 LE910C4-NF)
+mt_modems=(lna3 l4n1)
+readme=/etc/ppp/peers/README.fwswitch
+function setactivefirmware
+{
+ radio-cmd ${RADIOOPTION} --set-active-firmware $1
+# RESULT=$(radio-cmd ${RADIOOPTION} 'AT#FWSWITCH='$1',1' 2>&1)
+# if (($? != 0)) ; then
+# >&2 echo "FW Set failed"
+# return 1
+# fi
+# if [[ $RESULT =~ [Ee][Rr][Rr][Oo][Rr] ]] ; then
+# >&2 echo "FW Set failed"
+# return 1
+# fi
+}
+
+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
+function findItem {
+ local s check="$1"
+ shift
+ for s ; do
+ [[ "$s" == "$check" ]] && return 0;
+ done
+ return 1
+}
+
+
+function usage {
+>&2 echo "
+Usage: $0 <image_id> [timeout]
+ image_id <0|1|2|-1> : for dual FW image SKU-s, the id of the image to switch to
+ -1 is based on SIM
+ timeout : wait time for radio to come up if set (default : 15 sec)
+
+"
+ exit 1
+}
+
+if [ $# -gt 2 ] ; then
+ usage
+fi
+
+#
+# Check if the radio present
+#
+MODEL=$(radio-query ${RADIOOPTION} --model 2>&1)
+result=$?
+if [[ $MCONTEXT =~ [Ee][Rr][Rr][Oo][Rr] ]] ; then
+ RADIOOPTION="${RADIOOPTION2}"
+ MODEL=$(radio-query ${RADIOOPTION} --model 2>&1)
+ result=$?
+fi
+
+if ((result != 0)) ; then
+ [ "$VERBOSE" ] && >&2 echo "Assume no radio on this device."
+ exit 0
+fi
+
+#
+# Load args (don't wait for the radio by default)
+#
+FWIMAGE=$1
+if ((FWIMAGE < -2)) || ((FWIMAGE > 2)) ; then
+ usage
+fi
+if ! >&2 /usr/sbin/mlinux-cell-radio-ready ; then
+ [ "$VERBOSE" ] && >&2 echo Radio is not ready
+ [ "$VERBOSE" ] && >&2 echo Try again later
+ exit 1
+fi
+if ((FWIMAGE == -1)) ; then
+ iccid=$(radio-query ${RADIOOPTION} --iccid)
+ if (($? == 0)); then
+ if ((${#iccid} == 0)) ; then
+ [ "$VERBOSE" ] && >&2 echo "No carrier. Maybe no SIM?"
+ [ "$VERBOSE" ] && >&2 echo "ERROR: Cannot decide on firmware"
+ exit 1
+ fi
+ if [[ $iccid =~ ^89148.* ]] ; then
+ # Verizon
+ logger -s -t mlinux-sw-firmware -p daemon.info "Assuming $iccid is a Verizon SIM ICCID using Firmware 1"
+ ((FWIMAGE=1))
+ elif [[ $iccid =~ ^8901260.* ]] ; then
+ # T-Mobile
+ logger -s -t mlinux-sw-firmware -p daemon.info "Assuming $iccid is a T-Mobile SIM ICCID using Firmware 2"
+ ((FWMAGE=2))
+ if [[ $MODEL == LE910-NA1 ]] ; then # Assume LNA3 has no firmware image 2
+ ((FWIMAGE=0))
+ fi
+ else
+ # Everybody else
+ logger -s -t mlinux-sw-firmware -p daemon.info "Assuming $iccid is a possibly AT&T SIM using Firmware 0"
+ ((FWIMAGE=0))
+ fi
+ else
+ >&2 echo "Cannot get ICCID from SIM"
+ >&2 echo "Try again later"
+ exit 1
+ fi
+fi
+
+
+TIMEOUT=${2:-15}
+if [ "$VERBOSE" != "yes" ]; then
+ VERBOSE=""
+fi
+
+[ "$VERBOSE" ] && >&2 echo -n "Switching the radio firmware image: "
+
+#
+# Applicable for LTE910-NA1 and LE910C4-NF with dual FW images only
+#
+if ! findItem "$MODEL" "${fwsw_modems[@]}" ; then
+ echo "Firmware switch is not supported on ${MODEL}."
+ exit 1
+fi
+
+#
+# Check if firmware switch is required
+#
+FWACTIVE=$(getactivefirmware)
+if [ $? -ne 0 ] || [ "$FWACTIVE" == "" ]; then
+ [ "$VERBOSE" ] && >&2 echo "The $MODEL radio does not support firmware switching."
+ exit 0
+fi
+
+if (( FWACTIVE == FWIMAGE )); then
+ echo "Cellular radio firmware has already been switched to $FWIMAGE image."
+ exit 0
+fi
+
+# Disable the LNA3 chat script in case of failure.
+for f in $mt_modems ; do
+ linkf=/etc/ppp/peers/${f}_chat
+ if ! [[ -L ${linkf} ]] || [[ $(basename $(readlink -f ${linkf})) != ${readme} ]] ; then
+ ln -sf "${readme}" "${linkf}"
+ echo "Chat script is now disabled."
+ fi
+done
+
+#
+# Switch the firmware
+#
+RESULT=$(setactivefirmware "$FWIMAGE")
+if [ $? -ne 0 ]; then
+ [ "$VERBOSE" ] && >&2 echo "$RESULT"
+ exit 1
+fi
+
+
+#
+# Exit if no TIMEOUT set
+#
+# This is somewhat dangerous in that we assume the radio
+# will switch.
+if ((TIMEOUT == 0)) ; then
+ if ((FWIMAGE == 0)) ; then
+ [ "$VERBOSE" ] && >&2 echo "Use mlinux-switch-apn to switch the APN when the radio is ready, before dialing"
+ exit 0
+ fi
+fi
+#
+#
+# Wait for the radio to be ready before continuing
+#
+COUNTER=0
+
+[ "$VERBOSE" ] && echo -n "Wait..."
+
+#
+# Give it some time
+#
+sleep 5
+
+while [ $COUNTER -lt $TIMEOUT ]; do
+ MODEL=$(radio-query ${RADIOOPTION} --model)
+ if [ $? -eq 0 ]; then
+ echo "Cellular radio firmware has been switched to $FWIMAGE image."
+ exit 0
+ fi
+
+ let COUNTER=COUNTER+1
+
+ [ "$VERBOSE" ] && echo -n "."
+
+ sleep 1
+done
+
+>&2 echo "Cellular radio is not ready."
+>&2 echo "When it becomes ready, invoke /usr/sbin/mlinux-switch-apn"
+>&2 echo "to set the APN"
+exit 1
diff --git a/recipes-core/mlinux-scripts/mlinux-scripts-1.1/mlinux-wifi-ap b/recipes-core/mlinux-scripts/mlinux-scripts-1.2/mlinux-wifi-ap
index ddbec95..ddbec95 100755
--- a/recipes-core/mlinux-scripts/mlinux-scripts-1.1/mlinux-wifi-ap
+++ b/recipes-core/mlinux-scripts/mlinux-scripts-1.2/mlinux-wifi-ap
diff --git a/recipes-core/mlinux-scripts/mlinux-scripts_1.1.bb b/recipes-core/mlinux-scripts/mlinux-scripts_1.2.bb
index 0dfd740..05c1b84 100644
--- a/recipes-core/mlinux-scripts/mlinux-scripts_1.1.bb
+++ b/recipes-core/mlinux-scripts/mlinux-scripts_1.2.bb
@@ -2,6 +2,6 @@ DESCRIPTION = "Scripts to easily get started with common mLinux use cases"
require mlinux-scripts.inc
-PR = "r5"
+PR = "r1"
S = "${WORKDIR}/mlinux-scripts-${PV}"