Skip to content

type-c-service/wrapper: Break out event receiver code#799

Open
RobertZ2011 wants to merge 1 commit intoOpenDevicePartnership:v0.2.0from
RobertZ2011:type-c-controller-break-up
Open

type-c-service/wrapper: Break out event receiver code#799
RobertZ2011 wants to merge 1 commit intoOpenDevicePartnership:v0.2.0from
RobertZ2011:type-c-controller-break-up

Conversation

@RobertZ2011
Copy link
Copy Markdown
Contributor

@RobertZ2011 RobertZ2011 commented Apr 17, 2026

  • Move all code related to receiving events out of wrapper::Wrapper and
    into a separate event receiver struct.
  • Pull-in corresponding tps6699x changes.
  • Refactor PortEventStreamer to work over an iter ofPortEventBitfield, simpifly logic.
  • Introduce temporary generics and public visibility.

@RobertZ2011 RobertZ2011 self-assigned this Apr 17, 2026
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 17, 2026

Cargo Vet Audit Passed

cargo vet has passed in this PR. No new unvetted dependencies were found.

@github-actions github-actions bot added the cargo vet PRs pending auditor review label Apr 17, 2026
@RobertZ2011 RobertZ2011 force-pushed the type-c-controller-break-up branch 4 times, most recently from 7790502 to 0a1ad78 Compare April 17, 2026 16:26
@RobertZ2011 RobertZ2011 changed the title type-c-service/wrapper: Breakout event receiver code type-c-service/wrapper: Break out event receiver code Apr 17, 2026
@RobertZ2011 RobertZ2011 force-pushed the type-c-controller-break-up branch 6 times, most recently from 43db36e to f2771f8 Compare April 17, 2026 17:33
@RobertZ2011 RobertZ2011 requested a review from Copilot April 17, 2026 17:39
Copy link
Copy Markdown
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

This PR refactors the Type‑C controller wrapper event handling by moving “wait/receive” responsibilities into a dedicated event receiver layer, and updates controller drivers/examples accordingly. It also updates the Type‑C interface and TPS6699x integration to align with the new eventing model.

Changes:

  • Introduce type-c-service::wrapper::event_receiver to centralize receiving/merging port, power-policy, CFU, PD-controller, and sink-ready-timeout events.
  • Refactor PortEventStreamer to iterate over an iterator of PortEventBitfield (instead of async closure-based per-port reads).
  • Remove wait_port_event/clear_port_events from the type_c_interface::port::Controller trait and adapt TPS6699x + examples to the new interrupt/event pipeline; bump tps6699x dependency to branch v0.2.0.

Reviewed changes

Copilot reviewed 12 out of 20 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
type-c-service/src/wrapper/power.rs Removes wrapper-side power command waiting logic (moved into event receiver).
type-c-service/src/wrapper/pd.rs Moves sink-ready timeout tracking to SinkReadyTimeoutEvent.
type-c-service/src/wrapper/mod.rs Removes wrapper “wait” loop; process_event/finalize now take event receiver components.
type-c-service/src/wrapper/event_receiver.rs New event receiver module combining port/power/CFU/PD/sink-timeout event sources.
type-c-service/src/wrapper/cfu.rs Routes CFU ticker handling through the new CFU event receiver.
type-c-service/src/wrapper/backing.rs Adjusts storage wiring to expose CFU/PD controller pieces and return power proxy receivers separately.
type-c-service/src/lib.rs Refactors PortEventStreamer into an Iterator over PortEventBitfield iterators; updates tests accordingly.
type-c-service/src/driver/tps6699x.rs Removes old Controller event APIs; adds driver-side InterruptReceiver adapter for wrapper event receiver.
type-c-interface/src/port/mod.rs Removes Controller::wait_port_event and Controller::clear_port_events from the public trait.
examples/std/src/lib/type_c/mock_controller.rs Adds a mock interrupt receiver and removes old controller event buffering.
examples/std/src/bin/type_c/unconstrained.rs Switches wrapper driving to ArrayPortEventReceivers + explicit process_event/finalize.
examples/std/src/bin/type_c/ucsi.rs Switches wrapper driving to ArrayPortEventReceivers + explicit process_event/finalize.
examples/std/src/bin/type_c/service.rs Switches wrapper driving to ArrayPortEventReceivers + explicit process_event/finalize.
examples/std/Cargo.lock Lockfile updates (incl. TPS6699x source change).
examples/rt685s-evk/src/bin/type_c_cfu.rs Updates RT685 example to new interrupt processor + wrapper event receiver.
examples/rt685s-evk/src/bin/type_c.rs Updates RT685 example to new interrupt processor + wrapper event receiver.
examples/rt685s-evk/Cargo.toml Pins tps6699x to branch = "v0.2.0".
examples/rt685s-evk/Cargo.lock Lockfile updates (incl. TPS6699x source change).
Cargo.toml Workspace tps6699x dependency switched to branch = "v0.2.0".
Cargo.lock Workspace lockfile updates (incl. TPS6699x source change).

Comment thread type-c-service/src/wrapper/event_receiver.rs
Comment thread type-c-service/src/wrapper/event_receiver.rs Outdated
Comment thread type-c-service/src/wrapper/cfu.rs
Comment thread type-c-service/src/wrapper/cfu.rs Outdated
Comment thread type-c-service/src/wrapper/event_receiver.rs
Comment thread type-c-service/src/wrapper/event_receiver.rs Outdated
Comment thread type-c-service/src/wrapper/mod.rs
Comment thread type-c-service/src/wrapper/mod.rs
@RobertZ2011 RobertZ2011 force-pushed the type-c-controller-break-up branch 2 times, most recently from 02c8d17 to 3d1994d Compare April 17, 2026 18:08
@RobertZ2011 RobertZ2011 requested a review from Copilot April 17, 2026 18:11
Copy link
Copy Markdown
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 12 out of 20 changed files in this pull request and generated 2 comments.

Comment thread type-c-service/src/wrapper/event_receiver.rs
Comment thread type-c-service/src/lib.rs Outdated
* Move all code related to receiving events out of `wrapper::Wrapper` and
into a separate event receiver struct.
* Pull-in corresponding tps6699x changes.
* Refactor `PortEventStreamer` to work over an iter of
  `PortEventBitfield`, simpifly logic.
* Introduce temporary generics and public visibility.
@RobertZ2011 RobertZ2011 force-pushed the type-c-controller-break-up branch from 7a0c03f to c040644 Compare April 17, 2026 18:28
Copy link
Copy Markdown
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 12 out of 20 changed files in this pull request and generated 1 comment.

Comment thread type-c-service/src/wrapper/event_receiver.rs
@RobertZ2011 RobertZ2011 marked this pull request as ready for review April 17, 2026 18:36
@RobertZ2011 RobertZ2011 requested a review from a team as a code owner April 17, 2026 18:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cargo vet PRs pending auditor review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants