USB function controller client driver programming reference

The USB function client driver is responsible for implementing a function controller-specific operations. The client driver communicates with the USB function class extension (UFX) module to handle endpoint data transfers, USB device state changes (reset, suspend, resume), attach/detach detection, port/charger detection. The client driver is also responsible for handling power management, and PnP events.

Here are the methods that are exported by UFX that the function client driver calls.

Method Description

UfxFdoInit

Initializes the WDFDEVICE_INIT structure that the client driver subsequently provides when it calls WdfDeviceCreate.

UfxDeviceCreate

Creates a UFX device object, registers event callback routines, and specifies capabilities specific to the controller.

UfxDeviceEventComplete

Informs UFX that the client driver has completed processing a UFX callback function.

UfxDeviceNotifyHardwareReady

Notifies UFX that the hardware is ready.

UfxDeviceNotifyAttach

Notifies UFX that the device's USB cable has been attached.

UfxDeviceNotifyDetach

Notifies UFX that the device's USB cable has been detached.

UfxDeviceNotifySuspend

Notifies UFX about a USB bus suspend event.

UfxDeviceNotifyResume

Notifies UFX about a USB bus resume event.

UfxDeviceNotifyReset

Notifies UFX about a USB bus reset event.

UfxDevicePortDetectComplete

Notifies UFX about the port type that was detected.

UfxDevicePortDetectCompleteEx

Notifies UFX about the port type that was detected, and optionally requests an action.

UfxDeviceProprietaryChargerDetectComplete

Notifies UFX about a detected proprietary port/charger type.

UfxDeviceNotifyHardwareFailure

Notifies UFX about a non-recoverable hardware failure in the controller.

UfxDeviceIoControl

Passes non-internal IOCTLs from user-mode to UFX.

UfxDeviceIoInternalControl

Passes kernel mode IOCTLs to UFX.

UfxEndpointCreate

Creates an endpoint object.

UfxEndpointInitSetEventCallbacks

Initialize a UFXENDPOINT_INIT structure.

UfxEndpointNotifySetup

Notifies UFX when the client driver receives a setup packet from the host.

UfxEndpointGetTransferQueue

Returns the transfer queue previously created by UfxEndpointCreate.

UfxEndpointGetCommandQueue

Returns the command queue previously created by UfxEndpointCreate.

 

Here are the event callback functions implemented in the client driver and invoked by UFX.

Function Description

EVT_UFX_DEVICE_HOST_CONNECT

The client driver's implementation to initiate connection with the host.

EVT_UFX_DEVICE_HOST_DISCONNECT

The client driver's implementation to disable the function controller's communication with the host.

EVT_UFX_DEVICE_ADDRESSED

The client driver's implementation to assign an address on the function controller.

EVT_UFX_DEVICE_ENDPOINT_ADD

The client driver's implementation to create a default endpoint object.

EVT_UFX_DEVICE_DEFAULT_ENDPOINT_ADD

The client driver's implementation to create a default control endpoint.

EVT_UFX_DEVICE_USB_STATE_CHANGE

The client driver's implementation to update the state of the USB device.

EVT_UFX_DEVICE_PORT_CHANGE

The client driver's implementation to update the type of the new port to which the USB device is connected.

EVT_UFX_DEVICE_PORT_DETECT

The client driver's implementation to initiate port detection

EVT_UFX_DEVICE_REMOTE_WAKEUP_SIGNAL

The client driver's implementation to initiate remote wake-up on the function controller.

EVT_UFX_DEVICE_TEST_MODE_SET

The client driver's implementation to set the test mode of the function controller.

EVT_UFX_DEVICE_TESTHOOK

Not supported.

EVT_UFX_DEVICE_CONTROLLER_RESET

The client driver's implementation to reset the function controller to its initial state.

EVT_UFX_DEVICE_SUPER_SPEED_POWER_FEATURE

The client driver's implementation to set or clear the specified power feature on the function controller.

EVT_UFX_DEVICE_DETECT_PROPRIETARY_CHARGER

The client driver's implementation to initiate proprietary charger detection.

EVT_UFX_DEVICE_PROPRIETARY_CHARGER_RESET

The client driver's implementation to resets proprietary charger.

EVT_UFX_DEVICE_PROPRIETARY_CHARGER_SET_PROPERTY

The client driver's implementation to set charger information that it uses to enable charging over USB.

 

UFX can send IOCTL codes to the client driver.

Control Code Description

IOCTL_INTERNAL_USBFN_DESCRIPTOR_UPDATE

The USB function class extension sends this request to the client driver to update to the endpoint descriptor for the specified endpoint.

 

 

 

Send comments about this topic to Microsoft