USB function class driver to UFX programming reference

A USB function class driver implements the functionality of a specific interface (or group of interfaces) on the USB device. The class driver handle requests issued by user mode services, or it can forwards requests to USB function class extension (UFX) and its function client driver. Certain class drivers are included in Windows, such as MTP and IpOverUsb. Windows also provides a generic kernel-mode class driver, Generic USBFN (GenericUSBFn.sys).

If a particular interface or functionality is not provided by a system-supplied driver, you might need write a function class driver. The class driver may be implemented as a kernel-mode driver by using Windows Driver Frameworks (WDF). Alternatively, you may implement it as a user-mode service. In that case, your class driver must be paired with the system-supplied class driver, Generic USBFN. For example, the MTP class driver runs as a user-mode service that transferring files to and from the device.

Here are the IOCTL codes that a function class driver can send to UFX.

Topic Description

IOCTL_INTERNAL_USBFN_ACTIVATE_USB_BUS

The USB class driver sends this request to activate the bus so that the driver can prepare to process bus events and handle traffic.

IOCTL_INTERNAL_USBFN_BUS_EVENT_NOTIFICATION

The USB class driver sends this request to prepare for notifications received from the USB function class extension (UFX) in response to an event on the bus, such as a change in the port type or a receipt of a non-standard setup packet.

IOCTL_INTERNAL_USBFN_CONTROL_STATUS_HANDSHAKE_IN

The class driver sends this request to send a zero-length control status handshake on endpoint 0 in the IN direction.

IOCTL_INTERNAL_USBFN_CONTROL_STATUS_HANDSHAKE_OUT

The class driver sends this request to send a zero-length control status handshake on endpoint 0 in the OUT direction.

IOCTL_INTERNAL_USBFN_DEACTIVATE_USB_BUS

The class driver sends this request to deactivate the bus.

IOCTL_INTERNAL_USBFN_GET_CLASS_INFO

The class driver sends this request IO control code to retrieve information about the available pipes for a device, as configured in the registry.

IOCTL_INTERNAL_USBFN_GET_INTERFACE_DESCRIPTOR_SET

The class driver sends this request to get the entire USB interface descriptor set for a function on the device.

IOCTL_INTERNAL_USBFN_GET_PIPE_STATE

The class driver sends this request to get the stall state of the specified pipe.

IOCTL_INTERNAL_USBFN_TRANSFER_IN

The class driver sends this request to initiate a data transfer to the host on the specified pipe.

IOCTL_INTERNAL_USBFN_TRANSFER_IN_APPEND_ZERO_PKT

The class driver sends this request to initiate an IN transfer to the specified pipe and appends a zero-length packet to indicate the end of the transfer.

IOCTL_INTERNAL_USBFN_TRANSFER_OUT

The class driver sends this request to initiate a data transfer from the host on the specified pipe.

IOCTL_INTERNAL_USBFN_REGISTER_USB_STRING

The class driver sends this request to register a USB string descriptor.

IOCTL_INTERNAL_USBFN_RESERVED

Not supported.

IOCTL_INTERNAL_USBFN_SET_PIPE_STATE

The class driver sends this request to set the stall state of the specified USB pipe.

IOCTL_INTERNAL_USBFN_SET_POWER_FILTER_EXIT_LPM

The class driver sends this IOCTL to request the lower filter driver to exit Link Power Management (LPM).

IOCTL_INTERNAL_USBFN_SET_POWER_FILTER_STATE

UFX sends this IOCTL to the client driver to communicate the current device state to the lower filter driver.

IOCTL_INTERNAL_USBFN_SIGNAL_REMOTE_WAKEUP

The class driver sends this request to get remote wake-up notifications from endpoints.

Send comments about this topic to Microsoft