DFU improvements#950
Conversation
|
@xmos-jmccarthy could you take a look if it ok ? Maybe additional buffer check is needed if transfer size is different for each alt settings. |
|
Good catch on the manifest bit logic. For the alt setting, can you add an explicit initialized value in |
CFG_TUD_DFU_TRANSFER_BUFFER_SIZE will have to be set to the largest buffer size used by an any given storage type. The recently added checks to prevent out of bounds memory accesses should be sufficient to catch these cases and alert the user if they make a mistake, but if you could add a note of that to the API header that would be great. |
It's done in cf4220a |
hathach
left a comment
There was a problem hiding this comment.
Thank for the PR, using alt interface as partition doesn't seem to be standard for USB DFU but it is popular with dfu-util. Adding Alt to callback is a good option. Though we need to keep an array of attributes and make sure it is multiple ALTs and not multiple instances of DFUs.
In fact it's in the spec: Something useful but out of spec is add
And I think we can limit support to one interface only, multiple DFU interfaces doesn't make sense I think ? When alt intf is switched, do you think we should reset |
Ah right, I totally missed that, thanks for the update.
Yeah, we did limit the dfu to only once interface, since there is not itf in the callback arguments. However, we still need to check the integrity of the Alt interface with consecutive number.
We probably should, I am not entirely sure. Just make sure you have a bit of explanation comment. We could update it later on when needed. |
|
|
|
In fact I missed out that only one functional descriptor is used in DFU class. (Thanks to I think in this case we need a refactor which expose only one time parameters in functional descriptor. Some VA_ARGS trick like |
Indeed, I totally missed this one as well, I just checked the specs, it will be only 1 Functional DFU descriptor at the end after the series of the Alt Interface
we probably needs something similar, but I hope we could get a much simpler version. |
remove CFG_TUD_DFU_ALT_COUNT since there is only one DFU functional descriptor
Yes, it's exactly the case. |
I am doing more rename and update to DFU, will push when complete. |
|
@HiFiPhile it need a bit more work, the get_status should allow application to report error such as incorrect address (such error can be from incorrect download file from host). I will do a bit more update for that |
Ok, errAddress could be useful. |
|
@HiFiPhile @xmos-jmccarthy I have updated with lots of rename (minor) and also tweak behavior as well as flow for DFU callback . I also migrated away from state machine since I found it a bit more complicated (left in code for review only). In sum up
Please let me know what do you think, I am open to all suggestion. |
|
I think it's in good form with a quick look, will do some real world tests. |
|
I like the callback changes, this is much nicer to look at. I will update my port and run some tests on hardware. I should be able to do that next week at the latest. |
|
I will also integrate this to tinyuf2 project as well to see if there is any issue with existing API https://github.com/adafruit/tinyuf2 |
|
I've done some tests on LPC4337, so far so good. ps: @hathach Do you use any auto format script ? Since my format is completely different and I always miss something with manual format... |
|
@HiFiPhile I only use auto format with portion of text selection where I want to. Normally I will just manual type it. Auto format is not enabled, since I couldn't figure out how to get it auto align |
hathach
left a comment
There was a problem hiding this comment.
Thank you @HiFiPhile for stating this PRs, and @xmos-jmccarthy for helping with the review. This PR is now ready, and I am glad that you are both happy with the changes. There is quite a bit of rename though, but it is to make it more like other class. If there is nothing else that need changes, I wink we could merge this. Any issues can be fixed as follow up PRs.
xmos-jmccarthy
left a comment
There was a problem hiding this comment.
Everything looks good.
|
It's good for me :) |

Describe the PR