-
Notifications
You must be signed in to change notification settings - Fork 19
feat: Add 'image erase' command #72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Does it pass mypy without the type ignore? OK if it doesn't, probably a type inference issue with that helper function.
|
Without the type ignore, mypy is (still) happy: But lint wants to split the line: |
That's good, in a perfect world we would not need any linter directives. Good to remove the type ignore, line split is up to you, but I like it. |
|
I've not used this function and I'm curious if it's 1-indexed like the other image operations? That is, slot 1 maps to "image slot 0", etc? There's an issue discussing it. |
|
Oh, when I said "without the type ignore" above I had actually tried removing the whole "# type: ignore # noqa" including noqa. If I leave just "# noqa" lint still wants to split the line. |
Yeah, I suggest removing the #noqa |
|
But then I would need to split the line too, right? Which is fine to me, I just wanted to make it consistent with the code for the other commands. |
|
But why does "type: ignore" affect the line-splitting and not "noqa". Maybe I don't understand the linter override syntax. |
The directive is what's causing it to overflow. Can cause a "chicken and egg" problem. I hate to ask you to do random maintenance, but the right thing would be to remove all of the unnecessary directives from the file and let black reformat it. |
|
Yes, the slot numbering is hard to understand. But when |
|
I'd be happy to do this random maintenance :) Do you prefer it in a separate commit for the non-erase parts? |
84eb4bb to
6e7502a
Compare
d'oh! Thanks for explaining this mystery :) |
To confirm, uploading to slot 2 gets listed as slot 1, and then erase slot 1 erases slot 1, which is the image slot uploaded to with argument slot 2? There's not much to do other than document it. The idea for smpmgr is to be e reference implementation that's 1:1 with the specification, and it's the specification that caused this problem by using 0 as a default slot, causing the argument to be offset by 1 🙄. There are a few top level convenience abstractions, like "upgrade", where this could get cleaned up. I'll think about it. Probably I need to update the upload docstring. |
Yes. But I don't know if the SMP server is not doing something funny also. |
Signed-off-by: Tormod Volden <debian.tormod@gmail.com>
Signed-off-by: Tormod Volden <debian.tormod@gmail.com>
6e7502a to
a6ac795
Compare
JPHutchins
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
I mean, it looks like the primary slots are not listed on this particular SMP server, so slot 1 is the secondary slot of the first DFU image (and second image because they share secondary slot). I remember from #28 that I had to specify 2 when uploading and then it listed 2 slots, but the SMP server setup may have changed since then. This ought to be tested on a SMP server reference instance and not on the hacked up SMP server that I have at hand :) |
To that end, we're very close to having some native/QEMU SMP servers available for smpclient + smpmgr CI: https://github.com/intercreate/smp-server-fixtures |
Note I copied the
# type: ignore # noqafrom state_read() and state_write(), which seems to prevent a lint suggestion to split the line.