[Toybox] Proposal: Add ucsicontrol (USB Type-C UCSI utility) to toybox

M, Madhu madhu.m at intel.com
Sat Jul 11 02:18:53 UTC 2026


Hi Rob,

I think there are a couple of point getting mixed together here.

USB-C / USB Type-C is indeed the connector and cable ecosystem, and the USB data protocol over it may still be USB 2.0, USB 3.x, DisplayPort alt mode, Thunderbolt, etc. So I agree that calling something a “USB-C wire protocol” can be confusing if what we mean is not traffic between two devices over the cable.

UCSI is different. The USB Type-C™ Connector System Software Interface (UCSI) is an open specification designed to standardise how an Operating System communicates with the hardware or firmware controlling USB Type-C ports.

UCSI is not the USB data protocol carried over the cable. It is a software/control interface for Type-C connector management. In UCSI terminology, the OS Policy Manager (OPM) communicates with the Platform Policy Manager (PPM), which then coordinates the lower-level Type-C / USB Power Delivery controller or Local Policy Manager (LPM).

UCSI spec:
https://www.intel.com/content/dam/www/public/us/en/documents/technical-specifications/usb-type-c-ucsi-spec.pdf (Publicly available)

In the Linux kernel, the UCSI driver includes a dedicated debugfs interface located at: drivers/usb/typec/ucsi/debugfs.c
Linux source: https://github.com/torvalds/linux/blob/master/drivers/usb/typec/ucsi/debugfs.c

That debugfs interface is primarily intended for developers to trace, test, and pass custom hexadecimal UCSI commands directly to the hardware interface / Platform Policy Manager.

That is where ucsicontrol fits in. ucsicontrol is a userspace command-line debugging utility that talks to the kernel’s UCSI driver through debugfs. It provides a more readable, user-friendly way to inspect and control Type-C connector and USB Power Delivery state from the OS.

So I would describe ucsicontrol-style functionality as: get/set Type-C connector or device status and control behavior through the UCSI interface.

It can be useful because it avoids needing external hardware such as a PD analyzer, oscilloscope, or Type-C breakout board for many software-visible UCSI/PD debugging cases. It also turns the raw UCSI/debugfs interface into a more practical command-line tool for developers, platform validation teams, and integrators.

The important distinction is that UCSI is an open Type-C software control interface, not a “USB-C wire protocol” in the sense of USB data traffic over the cable.

Regards, 
Madhu M
-----Original Message-----
From: Rob Landley <rob at landley.net> 
Sent: 11 July 2026 04:56
To: M, Madhu <madhu.m at intel.com>; toybox <toybox at lists.landley.net>
Subject: Re: Proposal: Add ucsicontrol (USB Type-C UCSI utility) to toybox

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
> 


More information about the Toybox mailing list