Skip to content

Comments

dfu: support "detach"#28

Merged
devanlai merged 1 commit intodevanlai:masterfrom
karlp:dfu-detach
Oct 17, 2020
Merged

dfu: support "detach"#28
devanlai merged 1 commit intodevanlai:masterfrom
karlp:dfu-detach

Conversation

@karlp
Copy link
Contributor

@karlp karlp commented Oct 13, 2020

When in DFU mode, the only way to exit was via a download operation.
"dfu-util -e" to request a detach was simply not supported, so the
bootloader simply remains sitting there
Handle detach via reboot, the usb layer will re-enumerate if it can,
and will boot app/bl based on it's own decisions.

Signed-off-by: Karl Palsson karlp@tweak.net.au

--
this might be me not having used dfu a lot? Is there something I missed?

When in DFU mode, the only way to exit was via a download operation.
"dfu-util -e" to request a detach was simply not supported, so the
bootloader simply remains sitting there
Handle detach via reboot, the usb layer will re-enumerate if it can,
and will boot app/bl based on it's own decisions.

Signed-off-by: Karl Palsson <karlp@tweak.net.au>
@devanlai
Copy link
Owner

Hmm, I guess I never really gave any thought to whether the bootloader should accept a detach command in DFU mode. Appendix A of the spec doesn't show the DFU detach request as a legal request in the dfuIDLE state, so it would fall in the disallowed requests that enter the error state, but it's also not obvious if appendix A is non-normative or not.

I'll have to do some experiments and think about it some more.
Aside from whether or not to allow the detach request, I think the reset could be deferred until after the USB control request is acknowledged using the completion callback, but it's been a while since I looked at the USB stack API.

@karlp
Copy link
Contributor Author

karlp commented Oct 14, 2020

yeah, I know it's meant to be used for going from app -> dfu, but I couldnt' see any other way of exiting dfu back to app.

@devanlai devanlai merged commit a4873e1 into devanlai:master Oct 17, 2020
@devanlai
Copy link
Owner

After doing some testing, it seems innocuous enough to allow the detach command - dfu-util is happy with it anyways. I did end up deferring the reset until after sending the response, otherwise dfu-util thinks the detach request failed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants