power-policy-service: Introduce DisconnectReason enum - #940
Conversation
3a65d39 to
88e9c85
Compare
There was a problem hiding this comment.
Pull request overview
This PR adjusts power-policy behavior to distinguish a consumer “renegotiation” from a true PSU switch when the best consumer remains the same device but its requested capability changes. In support of more accurate Type-C/PD status reporting, it also tightens parsing of the first received source PDO (expecting a fixed PDO) and propagates additional source-side flags into PortStatus, including EPR capability. Finally, it updates the PortStatus::epr field documentation to reflect the intended meaning.
Changes:
- Treat “same device” consumer transitions as renegotiations (flagged via
ConsumerDisconnect::renegotiation) instead of switching. - Extract the first RX source PDO as
Fixedand use its fields to populatedual_power,unconstrained_power, andeprin Type-C port status. - Update the
PortStatus::eprdoc comment to describe EPR capability.
Reviewed changes
Copilot reviewed 1 out of 1 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| type-c-service/src/driver/tps6699x.rs | Reads RX source caps and uses the first fixed PDO to populate additional PortStatus power flags, including EPR capability. |
| power-policy-service/src/consumer.rs | Differentiates renegotiation vs switching when the best consumer remains the same device. |
| embedded-service/src/type_c/controller.rs | Updates the PortStatus::epr field documentation to match its intended meaning. |
88e9c85 to
efb5653
Compare
Combine existing disconnect reasons into this enum and distinguish between renegotiation types. Also rename `ConsumerDisconnect` to `Disconnect` since this type is already used for provider disconnect flags as well.
efb5653 to
c915506
Compare
DisconnectReason enum
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 9 out of 9 changed files in this pull request and generated no new comments.
Suppressed comments (1)
embedded-service/src/power/policy/flags.rs:167
- Doc comment for
InvalidDisconnectReasonrefers toPsuType, but this error is forDisconnectReasonconversion failures. This looks like a copy/paste mistake and can mislead readers.
/// Conversion error for [`PsuType`]
Combine existing disconnect reasons into this enum and distinguishbetween renegotiation types. Also rename
ConsumerDisconnecttoDisconnectsince this type is already used for provider disconnect flags as well.