Skip to content

Commit

Permalink
Flash in boothold mode to bypass MBIM flash issue with x64 (#59)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielewood authored Dec 11, 2020
1 parent 65e445f commit 475b12c
Showing 1 changed file with 42 additions and 5 deletions.
47 changes: 42 additions & 5 deletions autoflash-7455.sh
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,20 @@ function get_modem_deviceid() {
devpath=$(find /dev -maxdepth 1 -regex '/dev/cdc-wdm[0-9]' -o -regex '/dev/qcqmi[0-9]')
}

function get_modem_bootloader_deviceid() {
deviceid=''
while [ -z $deviceid ]
do
echo 'Waiting for modem in boothold mode...'
sleep 2
deviceid=$(lsusb | grep -i -E '1199:9070|1199:9078|413C:81B5' | awk '{print $6}')
done
echo "Found $deviceid"
}

function reset_modem {
get_modem_deviceid

# Reset Modem
printf "${CYAN}---${NC}\n"
echo 'Reseting modem...'
Expand Down Expand Up @@ -327,7 +340,7 @@ function download_modem_firmware() {

# Cleanup old CWE/NVUs
rm -f ./*.cwe ./*.nvu 2>/dev/null

# Unzip SWI9X30C, force overwrite
unzip -o "$SWI9X30C_ZIP"
}
Expand All @@ -339,7 +352,9 @@ function flash_modem_firmware() {
printf "${CYAN}---${NC}\n"
echo "Flashing $SWI9X30C_CWE onto Generic Sierra Modem..."
sleep 5
qmi-firmware-update --update -d "$deviceid" "$SWI9X30C_CWE" "$SWI9X30C_NVU"
qmi-firmware-update --reset -d "$deviceid"
get_modem_bootloader_deviceid
qmi-firmware-update --update-download -d "$deviceid" "$SWI9X30C_CWE" "$SWI9X30C_NVU"
rc=$?
if [[ $rc != 0 ]]
then
Expand All @@ -355,6 +370,7 @@ function set_modem_settings() {
# Set Generic Sierra Wireless VIDs/PIDs
cat <<EOF > script.txt
send AT
sleep 1
send ATE1
sleep 1
send ATI
Expand Down Expand Up @@ -431,8 +447,8 @@ function script_prechecks() {
# Stop modem manager to prevent AT command spam and allow firmware-update
printf "${CYAN}---${NC}\n"
echo 'Stoping modem manager to prevent AT command spam and allow firmware-update, this may take a minute...'
systemctl stop ModemManager
systemctl disable ModemManager
systemctl stop ModemManager &>/dev/null
systemctl disable ModemManager &>/dev/null

printf "${CYAN}---${NC}\n"
echo "Installing all needed prerequisites..."
Expand All @@ -458,6 +474,27 @@ function set_swi_setusbcomp() {
echo "Running Modem Mode Switch to usbcomp=$swi_usbcomp"
./swi_setusbcomp.pl --usbcomp=$swi_usbcomp --device="$devpath"
reset_modem


# cat the serial port to monitor output and commands.
sudo cat /dev/"$ttyUSB" 2>&1 | tee -a modem.log &

# Set Generic Sierra Wireless VIDs/PIDs
cat <<EOF > script.txt
send AT
sleep 1
send AT!ENTERCND=\"A710\"
sleep 1
send AT!USBCOMP=$AT_USBCOMP
sleep 1
send AT!RESET
! pkill cat
sleep 1
! pkill minicom
EOF
sudo minicom -b 115200 -D /dev/"$ttyUSB" -S script.txt &>/dev/null

get_modem_deviceid
}

function script_cleanup() {
Expand Down Expand Up @@ -513,4 +550,4 @@ AT_PRIID_REV="$(echo "$AT_PRIID_STRING" | grep -Eo '[0-9]{3}\.[0-9]{3}')"

script_cleanup

# Done
# Done

0 comments on commit 475b12c

Please sign in to comment.