共用方式為


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);
}

規格需求

需求
目標平台 Windows
最低 KMDF 版本 1.0
最低UMDF版本 2.0
標頭 ufxclient.h
IRQL PASSIVE_LEVEL

另請參閱