Skip to content

Commit

Permalink
rkdevflash: don't wait for "Loader" mode after sending spl_loader; …
Browse files Browse the repository at this point in the history
…show the loop counter

- I thought sending the spl_loader blob puts it into "Loader" mode, but...
- ... turns out "Loader" mode is a separate (rockusb, etc) mode.
- So if in Maskrom mode, just send the loader, and _trust_ it can now WriteLba
- still keeps the timeout, for when a loader is not accepted
  • Loading branch information
rpardini authored and igorpecovnik committed Jul 1, 2023
1 parent 079549b commit 1c7f224
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions extensions/rkdevflash.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,10 @@ function wait_for_connected_device_rkdeveloptool() {
rkdeveloptool_is_device_connected="no" rkdeveloptool_device_id="" rkdeveloptool_device_mode=""
list_devices_rkdeveloptool

declare -i counter=0
while [[ "${rkdeveloptool_is_device_connected}" != "yes" ]]; do
display_alert "Waiting for rkdeveloptool device to be connected" "${EXTENSION}" "debug"
counter+=1
display_alert "Waiting for rkdeveloptool device to be connected (loop ${counter})" "${EXTENSION}" "debug"
sleep 1
list_devices_rkdeveloptool
done
Expand All @@ -99,21 +101,17 @@ function flash_image_rkdeveloptool() {
display_alert "rkdevflash: Failed to load SPL RockUSB loader. Timeout? Please reset the Rockchip device (again) into recovery..." "${EXTENSION}" "wrn"
sleep 5
else
display_alert "RockUSB Loader deployed, waiting for Loader mode to kick in" "${EXTENSION}" "cachehit"
sleep 3
display_alert "RockUSB Loader deployed" "${EXTENSION}" "cachehit"
break # break out of the loop. once loaded, the spl_loader does change stuff to Loader mode; only u-boot rockusb/"download mode" does that.
fi
fi
done

wait_for_connected_device_rkdeveloptool
if [[ "${rkdeveloptool_device_mode}" == "Loader" ]]; then
display_alert "Flashing image" "${EXTENSION} :: ${1}" "info"
"${rkdeveloptool_bin_path}" wl 0x0 "${1}"
display_alert "Restarting device after flash" "${EXTENSION}" "ext"
"${rkdeveloptool_bin_path}" rd
else
display_alert "Device is not in Loader mode, cannot flash" "${EXTENSION} :: ${1}" "wrn"
fi
display_alert "Flashing image" "${EXTENSION} :: ${1}" "info"
"${rkdeveloptool_bin_path}" wl 0x0 "${1}"
display_alert "Restarting device after flash" "${EXTENSION}" "ext"
"${rkdeveloptool_bin_path}" rd
}

function list_devices_rkdeveloptool() {
Expand All @@ -126,6 +124,7 @@ function list_devices_rkdeveloptool() {
display_alert "Use an USB-C cable to connect the Rockchip device to this host." "${EXTENSION}" ""
display_alert "Power on the Rockchip device and put it in recovery mode." "${EXTENSION}" ""
display_alert "For example, click & hold Recovery button and then click Reset button once." "${EXTENSION}" ""
display_alert "This is try number ${counter:-"0"}" "${EXTENSION}" ""
else
# Some device is connected, run again and parse the id and mode.
declare rkdeveloptool_ld_output
Expand Down

0 comments on commit 1c7f224

Please sign in to comment.