Skip to content
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

Feature request: method to read image list (or at least active image hash) #66

Closed
rstieger opened this issue Mar 15, 2024 · 3 comments
Closed
Assignees
Labels
enhancement New feature or request

Comments

@rstieger
Copy link

I would like a method in the FirmwareUpdateManager to get the current image list (or at least the hashes).

For devices that are not bonded but use random MAC addresses, the testAndConfirm mode won't work (because the MAC address changes, it can't automatically reconnect). Currently I can run testOnly, verify the firmware version string (from DIS), and then run confirmOnly. However, it would be more reliable if I could verify the image hash instead of the version string.

I understand that allowing firmware updates without bonding is not best practice, but there are some use cases where it is necessary. I can also imagine other use cases where being able to read the image list - to show what images are already on a device, before starting an update - would be beneficial.

@savvn001
Copy link

Would like this too. Implementation of the mcumgr image list feature.

@NickKibish NickKibish self-assigned this Mar 17, 2024
@NickKibish NickKibish added the enhancement New feature or request label Mar 17, 2024
NickKibish added a commit that referenced this issue Mar 17, 2024
- updated iOSMcuManagerLibrary 1.4.3 -> 1.6

WIP
NickKibish added a commit that referenced this issue Mar 18, 2024
Updated proto file:
- Created new 'ProtoImage' model with hash, data, slot and image fields
- Added 'hash' to single image update arguments.

Updated Swift code:
- added extension for ImageManager.Image struct to create it with Proto model
- fixed code after upgrade to v1.6

Flutter and Android pard are still broken
NickKibish added a commit that referenced this issue Mar 19, 2024
Use 'Image' class instead of Uint8List and Tuple

Lib is still broken. Need to know what to do with 'hash'
NickKibish added a commit that referenced this issue Mar 24, 2024
- Hash and Slot are optional now
- If hash is not provided 'McuMgrImage(data: data).hash' will be used
- If slot is not provided default value (1) will be used

Android is not implemented yet
NickKibish added a commit that referenced this issue Mar 26, 2024
NickKibish added a commit that referenced this issue Mar 27, 2024
NickKibish added a commit that referenced this issue Mar 28, 2024
WIP: Android build is broken
NickKibish added a commit that referenced this issue Mar 28, 2024
NickKibish added a commit that referenced this issue Mar 29, 2024
Tested and ready to merge.
@NickKibish
Copy link
Collaborator

Hi, @rstieger

Great news! I implemented this feature in 0.4.0 🎉

Example:

final images = await _firmwareUpdateManager!.readImageList();
if (images != null) {
  images.forEach((image) {
    print("Image: ${image.image}");
    print("Slot ${image.slot}");
    print("Version: ${image.version}");
    print("Hash: ${image.hashString}");
    print("Bootable: ${image.bootable}");
    print("Pending: ${image.pending}");
    print("Confirmed: ${image.confirmed}");
    print("Active: ${image.active}");
    print("Permanent: ${image.permanent}");
  });
}

I will close this issue if it's what you've expected.

@rstieger
Copy link
Author

Yes, that does exactly what i want, you can ahead and close this. Thanks!

NickKibish added a commit that referenced this issue Apr 17, 2024
Read image list (#66):
- Added method to read image list
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants