pldm/firmware_device: let an external caller decide when run_terminus stops

run_terminus previously looped internally with no way for a caller to end
the session on its own terms short of an error. Add run_until, which takes
a should_continue closure checked once per step; run_terminus becomes a
thin wrapper whose closure never returns false.

A straightforward arm()/run_once() split (returning the persistent
responder listener to the caller across separate calls) doesn't work here:
StackListener borrows responder_transport and implements Drop, so holding
it across repeated &mut self calls is a genuine borrow-checker conflict,
not just an ergonomics question. The closure keeps the listener entirely
inside one call, avoiding that.

run_once_inner takes each field it needs directly instead of &mut self,
since it runs alongside the listener's borrow of responder_transport for
the whole loop; splitting fields is what lets the borrow checker see they
don't actually overlap.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2 files changed
tree: a55eb4d3eae69aca0723f585cb2b552847d5d7e9
  1. .github/
  2. docs/
  3. drivers/
  4. hal/
  5. openprot/
  6. platform/
  7. presubmit/
  8. services/
  9. target/
  10. third_party/
  11. tools/
  12. util/
  13. .bazelignore
  14. .bazelrc
  15. .bazelversion
  16. .clang-format
  17. .gitignore
  18. .semgrepignore
  19. BUILD.bazel
  20. CONTRIBUTING.md
  21. LICENSE
  22. MODULE.bazel
  23. MODULE.bazel.lock
  24. pw
  25. README.md
  26. rust-toolchain.toml
  27. workflows.json
README.md

OpenPRoT

Technical Charter

The OpenPRoT Technical Charter can be found at https://github.com/OpenPRoT/.github/blob/main/GOVERNANCE.md

Getting Started

NOTE: We are converting our build system to bazel. We recommend installing bazelisk to automatically manage bazel versions.

Available Tasks

You can run tasks using the Pigweed workflow launcher pw or bazel.

  • ./pw presubmit - Run presubmit checks: formatting, license checks, C/C++ header checks and clippy.
  • ./pw format - Run the code formatters.
  • bazel test //... - Run all tests.
  • bazel build //docs - Build documentation.

Development

The project is structured as a bazel module.

Requirements

  • Bazel. We recommend installing bazelisk to automatically manage bazel versions.

No additional tools are required - all dependencies are managed by bazel.