Add types for Discover Identity structured VDMs#64
Merged
Conversation
Co-authored-by: Copilot <copilot@github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces a new vdm::structured module implementing USB-PD Structured VDM parsing types, with an emphasis on Discover Identity response VDOs (SOP and SOP′) that expose both raw and parsed forms.
Changes:
- Added
vdm::structuredmodule withSvidand a Structured VDMHeaderparser. - Added structured Discover Identity response/VDO types (ID Header, Product, cable/VPD, UFP/DFP).
- Updated UCSI GET_ALTERNATE_MODES to import
Svidfrom the new module.
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| src/vdm/structured/svid.rs | Adds Svid newtype and common SVID constants. |
| src/vdm/structured/mod.rs | Defines structured module layout and re-exports. |
| src/vdm/structured/header.rs | Adds Structured VDM header parsing types and tests. |
| src/vdm/structured/command/mod.rs | Introduces structured VDM command namespace. |
| src/vdm/structured/command/discover_identity/mod.rs | Defines Discover Identity module and shared VDO newtypes. |
| src/vdm/structured/command/discover_identity/product_vdo.rs | Adds ProductVdo bitfield parsing. |
| src/vdm/structured/command/discover_identity/dfp_vdo.rs | Adds DfpVdo parsing. |
| src/vdm/structured/command/discover_identity/ufp_vdo.rs | Adds UfpVdo parsing and enums. |
| src/vdm/structured/command/discover_identity/vpd_vdo.rs | Adds VpdVdo parsing and enums. |
| src/vdm/structured/command/discover_identity/passive_cable_vdo.rs | Adds Passive Cable VDO parsing and enums. |
| src/vdm/structured/command/discover_identity/active_cable_vdo.rs | Adds Active Cable VDO1/VDO2 parsing and enums. |
| src/vdm/structured/command/discover_identity/sop/mod.rs | Adds SOP Discover Identity ResponseVdos container. |
| src/vdm/structured/command/discover_identity/sop/id_header_vdo.rs | Adds SOP ID Header VDO parsing and product-type enums. |
| src/vdm/structured/command/discover_identity/sop_prime/mod.rs | Adds SOP′ Discover Identity ResponseVdos container. |
| src/vdm/structured/command/discover_identity/sop_prime/id_header_vdo.rs | Adds SOP′ ID Header VDO parsing and product-type enum. |
| src/vdm/mod.rs | Adds structured submodule and removes top-level Svid type. |
| src/ucsi/lpm/get_alternate_modes.rs | Updates imports to use vdm::structured::Svid. |
Comments suppressed due to low confidence (2)
src/vdm/mod.rs:3
- Typo in module docs:
PD spectshould bePD spec.
src/vdm/mod.rs:6 Svidwas previously exported ascrate::vdm::Svid, but is now only available ascrate::vdm::structured::Svid. If this crate is consumed externally, this is a breaking public-API change; consider adding apub use structured::Svidre-export (or otherwise documenting/bumping the version accordingly).
Callers can now use the Product Type VDO enums to fully inspect the type without having to perform additional parsing
RobertZ2011
previously approved these changes
Apr 24, 2026
Contributor
|
Overall looks good, nothing major.
I think this is the best approach. |
RobertZ2011
previously approved these changes
Apr 24, 2026
jerrysxie
requested changes
Apr 26, 2026
jerrysxie
approved these changes
Apr 27, 2026
RobertZ2011
approved these changes
Apr 28, 2026
RobertZ2011
pushed a commit
to OpenDevicePartnership/tps6699x
that referenced
this pull request
Apr 29, 2026
…ntity Data, executing Hard Reset (#104) Builds on OpenDevicePartnership/embedded-usb-pd#64 --------- Co-authored-by: Copilot <copilot@github.com>
jerrysxie
pushed a commit
to jerrysxie/tps6699x
that referenced
this pull request
May 4, 2026
…ntity Data, executing Hard Reset (OpenDevicePartnership#104) Builds on OpenDevicePartnership/embedded-usb-pd#64 --------- Co-authored-by: Copilot <copilot@github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The module hierarchy reflects the PD spec. Each VDO exposes a raw and parsed form, useful for callers to inspect malformed values when deserializing. The parsed types are for deserialization only.