Skip to content

Add boot monitor, move HalBootController into hal-adapters directory - #20

Closed
chrysh wants to merge 1 commit into
mainfrom
add-boot-monitor
Closed

Add boot monitor, move HalBootController into hal-adapters directory#20
chrysh wants to merge 1 commit into
mainfrom
add-boot-monitor

Conversation

@chrysh

@chrysh chrysh commented Jul 17, 2026

Copy link
Copy Markdown
Collaborator

This patch can only be applied after the boot reset control patch is done.

@chrysh
chrysh force-pushed the add-boot-monitor branch from 34908f1 to a4c31ae Compare July 17, 2026 13:24
/// into device implementations.
pub trait BootMonitor {
/// The error type reported by this device's boot monitor.
type Error: core::fmt::Debug;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@chrysh
chrysh force-pushed the add-boot-reset-control_v2 branch from e10f4c6 to daa9aa7 Compare July 21, 2026 12:04
chrysh added a commit that referenced this pull request Jul 22, 2026
Split the HAL-backed adapter out of fwmanager-api so the api crate is a
dependency-free leaf holding only the BootControl capability contract,
matching the layout of #20. HalBootControl and the
BootError wrapper move to the new fwmanager-hal-adapters crate, which
depends on //hal/blocking and the api crate.

Drop the system_control::Error bound from BootControl::Error, keeping
core::error::Error only: requiring the HAL error trait in the api crate
would keep the HAL dependency the split is meant to remove. BootError
still exposes kind(), and the generic-consumer test now recovers the
error category by downcasting the dyn core::error::Error instead of
relying on the removed bound.

Add impl From<E> for BootError<E> so implementations forwarding HAL
calls can use ? instead of .map_err(BootError), and switch
HalBootControl over to it.

Add api-side tests proving the contract stays implementable with no HAL
in sight, and cover the release error path in the adapter.

Assisted-by: Claude:claude-fable-5
Signed-off-by: Christina Quast <christina.quast@9elements.com>
chrysh added a commit that referenced this pull request Jul 22, 2026
Split the HAL-backed adapter out of fwmanager-api so the api crate is a
dependency-free leaf holding only the BootControl capability contract,
matching the layout of #20. HalBootControl and the
BootError wrapper move to the new fwmanager-hal-adapters crate, which
depends on //hal/blocking and the api crate.

Drop the system_control::Error bound from BootControl::Error, keeping
core::error::Error only: requiring the HAL error trait in the api crate
would keep the HAL dependency the split is meant to remove. BootError
still exposes kind(), and the generic-consumer test now recovers the
error category by downcasting the dyn core::error::Error instead of
relying on the removed bound.

Add impl From<E> for BootError<E> so implementations forwarding HAL
calls can use ? instead of .map_err(BootError), and switch
HalBootControl over to it.

Add api-side tests proving the contract stays implementable with no HAL
in sight, and cover the release error path in the adapter.

Assisted-by: Claude:claude-fable-5
Signed-off-by: Christina Quast <christina.quast@9elements.com>
leongross pushed a commit to OpenPRoT/openprot that referenced this pull request Jul 23, 2026
Split the HAL-backed adapter out of fwmanager-api so the api crate is a
dependency-free leaf holding only the BootControl capability contract,
matching the layout of 9elements#20. HalBootControl and the
BootError wrapper move to the new fwmanager-hal-adapters crate, which
depends on //hal/blocking and the api crate.

Drop the system_control::Error bound from BootControl::Error, keeping
core::error::Error only: requiring the HAL error trait in the api crate
would keep the HAL dependency the split is meant to remove. BootError
still exposes kind(), and the generic-consumer test now recovers the
error category by downcasting the dyn core::error::Error instead of
relying on the removed bound.

Add impl From<E> for BootError<E> so implementations forwarding HAL
calls can use ? instead of .map_err(BootError), and switch
HalBootControl over to it.

Add api-side tests proving the contract stays implementable with no HAL
in sight, and cover the release error path in the adapter.

Assisted-by: Claude:claude-fable-5
Signed-off-by: Christina Quast <christina.quast@9elements.com>
@leongross

Copy link
Copy Markdown
Member

@chrysh, this needs a rebase

@leongross leongross linked an issue Jul 23, 2026 that may be closed by this pull request
@chrysh
chrysh changed the base branch from add-boot-reset-control_v2 to main July 23, 2026 13:43
@chrysh
chrysh force-pushed the add-boot-monitor branch from a4c31ae to 2d98907 Compare July 23, 2026 14:49
@chrysh
chrysh marked this pull request as draft July 23, 2026 14:51
@chrysh
chrysh marked this pull request as ready for review July 23, 2026 15:22
BootMonitor reports a device's boot liveness as BootStatus in the api
leaf crate; GpioBootMonitor implements it over one HAL GpioPort input
line. MonitorError meets the core::error::Error bound and keeps the
concrete HAL error reachable through source(). new() rejects empty pin
masks; boot latches are cleared by the reset path, never the observer.

Closes: #6
Assisted-by: Claude:claude-opus-4-8
Assisted-by: Claude:claude-fable-5
Signed-off-by: Christina Quast <christina.quast@9elements.com>
@chrysh
chrysh force-pushed the add-boot-monitor branch from c127649 to eac6896 Compare July 24, 2026 15:36
@rusty1968

Copy link
Copy Markdown

@chrysh - This should be a PR to the main repo? If you agree you can change the openprot hal to acommodate the feedback from @embediver in this PR as well.

@chrysh

chrysh commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator Author

Re-targeted against upstream: superseded by OpenPRoT#368 (this one was accidentally opened against the fork's main).

@chrysh chrysh closed this Jul 24, 2026
@chrysh

chrysh commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator Author

@chrysh - This should be a PR to the main repo? If you agree you can change the openprot hal to acommodate the feedback from @embediver in this PR as well.

Yes, now that the BootControl change is merged, it should be merged to the main repo.

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.

Downstream device boot monitoring

4 participants