|
|
|
@ -173,9 +173,16 @@ flash () {
|
|
|
|
|
# shellcheck disable=SC2154
|
|
|
|
|
${preFlash_HOOKS}
|
|
|
|
|
|
|
|
|
|
# If we're -not- doing a manual reset, then try to do it automatically
|
|
|
|
|
if [ -z "${MANUAL_RESET}" ]; then
|
|
|
|
|
reset_device
|
|
|
|
|
sleep 2
|
|
|
|
|
find_bootloader_ports
|
|
|
|
|
# Otherwise, poll for a bootloader port.
|
|
|
|
|
else
|
|
|
|
|
wait_for_bootloader_port
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
check_bootloader_port_and_flash
|
|
|
|
@ -185,6 +192,25 @@ flash () {
|
|
|
|
|
${postFlash_HOOKS}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
wait_for_bootloader_port() {
|
|
|
|
|
declare -i tries
|
|
|
|
|
tries=15
|
|
|
|
|
|
|
|
|
|
while [ "$tries" -gt 0 ] && [ -z "${DEVICE_PORT_BOOTLOADER}" ]; do
|
|
|
|
|
sleep 1
|
|
|
|
|
printf "."
|
|
|
|
|
find_bootloader_ports
|
|
|
|
|
# the variable annotations do appear to be necessary
|
|
|
|
|
# shellcheck disable=SC2004
|
|
|
|
|
tries=$(($tries-1))
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
if [ "$tries" -gt 0 ]; then
|
|
|
|
|
echo "Found."
|
|
|
|
|
else
|
|
|
|
|
echo "Timed out."
|
|
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
check_bootloader_port () {
|
|
|
|
|
if [ -z "${DEVICE_PORT_BOOTLOADER}" ]; then
|
|
|
|
|