Skip to content

services: Add the OCP Recovery Agent register reads - #883

Open
chrysh wants to merge 1 commit into
OpenPRoT:ocp-streaming-recoveryfrom
9elements:ocp-streaming-agent-2
Open

chrysh wants to merge 1 commit into
OpenPRoT:ocp-streaming-recoveryfrom
9elements:ocp-streaming-agent-2

Conversation

@chrysh

@chrysh chrysh commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Later PRs add the Recovery Agent sequence that pushes an image, and the
sequence needs typed register reads. This PR adds the reads in a new
crate, services/ocp-recovery/agent (RegisterAccess, AgentError,
read_prot_cap, read_device_status, read_recovery_status), and
DeviceStatus::parse in the api crate for read_device_status.

Open questions:

  • RegisterAccess::read takes a parse closure, which makes read a
    generic method, so no caller can hold a dyn RegisterAccess. Is a
    generic read fine, or should read fill a caller buffer and return
    the length?
  • Should the api tie each register struct to its command in 1 constant,
    such as ProtCap to RecoveryCommand::ProtCap? Today only the
    struct_matches_command_table asserts tie a struct to its command.

@chrysh
chrysh force-pushed the ocp-streaming-agent-2 branch from 9ece6f2 to 9f87b50 Compare December 1, 2026 16:06
The new crate services/ocp-recovery/agent reads PROT_CAP,
DEVICE_STATUS and RECOVERY_STATUS through a RegisterAccess that the
transport implements, and returns the decoded register or an
AgentError that names the command. RegisterAccess::read passes the
response to a parse closure, so the response stays in the receive
buffer of the transport. The new DeviceStatus::parse in the api crate
reads bytes 0 to 6 only, because a response can carry vendor status
after byte 6.

Signed-off-by: Christina Quast <christina.quast@9elements.com>
Assisted-by: Claude Opus 5.5
@chrysh
chrysh force-pushed the ocp-streaming-agent-2 branch from 9f87b50 to 21b4d59 Compare December 1, 2026 16:17

This branch has not been deployed

No deployments
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.

1 participant