type-c-service: Pull PortStatus changes from v0.1 - #949
Conversation
071c2c4 to
b088f50
Compare
There was a problem hiding this comment.
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 updatePortStatusto 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.
b088f50 to
78f8ca7
Compare
d240b46 to
e6ddd09
Compare
There was a problem hiding this comment.
🟡 Changes recommended
The new/modified tests include a timing assertion bug (wrong bounds/constant) and a test-name typo that should be corrected to avoid masking regressions and to keep the suite reliable.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
- Files reviewed: 11/11 changed files
- Comments generated: 3
- Review effort level: Lite
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>
e6ddd09 to
e6b6762
Compare
|
examples/rt685s-evk failure is expected as the tps6699x crate will need to be updated once these changes land. |
Pull in changes from PR #941.
Assisted-by: GitHub Copilot:GPT-5.6 Sol