lynxis lazus has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-asf4-dfu/+/42175?usp=email )
Change subject: dfu: MANIFEST_SYNC: stay in MANIFEST_SYNC when manifestationIntolerant & completed ......................................................................
dfu: MANIFEST_SYNC: stay in MANIFEST_SYNC when manifestationIntolerant & completed
In theory a device which is manifestintolerant and completed the manifestation should not reach MANIFEST_SYNC again.
Remove the state transistion to WAIT-RESET and stay in the current state and wait for the main loop to change the state is safer.
Change-Id: I8c34a18e2336731126a8c01070d86e2547578e3d --- M usb/class/dfu/device/dfudf.c 1 file changed, 6 insertions(+), 4 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-asf4-dfu refs/changes/75/42175/1
diff --git a/usb/class/dfu/device/dfudf.c b/usb/class/dfu/device/dfudf.c index 0f5ec0e..7b13cc3 100644 --- a/usb/class/dfu/device/dfudf.c +++ b/usb/class/dfu/device/dfudf.c @@ -183,10 +183,12 @@ case USB_DFU_STATE_DFU_MANIFEST_SYNC: if (!dfu_manifestation_complete) { dfu_state = USB_DFU_STATE_DFU_MANIFEST; // go to manifest mode - } else if (usb_dfu_func_desc->bmAttributes & USB_DFU_ATTRIBUTES_MANIFEST_TOLERANT) { - dfu_state = USB_DFU_STATE_DFU_IDLE; // go back to idle mode - } else { // this should not happen (after manifestation the state should be dfuMANIFEST-WAIT-RESET if we are not manifest tolerant) - dfu_state = USB_DFU_STATE_DFU_MANIFEST_WAIT_RESET; // wait for reset + } else { + /* manifestation complete */ + if (usb_dfu_func_desc->bmAttributes & USB_DFU_ATTRIBUTES_MANIFEST_TOLERANT) { + dfu_state = USB_DFU_STATE_DFU_IDLE; // go back to idle mode + } + /* otherwise stay in MANIFEST_SYNC */ } break; default: