Skip to content

Conversation

@cl445
Copy link

@cl445 cl445 commented Feb 2, 2024

Fix and update firmware download process with error handling, logging, and file validation

Details:

  • Download firmware from master branch: Retrieve firmware files directly from the master branch on GitHub for consistency and updates.
  • Implement robust error handling: Catch potential exceptions during download, extraction, and file operations to prevent unexpected failures and provide informative error messages.
  • Integrate logging: Use the Log facade to track progress, status, and potential errors for easier debugging and monitoring.
  • Add file validation: Verify the downloaded file size and content to ensure integrity and prevent issues with empty or invalid files.
  • Extract specific subfolders: Extract only firmware files within latest and feature-specific subfolders for targeted updates.
  • Improve code readability: Enhance code clarity with better variable naming, comments, and formatting for easier maintenance.

cl445 added 2 commits February 2, 2024 09:51
…and file validation

Details:
 - Download firmware from master branch: Retrieve firmware files directly from the master branch on GitHub for consistency and updates.
 - Implement robust error handling: Catch potential exceptions during download, extraction, and file operations to prevent unexpected failures and provide informative error messages.
 - Integrate logging: Use the Log facade to track progress, status, and potential errors for easier debugging and monitoring.
 - Add file validation: Verify the downloaded file size and content to ensure integrity and prevent issues with empty or invalid files.
 - Extract specific subfolders: Extract only firmware files within latest and feature-specific subfolders for targeted updates.
 - Improve code readability: Enhance code clarity with better variable naming, comments, and formatting for easier maintenance.
…and file validation

Details:
 - Download firmware from master branch: Retrieve firmware files directly from the master branch on GitHub for consistency and updates.
 - Implement robust error handling: Catch potential exceptions during download, extraction, and file operations to prevent unexpected failures and provide informative error messages.
 - Integrate logging: Use the Log facade to track progress, status, and potential errors for easier debugging and monitoring.
 - Add file validation: Verify the downloaded file size and content to ensure integrity and prevent issues with empty or invalid files.
 - Extract specific subfolders: Extract only firmware files within latest and feature-specific subfolders for targeted updates.
 - Improve code readability: Enhance code clarity with better variable naming, comments, and formatting for easier maintenance.
@jacobsvante
Copy link

Thanks for this!

For me there were two things I had to do to get your PR working:

  1. Delete file /var/lib/cmprovision/storage/app/firmware/latest, as your code wants to read that as a directory
  2. After fetching latest firmware from UI, I had to move pieeprom- files from newly created /var/lib/cmprovision/storage/app/firmware/latest directory into it's child directory var/lib/cmprovision/storage/app/firmware/stable. After that the firmware was visible under EEPROM firmware update to apply.

@cl445
Copy link
Author

cl445 commented Sep 23, 2025

My PR is now open for more than 2 years. I am glad that it was actualy usefull for someone. Thanks! 🙂

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