Upgrade 1002-CM (Telit LE910-NAv2) to xx5 firmware

Background

Recently, Verizon notified cellular product manufacturers of a software defect present in Intel chipsets utilized by several cellular modem vendors. Digi uses some of these third party cellular modems in some of our products.

This software defect will make these modems incompatible with Verizon’s future network software release and associated network device requirements. Verizon has advised that all devices must be patched by March 30, 2019 to ensure uninterrupted operation. A failure to implement a timely patch could render your ability to patch an impacted device via remote communication impossible.  More background details can be found here:

https://www.digi.com/verizon-upgrade

Concerning the Digi Accelerated Linux (DAL) devices, the following products are affected:

If you are curious if your DAL device, such as the 6310-DX or 6350-SR, is using a 1002-CM04, you can look for the cellular model name on the Status page of the local web UI, or on the Cellular Details tab in aView.  If the modem model is listed as LE910NA-V2, then your DAL device is using the 1002-CM04 modem and needs to have its firmware updated.

Option A - DAL firmware 19.1+

DAL devices running firmware version 19.1 or higher can use any of the options for upgrading the Telit modem listed in the knowledgebase link below:

Upgrading Modem Firmware

If you elect to manually upgrade the Telit modem through the local web UI of the DAL device, the xx5 firmware file can be downloaded here:

Telit 20.00.xx5 Combined Firmware

Instructions on updating  your DAL device to firmware version 19.1.134.81 can be found below:

Updating Firmware

Option B - Device firmware 18.8.14.124 through 18.10.225.15

Minimum firmware: 18.8.14.124

Create a new custom script under System -> Scheduled tasks -> custom scripts, and enter in the following.   Adjust the Interval to the desired interval you would like this script to run.  The recommended minimal interval is 5-minutes.

#!/bin/sh

# upgrade AT&T and Verizon firmware images of the Telit
# LE910-NAv2 module to the xx5 firmware verison
# AT&T:  20.00.505
# Verizon:  20.00.005

# script only works on firmware version 18.8.14.124+
# set as a scheduled task to run once every 5 minutes


bugout() {
  accns_log w config "custom: $1"
  exit 1
}

success_end() {
  accns_log w config "custom: $1"
  exit
}

modem_index() {
  idx=$(modem idx)
  if ! [ "$idx" ]; then
    sleep 10
    idx=$(modem idx)
    [ "$idx" ] || bugout "modem not present"
  fi
  echo "$idx"
}

modem_must_be_present() {
  # wait up to one minute for the modem to initialize
  i=0
  ret=0
  modem_found=0
  while [ "$i" -lt 2 ]; do
    if [ "$(runt get mm.modem.$(modem_index).modem.model)" = 'LE910-NA V2' ]; then
      modem_found=1
      break
    elif [ "$(modem at '+cgmm')" = 'LE910-NA V2' ]; then
      modem_found=1
      break
    fi
    sleep 30
    i=$((i+1))
  done
  if [ "$modem_found" = 0 ]; then
    ret=1
  fi
  return $ret
}

opt_space_too_small() {
  opt_available_space="$(df -k /opt/ | tail -1 | awk '{print $4}')"
  [ "$opt_available_space" -ge "$file_space_needed" ] && return 1
  return
}

# we have limited space for local firmware images on the filesystem, so cleanup
# any old or un-needed firmware images to make room for the Telit combined image
cleanup_opt_directory() {
  rm -rf /opt/cutom/*
  opt_space_too_small && rm -rf /opt/sierra-wireless*
  opt_space_too_small && rm -rf /opt/*
}

get_telit_firmware_file() {
  [ -f "/opt/telit_custom/$firmware_file_name" ] && [ "$(md5sum /opt/telit_custom/$firmware_file_name | awk '{print $1}')" = "$firmware_file_md5sum" ] && return
  rm -rf "/opt/telit_custom/$firmware_file_name"  # remove potentially half-downloaded file
  opt_space_too_small && cleanup_opt_directory
  opt_space_too_small && return 1
  mkdir -p /opt/telit_custom/
  curl -kLm 300 -o "/opt/telit_custom/$firmware_file_name" "$firmware_image_url"
  [ -f "/opt/telit_custom/$firmware_file_name" ] && [ "$(md5sum /opt/telit_custom/$firmware_file_name | awk '{print $1}')" = "$firmware_file_md5sum" ] && return
  return 1
}

get_telit_fw_update_script() {
  [ -x "/opt/telit_custom/$fw_update_script_name" ] && return
  mkdir -p /opt/telit_custom/
  curl -kLm 300 -o "/opt/telit_custom/$fw_update_script_name" "$fw_update_script_url"
  [ -f "/opt/telit_custom/$fw_update_script_name" ] && chmod +x "/opt/telit_custom/$fw_update_script_name" && return
  return 1
}

base_url='https://downloads.accns.com/telit'
fw_update_script_name='update-telit-firmware_no_md5sum_check.sh'
firmware_file_name='stream_LE910_NA_V2_1G_SKU-20.00.505_LE910_SV_V2_1G_SKU-20.00.005.bin'
firmware_file_md5sum='38b4470f298a7a8ee1698fd21fb8c781'
fw_update_script_url="$base_url/$fw_update_script_name"
firmware_image_url="$base_url/$firmware_file_name"
file_space_needed='48000'

get_telit_fw_update_script || bugout "unable to download modded update-telit-firmware.sh script"
get_telit_firmware_file || bugout "unable to download combined firmware image for LE910-NAv2 module"
modem_must_be_present || bugout "no LE910-NAv2 modem detected"

current_revision="$(runt get mm.modem.$(modem_index).modem.revision)"
[ "$current_revision" ] || current_revision="$(modem at '+cgmr')"
device_path="$(mmcli -m $(modem_index) | grep "System.*device:" | grep -o "'.*'" | tr -d "'")"
imei="$(runt get mm.modem.$(modem_index).modem.imei)"
model="$(runt get mm.modem.$(modem_index).modem.model | sed -e 's/[ :-]/_/g' -e 's/[][]//g')"

if [ "$current_revision" = '20.00.505' ] || [ "$current_revision" = '20.00.005' ]; then
  success_end "LE910-NAv2 module $imei already updated and running firmware $current_revision"
else
  # let's do the update!
  # /opt/telit_custom/update-telit-firmware /sys/devices/platform/soc/soc:internal-regs/d0051000.usb/usb2/2-1 modem/module LE910_NA_V2 /opt/telit_custom/stream_LE910_NA_V2_1G_SKU-20.00.505_LE910_SV_V2_1G_SKU-20.00.005.bin
  if /opt/telit_custom/$fw_update_script_name "$device_path" 'modem/module' "$model" "/opt/telit_custom/$firmware_file_name"; then
    success_end "LE910-NAv2 module $imei successfully updated and to xx5 firmware"
  else
    bugout "firmware update failed for LE910-NAv2 IMEI $imei. Module may be bricked"
  fi
fi