EVT_UFX_DEVICE_PORT_DETECT回调函数 (ufxclient.h)

用于启动端口检测的客户端驱动程序实现

语法

EVT_UFX_DEVICE_PORT_DETECT EvtUfxDevicePortDetect;

void EvtUfxDevicePortDetect(
  [in] UFXDEVICE unnamedParam1
)
{...}

参数

[in] unnamedParam1

客户端驱动程序在对 UfxDeviceCreate 方法的上一次调用中收到的 USB 设备对象的句柄。

返回值

没有

言论

函数主机控制器的客户端驱动程序通过调用 UfxDeviceCreate 方法向 USB 函数类扩展(UFX)注册其 EVT_UFX_DEVICE_PORT_DETECT 实现。

客户端驱动程序必须通过调用 UfxDevicePortDetectCompleteUfxDevicePortDetectCompleteEx 方法来指示端口检测完成。

例子

EVT_UFX_DEVICE_PORT_DETECT UfxDevice_EvtDevicePortDetect;

VOID
UfxDevice_EvtDevicePortDetect (
    _In_ UFXDEVICE UfxDevice
    )
/*++
Routine Description:

    Starts the port detection state machine

Arguments:

    UfxDevice - UFXDEVICE object representing the device.

--*/
{
    PUFXDEVICE_CONTEXT DeviceContext;
    PCONTROLLER_CONTEXT ControllerContext;

    DeviceContext = UfxDeviceGetContext(UfxDevice);
    ControllerContext = DeviceGetControllerContext(DeviceContext->FdoWdfDevice);

    //
    // #### TODO: Insert code to determine port/charger type ####
    // 
    // In this example we will return an unknown port type.  
    // This will allow UFX to connect to a host if one is present.  
    // UFX will timeout after 5 seconds if no host is present and transition to
    // an invalid charger type, which will allow the controller to exit D0.
    //

    UfxDevicePortDetectComplete(ControllerContext->UfxDevice, UsbfnUnknownPort);
}

要求

要求 价值
目标平台 窗户
最低 KMDF 版本 1.0
最低 UMDF 版本 2.0
标头 ufxclient.h
IRQL PASSIVE_LEVEL

另请参阅