USB dual-role controller driver programming reference

This section describes the programming interfaces that are used by a Windows driver for a dual-role controller. Such a controller can behave as a host controller or a function controller depending on the hardware to which it is connected. These controllers are common on mobile devices and allow for connections to PCs, as well as USB peripherals like keyboards and mice. A mobile device can behave as a peripheral when it is connected to a PC, allowing you to transfer files between your PC and the mobile device. In that scenario, the controller on the device operates in the function role. Conversely, the controller can operate in the host role when connected to USB peripherals like storage drives, keyboard, mice.

One of the main responsibilities of a driver for a dual-role controller is to switch between those two roles, tearing down the previous role's device node and loading the device node for the new role. When writing the driver, use the WDF class extension-client driver model. The dual-role class extension (UrsCx) is a Microsoft-provided in-box driver (urscx01000.sys) that abstracts some processes in order to allow the client driver to focus exclusively on detecting role-switch hardware events and reporting them to UrsCx. The client driver communicates with UrsCx by using a set of methods and event callback functions to handle hardware-related requests and notify the class extension about the hardware events.

For information about enabling a Windows system for USB dual-role support, see USB Dual Role Driver Stack Architecture.

This section describes the event callback functions that are defined by UrsCx. These functions are implemented by your client driver for the dual-role controller. UrsCx invokes these functions to notify the client driver about events, such as the arrival of a role switch request.

Function Description

EVT_URS_DEVICE_FILTER_RESOURCE_REQUIREMENTS

The USB dual-role class extension invokes this callback to allow the client driver to insert the resources from the resource-requirements-list object to resource lists that will be used during the life time of each role.

EVT_URS_SET_ROLE

The URS class extension invokes this event callback when it requires the client driver to change the role of the controller.

This section describes the driver support methods that are implemented by the UrsCx library. Your client driver calls these methods to communicate with UrsCx.

Function Description

UrsDeviceInitialize

Initializes a framework device object to support operations related to a USB dual-role controller and registers the relevant event callback functions with the USB dual-role controller class extension.

UrsReportHardwareEvent

Notifies the USB dual-role class extension about a new hardware event.

UrsIoResourceListAppendDescriptor

Appends the specified resource descriptor to the specified I/O resource list object that maintains resource descriptors for the host or function role.

UrsSetHardwareEventSupport

Indicates the client driver's support for reporting new hardware events.

UrsSetPoHandle

Registers and deletes the client driver's registration with the power management framework (PoFx).

URS_CONFIG_INIT

Initializes a URS_CONFIG structure.

Send comments about this topic to Microsoft