Skip to content

Commit 475b12c

Browse files
authored
Flash in boothold mode to bypass MBIM flash issue with x64 (#59)
1 parent 65e445f commit 475b12c

File tree

1 file changed

+42
-5
lines changed

1 file changed

+42
-5
lines changed

autoflash-7455.sh

Lines changed: 42 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,20 @@ function get_modem_deviceid() {
211211
devpath=$(find /dev -maxdepth 1 -regex '/dev/cdc-wdm[0-9]' -o -regex '/dev/qcqmi[0-9]')
212212
}
213213

214+
function get_modem_bootloader_deviceid() {
215+
deviceid=''
216+
while [ -z $deviceid ]
217+
do
218+
echo 'Waiting for modem in boothold mode...'
219+
sleep 2
220+
deviceid=$(lsusb | grep -i -E '1199:9070|1199:9078|413C:81B5' | awk '{print $6}')
221+
done
222+
echo "Found $deviceid"
223+
}
224+
214225
function reset_modem {
226+
get_modem_deviceid
227+
215228
# Reset Modem
216229
printf "${CYAN}---${NC}\n"
217230
echo 'Reseting modem...'
@@ -327,7 +340,7 @@ function download_modem_firmware() {
327340

328341
# Cleanup old CWE/NVUs
329342
rm -f ./*.cwe ./*.nvu 2>/dev/null
330-
343+
331344
# Unzip SWI9X30C, force overwrite
332345
unzip -o "$SWI9X30C_ZIP"
333346
}
@@ -339,7 +352,9 @@ function flash_modem_firmware() {
339352
printf "${CYAN}---${NC}\n"
340353
echo "Flashing $SWI9X30C_CWE onto Generic Sierra Modem..."
341354
sleep 5
342-
qmi-firmware-update --update -d "$deviceid" "$SWI9X30C_CWE" "$SWI9X30C_NVU"
355+
qmi-firmware-update --reset -d "$deviceid"
356+
get_modem_bootloader_deviceid
357+
qmi-firmware-update --update-download -d "$deviceid" "$SWI9X30C_CWE" "$SWI9X30C_NVU"
343358
rc=$?
344359
if [[ $rc != 0 ]]
345360
then
@@ -355,6 +370,7 @@ function set_modem_settings() {
355370
# Set Generic Sierra Wireless VIDs/PIDs
356371
cat <<EOF > script.txt
357372
send AT
373+
sleep 1
358374
send ATE1
359375
sleep 1
360376
send ATI
@@ -431,8 +447,8 @@ function script_prechecks() {
431447
# Stop modem manager to prevent AT command spam and allow firmware-update
432448
printf "${CYAN}---${NC}\n"
433449
echo 'Stoping modem manager to prevent AT command spam and allow firmware-update, this may take a minute...'
434-
systemctl stop ModemManager
435-
systemctl disable ModemManager
450+
systemctl stop ModemManager &>/dev/null
451+
systemctl disable ModemManager &>/dev/null
436452

437453
printf "${CYAN}---${NC}\n"
438454
echo "Installing all needed prerequisites..."
@@ -458,6 +474,27 @@ function set_swi_setusbcomp() {
458474
echo "Running Modem Mode Switch to usbcomp=$swi_usbcomp"
459475
./swi_setusbcomp.pl --usbcomp=$swi_usbcomp --device="$devpath"
460476
reset_modem
477+
478+
479+
# cat the serial port to monitor output and commands.
480+
sudo cat /dev/"$ttyUSB" 2>&1 | tee -a modem.log &
481+
482+
# Set Generic Sierra Wireless VIDs/PIDs
483+
cat <<EOF > script.txt
484+
send AT
485+
sleep 1
486+
send AT!ENTERCND=\"A710\"
487+
sleep 1
488+
send AT!USBCOMP=$AT_USBCOMP
489+
sleep 1
490+
send AT!RESET
491+
! pkill cat
492+
sleep 1
493+
! pkill minicom
494+
EOF
495+
sudo minicom -b 115200 -D /dev/"$ttyUSB" -S script.txt &>/dev/null
496+
497+
get_modem_deviceid
461498
}
462499

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

514551
script_cleanup
515552

516-
# Done
553+
# Done

0 commit comments

Comments
 (0)