Skip to content

type-c-service: Pull PortStatus changes from v0.1 - #949

Draft
RobertZ2011 wants to merge 1 commit into
OpenDevicePartnership:mainfrom
RobertZ2011:port-port-status-change
Draft

type-c-service: Pull PortStatus changes from v0.1#949
RobertZ2011 wants to merge 1 commit into
OpenDevicePartnership:mainfrom
RobertZ2011:port-port-status-change

Conversation

@RobertZ2011

@RobertZ2011 RobertZ2011 commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Pull in changes from PR #941.

Assisted-by: GitHub Copilot:GPT-5.6 Sol

@RobertZ2011 RobertZ2011 self-assigned this Aug 21, 2026
@RobertZ2011
RobertZ2011 force-pushed the port-port-status-change branch 4 times, most recently from 071c2c4 to b088f50 Compare August 26, 2026 20:16
@RobertZ2011
RobertZ2011 requested a lite review from Copilot August 26, 2026 20:20

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 updates the Type-C/PD status surface area by refactoring PortStatus to carry richer negotiated-contract data (SinkContract/SourceContract) including optional PD-specific details, instead of embedding a few boolean flags directly on PortStatus. The Type-C service is adjusted to consume the new contract shape (notably for sink-ready timeout selection), and tests/mocks/examples are updated to construct the new contract structures. This aligns the codebase with the PortStatus changes pulled from the referenced v0.1 work, and centralizes partner-reported PDO flags behind contract methods.

Changes:

  • Introduce SinkContract/SourceContract (+ PdSinkInfo/PdSourceInfo) and update PortStatus to use them.
  • Update Type-C service logic to derive power/timeout decisions from contract capability + PD info (epr_capable(), unconstrained_power(), etc.).
  • Update unit/integration tests, interface mocks, and std examples to build the new contract structures.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
type-c-service/tests/unconstrained.rs Update unconstrained-power test setup to populate SinkContract + PD fixed-data flags.
type-c-service/tests/power.rs Adjust many test fixtures to use SinkContract/SourceContract wrappers instead of raw PowerCapability.
type-c-service/tests/debug_accessory.rs Update debug accessory status fixture to use SourceContract::from_capability.
type-c-service/src/service/ucsi.rs Update UCSI charging-status derivation to read contract.capability.
type-c-service/src/controller/power.rs Use SinkContract helpers and derive sink-ready timeout selection from epr_capable().
type-c-service/src/controller/max_sink_voltage.rs Align sink-ready deadline setup with the new EPR-capable detection on the sink contract.
type-c-interface/src/port/pd.rs Adjust docs referencing removed PortStatus fields (partner PDO info now lives under contracts).
type-c-interface/src/control/pd.rs Add new contract + PD info structs and update PortStatus fields accordingly.
type-c-interface-mocks/tests/connect_disconnect.rs Update assertions to validate contract capability + derived flags rather than removed PortStatus booleans.
type-c-interface-mocks/src/port/mod.rs Update mock plug() to populate the new contract structures and PD fixed-data flags.
examples/std/src/lib/type_c/mock_controller.rs Update std mock controller to populate contract PD info (including unconstrained flag).

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines 31 to 35
/// Returns whether this port reports unconstrained power to the system.
///
/// This is the port's own determination and can differ from
/// [`PortStatus::unconstrained_power`], which is what the partner reports in its PDO.
/// [`PortStatus`], which is what the partner reports in its PDO.
fn reports_unconstrained_power(&self) -> bool;
Comment on lines +218 to +222
let timeout = Self::check_sink_ready_timeout_duration(
new_status
.available_sink_contract
.is_some_and(|contract| contract.epr_capable()),
);
Pull in changes from PRs OpenDevicePartnership#941.

Assisted-by: GitHub Copilot:GPT-5.6 Sol

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@RobertZ2011
RobertZ2011 force-pushed the port-port-status-change branch from b088f50 to 78f8ca7 Compare August 26, 2026 22:13
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.

2 participants