共用方式為


EVT_UFX_DEVICE_PORT_CHANGE回呼函式 (ufxclient.h)

用戶端驅動程序的實作,用來更新 USB 裝置所連接的新埠類型。

語法

EVT_UFX_DEVICE_PORT_CHANGE EvtUfxDevicePortChange;

void EvtUfxDevicePortChange(
  [in] UFXDEVICE unnamedParam1,
  [in] USBFN_PORT_TYPE unnamedParam2
)
{...}

參數

[in] unnamedParam1

用戶端驅動程式在先前 呼叫 UfxDeviceCreate時收到的 USB 裝置物件的句柄。

[in] unnamedParam2

USBFN_PORT_STATE型別旗標,表示新埠的類型。

傳回值

沒有

言論

函式主機控制器的用戶端驅動程式會呼叫 UfxDeviceCreate 方法,向 USB 函式類別延伸模組 (UFX) 註冊其 EVT_UFX_DEVICE_PORT_CHANGE 實作。

UFX 會叫用此事件回呼,以通知用戶端驅動程式裝置的新狀態。

用戶端驅動程式會呼叫 UfxDeviceEventComplete 方法來指示完成此事件。

例子


EVT_UFX_DEVICE_PORT_CHANGE UfxDevice_EvtDevicePortChange;

VOID
UfxDevice_EvtDevicePortChange (
    _In_        UFXDEVICE UfxDevice,
    _In_        USBFN_PORT_TYPE NewPort
    )
/*++

Routine Description:

    EvtDevicePortChange handler for the UFXDEVICE object.
    Caches the new port type, and stops or resumes idle as needed.

Arguments:

    UfxDevice - UFXDEVICE object representing the device.

    NewPort - New port type

--*/
{
    NTSTATUS Status;
    PUFXDEVICE_CONTEXT Context;

    PAGED_CODE();

    TraceEntry();

    Context = UfxDeviceGetContext(UfxDevice);

    TraceInformation("New PORT: %d", NewPort);

    //
    //  #### TODO: Insert code to examine the device USB state and port type 
    //      and determine if it needs to stop or resume idle.


    UfxDeviceEventComplete(UfxDevice, STATUS_SUCCESS);
    TraceExit();
}

要求

要求 價值
目標平臺 窗戶
最低 KMDF 版本 1.0
最低 UMDF 版本 2.0
標頭 ufxclient.h
IRQL PASSIVE_LEVEL

另請參閱

UfxDeviceCreate

UfxDeviceEventComplete