laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-asf4-dfu/+/42175?usp=email )
(
4 is the latest approved patch-set. No files were changed between the latest approved patch-set and the submitted one. )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, 8 insertions(+), 5 deletions(-)
Approvals: Jenkins Builder: Verified laforge: Looks good to me, approved
diff --git a/usb/class/dfu/device/dfudf.c b/usb/class/dfu/device/dfudf.c index 76dcc9b..f931260 100644 --- a/usb/class/dfu/device/dfudf.c +++ b/usb/class/dfu/device/dfudf.c @@ -167,12 +167,15 @@ dfu_state = USB_DFU_STATE_DFU_DNBUSY; // switch to busy state break; case USB_DFU_STATE_DFU_MANIFEST_SYNC: - if (!dfu_manifestation_complete) { + if (dfu_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. Hower this his should not happen (after manifestation + * the state should be dfuMANIFEST-WAIT-RESET if we are not manifest tolerant) + */ + } else { 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 } break; default: