usb/UcmCxUcsi/README.md
This is a sample driver that shows how to create a Windows USB Type-C port controller driver using the USB Connector Manager class extension driver (UcmCx). The sample is a driver for an embedded controller which is compliant with the USB Type-C Connector System Software Interface (UCSI).
Start at the UcmCx documentation at USB Type-C connector driver programming reference.
Microsoft already provides an inbox UCSI driver, UcmUcsi.sys. This UcmCxUcsi sample driver is not identical to the inbox UCSI driver. Microsoft recommends that you use the inbox UcmUcsi.sys for your UCSI-compliant system rather than writing your own. This sample driver is meant for developers bringing up a UcmCx driver for their own non-UCSI platforms. For more information about the UCSI driver, reference USB Type-C Connector System Software Interface (UCSI) driver.
This sample demonstrates the following:
Registration with the USB Connector Manager (UCM) class extension driver.
Initializing the port controller's Type-C and Power Delivery capabilities.
Performing data and power role swaps requested by UCM
Notifying UCM of Type-C and Power Delivery events on the connector.
This sample is specific to UCSI systems. You may choose to structure your driver in a similar way for your own hardware. Understand the requirements and specification of your own system prior to writing a new UcmCx client driver. In addition to making the logic and functionality suit your specific port controller hardware, you will need to modify the .inf such that it matches your device's information.
In this sample, UCM-specific interactions are split apart from most of the UCSI-specific operations.
The following files contain methods that interface with UcmCx.
UcmCallbacks.cpp
UcmNotifications.cpp
Fdo.cpp
Fdo_EvtDeviceSelfManagedIoInit contains the code segment which initializes the device with UCM.The remainder of the files perform operations for UCSI and WDF, non-specific to UCM.
Acpi.cpp
Driver.cpp
Ppm.cpp
UcmCx is intended for system port controller drivers. If you are bringing up a USB Type-C peripheral, you do not need to write a USB Type-C specific driver; a regular USB client driver will suffice. Refer to Developing Windows client drivers for USB devices to determine what type of driver, if any, you need to write to make your USB device work with Windows. You may look at Do I need to write a driver for my USB Type-C hardware? for a more detailed overview.