-
Notifications
You must be signed in to change notification settings - Fork 111
Resolve the error 'Could not install firmware.' - Fixes #3195 #3496
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
base: master
Are you sure you want to change the base?
Conversation
…3195 For burning custom firmware, the validation of 'GenericSerial' should be skipped. Resolve the error 'Could not install firmware.'
Reviewer's guide (collapsed on small PRs)Reviewer's GuideThe PR refactors _validate_apj to skip board_id checks for GenericSerial devices, replaces broad exception handling with specific catches and improved error messages, and reorganizes the validation flow for better readability. Class diagram for updated _validate_apj logic in FirmwareInstallclassDiagram
class FirmwareInstall {
+_validate_apj(firmware_path: pathlib.Path, platform: Platform)
}
class Platform {
<<enumeration>>
GenericSerial
// ... other platform types
}
FirmwareInstall --> Platform: uses
Flow diagram for firmware validation with GenericSerial skipflowchart TD
A[Start firmware validation] --> B{Platform == GenericSerial?}
B -- Yes --> C[Skip board_id validation]
C --> D[Return]
B -- No --> E[Get expected_board_id]
E --> F{expected_board_id == -1?}
F -- Yes --> G[Raise UnsupportedPlatform]
F -- No --> H{firm_board_id == -1?}
H -- Yes --> I[Raise InvalidFirmwareFile: missing board_id]
H -- No --> J{firm_board_id != expected_board_id?}
J -- Yes --> K[Raise InvalidFirmwareFile: board_id mismatch]
J -- No --> L[Return]
File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
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.
Hey there - I've reviewed your changes - here's some feedback:
- The unindented
return
after the GenericSerial skip will short-circuit validation for all platforms—move it inside theif platform == Platform.GenericSerial
block so only GenericSerial avoids the board_id checks. - Consider restructuring the JSON load and board_id logic into a clear sequence (load → generic-skip → validate) to reduce nested blocks and improve readability.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The unindented `return` after the GenericSerial skip will short-circuit validation for all platforms—move it inside the `if platform == Platform.GenericSerial` block so only GenericSerial avoids the board_id checks.
- Consider restructuring the JSON load and board_id logic into a clear sequence (load → generic-skip → validate) to reduce nested blocks and improve readability.
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
For burning custom firmware, the validation of 'GenericSerial' should be skipped. Resolve the error 'Could not install firmware.'
Summary by Sourcery
Skip board_id validation for GenericSerial platform and improve firmware file load error handling to resolve 'Could not install firmware' error.
Bug Fixes:
Enhancements: