Skip to content

Fix Battery FF-A request payload dispatch - #88

Merged
dymk merged 1 commit into
OpenDevicePartnership:mainfrom
dymk:dymk/battery-ffa-payload
Jul 29, 2026
Merged

Fix Battery FF-A request payload dispatch#88
dymk merged 1 commit into
OpenDevicePartnership:mainfrom
dymk:dymk/battery-ffa-payload

Conversation

@dymk

@dymk dymk commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • validate the Battery FF-A opcode before relaying
  • forward payload byte 1 as the requested battery ID
  • add regression coverage for nonzero IDs and unknown-opcode rejection before relay I/O

Validation

  • cargo test -p ec-service-lib battery
  • cargo check --target aarch64-unknown-none-softfloat --all-features
  • ./.husky/pre-commit

Fixes #83

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
Copilot AI review requested due to automatic review settings July 27, 2026 21:57
@dymk
dymk requested a review from a team as a code owner July 27, 2026 21:57

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_id to get_bst(...) instead of hardcoding 0.
  • Add regression tests covering nonzero battery_id relay behavior and unknown-opcode rejection.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread ec-service-lib/src/services/battery.rs
@dymk
dymk merged commit c11de8f into OpenDevicePartnership:main Jul 29, 2026
10 checks passed
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.

Battery FFA handler ignores the request payload (hardcodes GetBst on battery 0)

5 participants