tools/pydfu.py: Display any error strings from device/mboot.

This commit is contained in:
Andrew Leech 2020-03-05 15:00:07 +11:00 committed by Damien George
parent f7130a99b6
commit 38ccb4c643
1 changed files with 7 additions and 0 deletions

View File

@ -161,6 +161,13 @@ def clr_status():
def get_status():
"""Get the status of the last operation."""
stat = __dev.ctrl_transfer(0xA1, __DFU_GETSTATUS, 0, __DFU_INTERFACE, 6, 20000)
# firmware can provide an optional string for any error
if stat[5]:
message = get_string(__dev, stat[5])
if message:
print(message)
return stat[4]