Skip to content

Add host UCSI source and USB-C TUI tab - #162

Draft
dymk wants to merge 4 commits into
OpenDevicePartnership:mainfrom
dymk:dymk/ucsi-test-stub
Draft

Add host UCSI source and USB-C TUI tab#162
dymk wants to merge 4 commits into
OpenDevicePartnership:mainfrom
dymk:dymk/ucsi-test-stub

Conversation

@dymk

@dymk dymk commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add a platform-neutral UCSI mailbox decoder and UcsiSource abstraction
  • add deterministic mock and Windows ACPI implementations for ECT0.USND
  • report serial UCSI as explicitly unsupported
  • add a compact Ratatui USB-C tab and dashboard card

Stack

Depends on the crossbeam advisory draft from branch dymk/update-crossbeam-epoch. Until that merges, GitHub will show those prerequisite commits in this draft.

Scope

Supports only UCSI version, capability, connector-capability, and connector-status reads for the deterministic one-connector stub. No CLI, notifications, or native UCSI class-driver integration.

Validation

Related

dymk added 4 commits July 31, 2026 22:02
Upgrade crossbeam-epoch from 0.9.18 to 0.9.20 to address
RUSTSEC-2026-0204. The dependency is pulled through the existing
sysinfo/rayon graph used by ec-test-tui.

Assisted-by: GitHub Copilot:gpt-5.6-sol
Copilot-Session: 6cb7060d-6d47-49ad-a710-428fe4c2f3dc
Move the existing safe-to-deploy exemption from crossbeam-epoch 0.9.18
to the patched 0.9.20 release so cargo-vet accepts the lockfile security
update.

Assisted-by: GitHub Copilot:gpt-5.6-sol
Copilot-Session: 6cb7060d-6d47-49ad-a710-428fe4c2f3dc
Add a read-only host UCSI slice so ec-test-lib and the ec-test-tui
Ratatui app can query the secure-world UCSI stub over ACPI.

ec-test-lib:
- New platform-neutral `ucsi` module: small value types (version,
  capability, connector capability/status, CCI) plus 48-byte mailbox
  decoding that validates VERSION, CCI and the response data length.
  Kept off the Windows-only path so decode is unit-tested on Linux.
- `UcsiSource` trait (get_version, get_capability,
  get_connector_capability, get_connector_status) added to the `Source`
  supertrait with an `Arc` forwarding impl.
- Mock returns deterministic single-connector PD-sink fixtures.
- Serial gains an `Unsupported` error (mapped to `ErrorKind::Other`) as
  it has no EC-side UCSI peer; it never fakes success.
- Windows Acpi backend evaluates `\_SB.ECT0.USND` with an 8-byte CONTROL
  buffer and decodes the returned 48-byte mailbox.

ec-test-tui:
- Extend `DynSource` and the manual battery/thermal test doubles.
- Add `UcsiState`/`UcsiUpdater` and a compact, stateless USB-C tab plus
  dashboard card modeled on the RTC module (version, connector 1
  capability, connected sink status). Errors render honestly.

Assisted-by: GitHub Copilot:claude-opus-4.8
Copilot-Session: 6cb7060d-6d47-49ad-a710-428fe4c2f3dc
Apply the independent code-judo findings, cutting LOC and concepts
while preserving behavior and the unique tests.

ec-test-lib:
- Replace the public `Mailbox` + `Cci` intermediate types with two
  private helpers (`validate` / `message_in`) plus free `decode_*`
  functions. They enforce 48-byte length, VERSION 0x0120,
  cmd_complete, no error/not_supported, and the expected data length,
  then decode each response directly.
- Flatten `UcsiConnectorCapability` (drop the `OperationMode` wrapper)
  and drop the unused CCI `busy` accessor and capability Type-C
  version field. `UcsiVersion` is retained since Source/TUI consume it.
- Delete the duplicate Mock tests that mirrored the fixture constants;
  the retained updater test already exercises the Mock values.

ec-test-tui:
- Collapse the UCSI UI to one shared metric-row builder used by both
  the tab and the dashboard card; remove the dedicated panel renderers
  and redundant formatting helpers. Pending/error text stays honest.
- Stop warning every poll for the steadily-unsupported serial backend;
  the Fetched error cells still surface the failure to the UI.
- Give `DynSource` default UCSI methods so the battery/thermal test
  doubles need no stubs, reverting those files to pristine.
- Drop the UI formatting tests that only mirrored string output.

Assisted-by: GitHub Copilot:claude-opus-4.8
Copilot-Session: 6cb7060d-6d47-49ad-a710-428fe4c2f3dc
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.

1 participant