Skip to content

type-c-service: Don't restart sink ready timeout if contract is same#737

Merged
asasine merged 2 commits intoOpenDevicePartnership:mainfrom
RobertZ2011:type-c-sink-ready-change
Feb 27, 2026
Merged

type-c-service: Don't restart sink ready timeout if contract is same#737
asasine merged 2 commits intoOpenDevicePartnership:mainfrom
RobertZ2011:type-c-sink-ready-change

Conversation

@RobertZ2011
Copy link
Contributor

In certain cases, we can receive repeated source capabilities messages. This will reset the sink ready timeout and lead to a situation where we are never able to sink from the source. Only restart the timer if we get a different contract.

@RobertZ2011 RobertZ2011 self-assigned this Feb 26, 2026
Copilot AI review requested due to automatic review settings February 26, 2026 18:15
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adjusts the Type-C service sink-ready timeout logic to avoid perpetually delaying sink readiness when repeated capabilities/contract notifications arrive with no actual contract change.

Changes:

  • Change check_sink_ready_timeout to accept the newly negotiated sink contract (Option<PowerCapability>) rather than a boolean “new contract” flag.
  • Only (re)start the sink-ready timeout when the contract value differs from the previously cached contract.
  • Update the wrapper event path to pass through the optional contract when a new consumer contract event is observed.

Reviewed changes

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

File Description
type-c-service/src/wrapper/pd.rs Compares the incoming contract to cached state to decide whether to restart the sink-ready deadline, and adds logging around the decision.
type-c-service/src/wrapper/mod.rs Updates the call site to provide the optional PowerCapability only when a new consumer contract event occurs.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

In certain cases, we can receive repeated source capabilities
messages. This will reset the sink ready timeout and lead to a situation
where we are never able to sink from the source. Only restart the
timer if we get a different contract.
@RobertZ2011 RobertZ2011 force-pushed the type-c-sink-ready-change branch from 4164f6d to 113b98e Compare February 26, 2026 18:52
@RobertZ2011 RobertZ2011 marked this pull request as ready for review February 26, 2026 20:13
@RobertZ2011 RobertZ2011 requested a review from a team as a code owner February 26, 2026 20:13
@RobertZ2011 RobertZ2011 requested review from asasine, Copilot, felipebalbi, gjpmsft, jerrysxie, kurtjd and tullom and removed request for Copilot February 26, 2026 20:13
asasine
asasine previously approved these changes Feb 27, 2026
Copy link
Contributor

@asasine asasine left a comment

Choose a reason for hiding this comment

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

nb

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@RobertZ2011 RobertZ2011 force-pushed the type-c-sink-ready-change branch from 7ab23e8 to 5a25cbc Compare February 27, 2026 19:59
Copilot AI review requested due to automatic review settings February 27, 2026 20:05
@RobertZ2011 RobertZ2011 force-pushed the type-c-sink-ready-change branch from 5a25cbc to b0be4e7 Compare February 27, 2026 20:05
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@RobertZ2011 RobertZ2011 requested a review from asasine February 27, 2026 20:07
@jerrysxie jerrysxie added the bug Something isn't working label Feb 27, 2026
@asasine asasine merged commit 0f625e0 into OpenDevicePartnership:main Feb 27, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants