USB driver reference

Overview of the USB driver reference technology.

To develop USB driver reference, you need these headers:

For programming guidance for this technology, see:

IOCTLs

 
IOCTL_GENERICUSBFN_ACTIVATE_USB_BUS

This I/O control code (IOCTL) is sent by a user-mode service or application to notify GenericUSBFn.sys to activate the Universal Serial Bus (USB). Once activated, the bus is prepared to process bus events and handle traffic.
IOCTL_GENERICUSBFN_BUS_EVENT_NOTIFICATION

This I/O control code (IOCTL) is sent by a user-mode service or application to register for Universal Serial Bus (USB) event.
IOCTL_GENERICUSBFN_CONTROL_STATUS_HANDSHAKE_IN

This I/O control code (IOCTL) is sent by a user mode service or application to request a zero-length control status handshake on endpoint 0 in the IN direction.
IOCTL_GENERICUSBFN_CONTROL_STATUS_HANDSHAKE_OUT

This I/O control code (IOCTL) is sent by a user-mode service or application to complete a zero-length control status handshake on endpoint 0 in the OUT direction.
IOCTL_GENERICUSBFN_DEACTIVATE_USB_BUS

This IOCTL code is nevtot supported.
IOCTL_GENERICUSBFN_GET_CLASS_INFO

This I/O control code (IOCTL) is sent by the user-mode service or application to retrieve information about a device's available pipes as configured in the registry.
IOCTL_GENERICUSBFN_GET_CLASS_INFO_EX

This I/O control code (IOCTL) is sent by a user-mode service or application to retrieve information about a device's available pipes as configured in the registry.
IOCTL_GENERICUSBFN_GET_INTERFACE_DESCRIPTOR_SET

This I/O control code (IOCTL) is sent by a user-mode service or application to get the entire interface descriptor set for a function on the device.This IOCTL request does not retrieve the interface descriptor set for the entire device.Universal Serial Bus (USB) interface descriptor set for a function on the device.
IOCTL_GENERICUSBFN_GET_PIPE_STATE

This I/O control code (IOCTL) is sent by a user-mode service or application to get the state of the specified Universal Serial Bus (USB) pipe.
IOCTL_GENERICUSBFN_REGISTER_USB_STRING

This I/O control code (IOCTL) is sent by a user-mode service or application to register a string descriptor.Universal Serial Bus (USB) string descriptor.
IOCTL_GENERICUSBFN_SET_PIPE_STATE

This I/O control code (IOCTL) is sent by a user-mode service or application to set the state of the specified Universal Serial Bus (USB) pipe.
IOCTL_GENERICUSBFN_TRANSFER_IN

This I/O control code (IOCTL) is sent by a user-mode service or application to issue an IN direction transfer on the endpoint that corresponds to the specified pipe ID in the input buffer. (IOCTL_GENERICUSBFN_TRANSFER_IN)
IOCTL_GENERICUSBFN_TRANSFER_IN_APPEND_ZERO_PKT

This I/O control code (IOCTL) is sent by a user-mode service or application to issue an IN direction transfer on the endpoint that corresponds to the specified pipe ID in the input buffer. (IOCTL_GENERICUSBFN_TRANSFER_IN_APPEND_ZERO_PKT)
IOCTL_GENERICUSBFN_TRANSFER_OUT

This I/O control code (IOCTL) is sent by a user-mode service or application to issue an OUT direction transfer on the endpoint that corresponds to the specified pipe ID in the input buffer.
IOCTL_GET_HCD_DRIVERKEY_NAME

The IOCTL_GET_HCD_DRIVERKEY_NAME I/O control request retrieves the driver key name in the registry for a USB host controller driver.
IOCTL_USB_DIAGNOSTIC_MODE_OFF

The IOCTL_USB_DIAGNOSTIC_MODE_OFF I/O control has been deprecated. Do not use.
IOCTL_USB_DIAGNOSTIC_MODE_ON

The IOCTL_USB_DIAGNOSTIC_MODE_ON I/O control has been deprecated. Do not use.
IOCTL_USB_GET_ROOT_HUB_NAME

The IOCTL_USB_GET_ROOT_HUB_NAME I/O control request is used with the USB_ROOT_HUB_NAME structure to retrieve the symbolic link name of the root hub.IOCTL_USB_GET_ROOT_HUB_NAME is a user-mode I/O control request.
IOCTL_USB_USER_REQUEST

The IOCTL_USB_USER_REQUEST I/O control request is available to both user-mode applications and kernel-mode drivers.

Enumerations

 
USB_USER_ERROR_CODE

The USB_USER_ERROR_CODE enumeration lists the error codes that a USB user-mode request reports when it fails.
WDMUSB_POWER_STATE

The WDMUSB_POWER_STATE enumeration indicates the power state of a host controller or root hub.

Functions

 
WinUsb_AbortPipe

The WinUsb_AbortPipe function aborts all of the pending transfers for a pipe. This is a synchronous operation.
WinUsb_ControlTransfer

The WinUsb_ControlTransfer function transmits control data over a default control endpoint.
WinUsb_FlushPipe

The WinUsb_FlushPipe function discards any data that is cached in a pipe. This is a synchronous operation.
WinUsb_Free

The WinUsb_Free function releases all of the resources that WinUsb_Initialize allocated. This is a synchronous operation.
WinUsb_GetAdjustedFrameNumber

The WinUsb_GetAdjustedFrameNumber function computes what the current USB frame number should be based on the frame number value and timestamp.
WinUsb_GetAssociatedInterface

The WinUsb_GetAssociatedInterface function retrieves a handle for an associated interface. This is a synchronous operation.
WinUsb_GetCurrentAlternateSetting

The WinUsb_GetCurrentAlternateSetting function gets the current alternate interface setting for an interface. This is a synchronous operation.
WinUsb_GetCurrentFrameNumber

The WinUsb_GetCurrentFrameNumber function gets the current frame number for the bus.
WinUsb_GetCurrentFrameNumberAndQpc

The WinUsb_GetCurrentFrameNumberAndQpc function retrieves the system query performance counter (QPC) value synchronized with the frame and microframe.
WinUsb_GetDescriptor

The WinUsb_GetDescriptor function returns the requested descriptor. This is a synchronous operation.
WinUsb_GetOverlappedResult

The WinUsb_GetOverlappedResult function retrieves the results of an overlapped operation on the specified file.
WinUsb_GetPipePolicy

The WinUsb_GetPipePolicy function retrieves the policy for a specific pipe associated with an endpoint on the device. This is a synchronous operation.
WinUsb_GetPowerPolicy

The WinUsb_GetPowerPolicy function retrieves the power policy for a device. This is a synchronous operation.
WinUsb_Initialize

The WinUsb_Initialize function creates a WinUSB handle for the device specified by a file handle.
WinUsb_QueryDeviceInformation

The WinUsb_QueryDeviceInformation function gets information about the physical device that is associated with a WinUSB interface handle.
WinUsb_QueryInterfaceSettings

The WinUsb_QueryInterfaceSettings function retrieves the interface descriptor for the specified alternate interface settings for a particular interface handle.
WinUsb_QueryPipe

The WinUsb_QueryPipe function retrieves information about the specified endpoint and the associated pipe for an interface.
WinUsb_QueryPipeEx

The WinUsb_QueryPipeEx function retrieves extended information about the specified endpoint and the associated pipe for an interface.
WinUsb_ReadIsochPipe

The WinUsb_ReadIsochPipe function reads data from an isochronous OUT endpoint.
WinUsb_ReadIsochPipeAsap

The WinUsb_ReadIsochPipeAsap function submits a request that reads data from an isochronous OUT endpoint.
WinUsb_ReadPipe

The WinUsb_ReadPipe function reads data from the specified pipe.
WinUsb_RegisterIsochBuffer

The WinUsb_RegisterIsochBuffer function registers a buffer to be used for isochronous transfers.
WinUsb_ResetPipe

The WinUsb_ResetPipe function resets the data toggle and clears the stall condition on a pipe.
WinUsb_SetCurrentAlternateSetting

The WinUsb_SetCurrentAlternateSetting function sets the alternate setting of an interface.
WinUsb_SetPipePolicy

The WinUsb_SetPipePolicy function sets the policy for a specific pipe associated with an endpoint on the device. This is a synchronous operation.
WinUsb_SetPowerPolicy

The WinUsb_SetPowerPolicy function sets the power policy for a device.
WinUsb_StartTrackingForTimeSync

The WinUsb_StartTrackingForTimeSync function starts the time synchronization feature in the USB driver stack that gets the associated system QPC time for USB bus frames and microframes.
WinUsb_StopTrackingForTimeSync

The WinUsb_StopTrackingForTimeSync function tops the time synchronization feature in the USB driver stack that gets the associated system QPC time for USB bus frames and microframes.
WinUsb_UnregisterIsochBuffer

The WinUsb_UnregisterIsochBuffer function releases all of the resources that WinUsb_RegisterIsochBuffer allocated for isochronous transfers. This is a synchronous operation.
WinUsb_WriteIsochPipe

The WinUsb_WriteIsochPipe function writes the contents of a caller-supplied buffer to an isochronous OUT endpoint, starting on a specified frame number.
WinUsb_WriteIsochPipeAsap

The WinUsb_WriteIsochPipeAsap submits a request for writing the contents of a buffer to an isochronous OUT endpoint.
WinUsb_WritePipe

The WinUsb_WritePipe function writes data to a pipe.

Structures

 
USB_BANDWIDTH_INFO

The USB_BANDWIDTH_INFO structure is used with the IOCTL_USB_USER_REQUEST I/O control request to retrieve information about the allocated bandwidth.
USB_BUS_STATISTICS_0

The USB_BUS_STATISTICS_0 structure is used with the IOCTL_USB_USER_REQUEST I/O control request to retrieve bus statistics.
USB_CLOSE_RAW_DEVICE_PARAMETERS

This structure is not supported. The USB_CLOSE_RAW_DEVICE_PARAMETERS structure is used with the IOCTL_USB_USER_REQUEST I/O control request to close raw access to devices on the bus.
USB_CONTROLLER_INFO_0

The USB_CONTROLLER_INFO_0 structure is used with the IOCTL_USB_USER_REQUEST I/O control request to retrieve information about the USB host controller.
USB_DRIVER_VERSION_PARAMETERS

The USB_DRIVER_VERSION_PARAMETERS structure is used with the IOCTL_USB_USER_REQUEST I/O control request to retrieve version information.
USB_PASS_THRU_PARAMETERS

The USB_PASS_THRU_PARAMETERS structure is used with the IOCTL_USB_USER_REQUEST I/O control request to pass a vendor-specific command to the host controller miniport driver.
USB_POWER_INFO

The USB_POWER_INFO structure is used with the IOCTL_USB_USER_REQUEST I/O control request to retrieve device power state that the host controller power policy specifies for the indicated system power state.
USB_UNICODE_NAME

The USB_UNICODE_NAME structure contains a Unicode string that specifies a symbolic link name.
USBUSER_BANDWIDTH_INFO_REQUEST

The USBUSER_BANDWIDTH_INFO_REQUEST structure is used with the IOCTL_USB_USER_REQUEST I/O control request to retrieve information about the allocated bandwidth.
USBUSER_BUS_STATISTICS_0_REQUEST

The USBUSER_BUS_STATISTICS_0_REQUEST structure is used with the IOCTL_USB_USER_REQUEST I/O control request to retrieve bus statistics.
USBUSER_CONTROLLER_UNICODE_NAME

The USBUSER_CONTROLLER_UNICODE_NAME structure is used in conjunction with the IOCTL_USB_USER_REQUEST I/O control request to retrieve the USB host controller driverkey name.
USBUSER_GET_DRIVER_VERSION

The USBUSER_GET_DRIVER_VERSION structure is used with the IOCTL_USB_USER_REQUEST I/O control request to read driver and interface version information.
USBUSER_PASS_THRU_REQUEST

The USBUSER_PASS_THRU_REQUEST structure is used in conjunction with the IOCTL_USB_USER_REQUEST I/O control request to send a vendor-specific command to the host controller miniport driver.
USBUSER_POWER_INFO_REQUEST

The USBUSER_POWER_INFO_REQUEST structure is used in conjunction with the IOCTL_USB_USER_REQUEST I/O control request to retrieve power policy information concerning the relationship of a specific system state to the power state of the host controller and the root hub.
USBUSER_REQUEST_HEADER

The USBUSER_REQUEST_HEADER structure is used with the IOCTL_USB_USER_REQUEST I/O control request to send a user-mode request to the USB host controller driver.
WINUSB_PIPE_INFORMATION

The WINUSB_PIPE_INFORMATION structure contains pipe information that the WinUsb_QueryPipe routine retrieves.
WINUSB_PIPE_INFORMATION_EX

The WINUSB_PIPE_INFORMATION_EX structure contains pipe information that the WinUsb_QueryPipeEx routine retrieves.
WINUSB_SETUP_PACKET

The WINUSB_SETUP_PACKET structure describes a USB setup packet.