Fix Battery FF-A request payload dispatch - #88
Merged
Conversation
Validate the GetBst opcode and forward the requested battery ID before relaying to the EC. Add regression coverage for nonzero IDs and unknown commands. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: a3539bc8-3a1f-44b3-ba4a-c171a7822595
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes the Battery FF-A service handler to properly decode and validate the incoming direct-message payload before relaying a request to the EC, addressing Issue #83 where the handler previously ignored the payload (effectively hardcoding GetBst for battery 0).
Changes:
- Validate the incoming Battery opcode (payload byte 0) and reject unknown commands before any relay I/O.
- Forward payload byte 1 as
battery_idtoget_bst(...)instead of hardcoding0. - Add regression tests covering nonzero
battery_idrelay behavior and unknown-opcode rejection.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
RobertZ2011
approved these changes
Jul 27, 2026
philgweber
approved these changes
Jul 28, 2026
felipebalbi
approved these changes
Jul 29, 2026
This was referenced Jul 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Validation
cargo test -p ec-service-lib batterycargo check --target aarch64-unknown-none-softfloat --all-features./.husky/pre-commitFixes #83