From 475b12c9a1f0f98760715dbadc3f206c0a57fe5d Mon Sep 17 00:00:00 2001 From: Daniel Wood Date: Fri, 11 Dec 2020 13:30:07 -0800 Subject: [PATCH] Flash in boothold mode to bypass MBIM flash issue with x64 (#59) --- autoflash-7455.sh | 47 ++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 42 insertions(+), 5 deletions(-) diff --git a/autoflash-7455.sh b/autoflash-7455.sh index 6c3f496..987135a 100644 --- a/autoflash-7455.sh +++ b/autoflash-7455.sh @@ -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...' @@ -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" } @@ -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 @@ -355,6 +370,7 @@ function set_modem_settings() { # Set Generic Sierra Wireless VIDs/PIDs cat < script.txt send AT +sleep 1 send ATE1 sleep 1 send ATI @@ -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..." @@ -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 < 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() { @@ -513,4 +550,4 @@ AT_PRIID_REV="$(echo "$AT_PRIID_STRING" | grep -Eo '[0-9]{3}\.[0-9]{3}')" script_cleanup -# Done +# Done \ No newline at end of file