UfxDeviceNotifyReset 函数 (ufxclient.h)

通知 UFX USB 总线重置事件。

语法

void UfxDeviceNotifyReset(
  [in] UFXDEVICE        UfxDevice,
  [in] USB_DEVICE_SPEED DeviceSpeed
);

参数

[in] UfxDevice

驱动程序通过调用 UfxDeviceCreate 创建的 UFX 设备对象的句柄。

[in] DeviceSpeed

包含 类型为 USB_DEVICE_SPEED 的值,该值指示设备的速度。

返回值

备注

客户端驱动程序在收到总线重置事件时调用 UfxDeviceNotifyReset 。 应禁用所有非默认终结点,并重置默认终结点。 设备将移动到默认状态。

客户端驱动程序通常从其 EvtInterruptDpc 回调函数调用 UfxDeviceNotifyReset。 以下示例演示如何处理重置事件。


VOID
HandleUsbConnect (
    WDFDEVICE WdfDevice
    )
/*++

Routine Description:

    Handles a connect event from the controller.

Arguments:

    WDfDevice - WDFDEVICE object representing the controller.

--*/
{
    PCONTROLLER_CONTEXT ControllerContext;
    USB_DEVICE_SPEED DeviceSpeed;

    TraceEntry();

    ControllerContext = DeviceGetControllerContext(WdfDevice);

    //
    // Read the device speed.
    //

    //
    // #### TODO: Add code to read device speed from the controller ####
    //
    
    // Sample will assume SuperSpeed operation for illustration purposes
    DeviceSpeed = UsbSuperSpeed;
    
    //
    // #### TODO: Add any code needed to configure the controller after connect has occurred ####
    //


    ControllerContext->Speed = DeviceSpeed;
    TraceInformation("Connected Speed is %d!", DeviceSpeed);

    //
    // Notify UFX about reset, which will take care of updating 
    // Max Packet Size for EP0 by calling descriptor update.
    //
    UfxDeviceNotifyReset(ControllerContext->UfxDevice, DeviceSpeed);

    ControllerContext->Connect = TRUE;

    TraceExit();
}

要求

要求
最低受支持的客户端 Windows 10
目标平台 Windows
标头 ufxclient.h
Library ufxstub.lib
IRQL DISPATCH_LEVEL