[Toybox] Proposal: Add ucsicontrol (USB Type-C UCSI utility) to toybox
Rob Landley
rob at landley.net
Fri Jul 10 23:26:00 UTC 2026
I'm not really familiar with this area, does anyone else with more
relevant context want to express an opinion?
The USB-C I'm familiar with is a connector type, which doesn't care
whether the protocol going across the wire is USB-1.1, 2.0, or the 3.x
that was still under patent when we were poking at it. Having a USB-C
_wire_ protocol is just confusing.
This has a whole
https://www.kernel.org/doc/html/v4.19/driver-api/usb/typec.html that...
first I've heard of it, but it seems to have been around for a while?
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=fab9288428ec0
was commited in 2017.
Searching for "ucsicontrol" is turning up a windows executable, and the
first hit OTHER than that is an Intel page where ecosia.org's summary is
(in its entirety) "You may not use or facilitate the use of this
document in connection with any infringement or other legal analysis
concerning." so obviously I'm not clicking on that. (Nope, not getting
that on me.)
I don't have a ucsicontrol installed on my laptop, and searching the
debian repository for ucsi just finds "ucsim" to pretend to be an ssd...
Rob
On 7/8/26 10:59, M, Madhu wrote:
> Hi Rob,
>
> I'm Madhu M from Intel, working on the Type-C subsystem.
>
> I'd like to propose adding ucsicontrol to toybox, as I've found it to be a very useful utility. Would you be able to review the details and share your comments?
>
> I have tested ucsicontrol utility on android and ubuntu platform.
>
> ucsicontrol — UCSI debugging utility
> What it is:
> ucsicontrol is a userspace command-line tool that talks to the kernel's UCSI (USB Type-C Connector System Software Interface) driver.
> It lets you query and control USB Type‑C / USB Power Delivery (PD) state directly from the OS, without needing external hardware like a PD analyzer,
> oscilloscope, or Type‑C breakout board.
> UCSI is defined in its own standalone specification — the "USB Type-C Connector System Software Interface (UCSI) Specification" published by Intel.
> It defines how the OS communicates with the platform's embedded PPM (Platform Policy Manager, usually firmware in the EC or a PD controller chip).
> Each physical Type‑C port is exposed as a connector, and each connector's PD controller is the LPM (Local Policy Manager).
>
> The layered architecture illustrated in Fig. 1 demonstrates how ucsicontrol provides direct access to USB-C management functions through the UCSI interface.
> The tool operates in user space, communicating through debugfs interfaces with the kernel's OPM, which in turn manages communication with the platform's PPM and underlying hardware controllers.
> [cid:image001.png at 01DD0F20.2A464000]
>
> Why it's useful for debugging Type‑C issues without extra tools:
> Traditionally, debugging a Type‑C/PD problem (bad orientation, wrong power role, PD negotiation failure, alt-mode not entering) required:
>
> * A USB-PD protocol analyzer (expensive)
> * A breakout board to probe CC lines
> * Logic analyzer / scope for CC/VBUS signals
>
> What you can inspect / do:
> Capability
> Typec port capabilities
> Connector status
> Whether a cable/device is attached, connected partner type
> Power role
> Source (providing power) vs Sink (consuming)
> Data role
> DFP (host) vs UFP (device)
> Orientation / plug flip
> Which CC line is active (CC1/CC2)
> PDOs (Power Data Objects)
> Advertised source/sink power profiles (voltage/current)
> RDO
> The negotiated request (which PDO was selected, current level)
> Alternate modes
> DisplayPort / Thunderbolt alt-mode SVIDs and status
> Cable info
> Whether it's an e-marked cable, its capabilities
> Role swap
> Trigger PR_SWAP (power) / DR_SWAP (data) in software
> Reset
> Issue a connector/PPM reset to recover a stuck port
>
> Typical commands
> The exact syntax varies by implementation, but common patterns:
> # List / get overall capabilities of the PPM
> ucsicontrol get-capability
>
> # Per-connector capability (what the port supports)
> ucsicontrol get-connector-capability 1
>
> # Current live status of connector 1 (attach, roles, orientation)
> ucsicontrol get-connector-status 1
>
> # Advertised power profiles (source/sink PDOs)
> ucsicontrol get-pdos 1
>
> # Cable / partner alternate modes
> ucsicontrol get-alternate-modes 1
>
> # Trigger a power-role swap on connector 1
> ucsicontrol set-uor 1 ... # USB Operation Role
> ucsicontrol set-pdr 1 ... # Power Direction Role
>
> # Reset a stuck connector
> ucsicontrol connector-reset 1
>
>
> final thought:
> ucsicontrol is more powerful because it sends raw UCSI commands and can retrieve fields the sysfs layer doesn't expose,
> plus it can issue control commands (swaps/resets) directly.
> A practical debug workflow
>
> 1. Nothing charges / wrong direction → get-connector-status to check power role and attach state.
> 2. Slow charging → get-pdos + check the negotiated RDO to see if it fell back to 5V/USB default instead of the higher PD profile.
> 3. DisplayPort not working over USB‑C → get-alternate-modes to confirm the DP SVID (0xFF01) is present and entered.
> 4. Orientation/flip issues → check the orientation field to verify CC1 vs CC2 detection.
> 5. Port stuck → connector-reset to force re-negotiation without unplugging.
>
> Please consider adding the ucsicontrol utility to toybox and share review comment on attached patch v1-0001-Add-ucsicontrol-command-to-control-query-USB-Type.patch.
>
> Regards,
> Madhu M
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: v1-0001-Add-ucsicontrol-command-to-control-query-USB-Type.patch
Type: text/x-patch
Size: 33597 bytes
Desc: not available
URL: <http://lists.landley.net/pipermail/toybox/attachments/20260710/f8befcaa/attachment-0001.bin>
More information about the Toybox
mailing list