Skip to content

Latest commit

 

History

History
154 lines (123 loc) · 6.06 KB

nf-wudfddi-iwdfiotargetstatemanagement-start.md

File metadata and controls

154 lines (123 loc) · 6.06 KB
UID title description old-location tech.root ms.date keywords ms.keywords req.header req.include-header req.target-type req.target-min-winverclnt req.target-min-winversvr req.kmdf-ver req.umdf-ver req.ddi-compliance req.unicode-ansi req.idl req.max-support req.namespace req.assembly req.type-library req.lib req.dll req.irql targetos req.typenames f1_keywords topic_type api_type api_location api_name
NF:wudfddi.IWDFIoTargetStateManagement.Start
IWDFIoTargetStateManagement::Start (wudfddi.h)
The Start method starts sending queued requests to a local I/O target.
wdf\iwdfiotargetstatemanagement_start.htm
wdf
02/26/2018
IWDFIoTargetStateManagement::Start
IWDFIoTargetStateManagement interface,Start method, IWDFIoTargetStateManagement.Start, IWDFIoTargetStateManagement::Start, Start, Start method, Start method,IWDFIoTargetStateManagement interface, UMDFIoTargetObjectRef_931a0267-704f-44f7-8f52-0344afb86f81.xml, umdf.iwdfiotargetstatemanagement_start, wdf.iwdfiotargetstatemanagement_start, wudfddi/IWDFIoTargetStateManagement::Start
wudfddi.h
Wudfddi.h
Desktop
1.5
Unavailable in UMDF 2.0 and later.
WUDFx.dll
Windows
IWDFIoTargetStateManagement::Start
wudfddi/IWDFIoTargetStateManagement::Start
APIRef
kbSyntax
COM
WUDFx.dll
IWDFIoTargetStateManagement::Start

IWDFIoTargetStateManagement::Start

-description

[Warning: UMDF 2 is the latest version of UMDF and supersedes UMDF 1. All new UMDF drivers should be written using UMDF 2. No new features are being added to UMDF 1 and there is limited support for UMDF 1 on newer versions of Windows 10. Universal Windows drivers must use UMDF 2. For more info, see Getting Started with UMDF.]

The Start method starts sending queued requests to a local I/O target.

-returns

Start returns S_OK if the operation succeeds. Otherwise, this method might return one of the error codes:

Return code Description
HRESULT_FROM_NT (STATUS_INVALID_DEVICE_STATE)
The device has been removed.
 

This method might return one of the other error codes that Winerror.h defines.

-remarks

If your driver can detect recoverable device errors, you might want your driver to call IWDFIoTargetStateManagement::Stop to temporarily stop sending requests to the local I/O target, then later call Start to resume sending requests.

Additionally, if a driver calls IWDFUsbTargetPipe2::ConfigureContinuousReader to configure a continuous reader for a USB pipe, the driver's IPnpCallback::OnD0Entry callback function must call Start to start the reader.

Your driver must call Start and IWDFIoTargetStateManagement::Stop synchronously. After the driver calls one of these functions, it must not call the other function before the first one returns.

For more information about Start, see Controlling a General I/O Target's State in UMDF.

For more information about I/O targets, see Using I/O Targets in UMDF.

Examples

The following code example first shows how a driver can obtain the IWDFIoTargetStateManagement interface for a USB pipe object. The code example then shows how an IPnpCallback::OnD0Entry callback function can call Start, if the driver uses a continuous reader for the USB pipe.


    IWDFIoTargetStateManagement * m_pIoTargetInterruptPipeStateMgmt = NULL;

    IWDFUsbTargetFactory *  pIUsbTargetFactory = NULL;
    IWDFUsbTargetDevice *   pIUsbTargetDevice = NULL;
    IWDFUsbInterface *      pIUsbInterface = NULL;
    IWDFUsbTargetPipe *     pIUsbPipe = NULL;

    hr = m_FxDevice->QueryInterface(IID_PPV_ARGS(&pIUsbTargetFactory));
    if (FAILED(hr))
    {...}
    hr = pIUsbTargetFactory->CreateUsbTargetDevice(&pIUsbTargetDevice);
    if (FAILED(hr))
    {...}
    hr = pIUsbTargetDevice->RetrieveUsbInterface(0, &pIUsbInterface);
    if (FAILED(hr))
    {...}
    NumEndPoints = pIUsbInterface->GetNumEndPoints();
    for (UCHAR PipeIndex = 0; PipeIndex < NumEndPoints; PipeIndex++)
    {
        hr = pIUsbInterface->RetrieveUsbPipeObject(PipeIndex, &pIUsbPipe);
        if (FAILED(hr))
        {...}
        else
        {
            if (pIUsbPipe->IsInEndPoint())
            {
                if (UsbdPipeTypeInterrupt == pIUsbPipe->GetType())
                {
                    m_pIUsbInterruptPipe = pIUsbPipe;
                    hr = m_pIUsbInterruptPipe->QueryInterface(IID_PPV_ARGS(&m_pIoTargetInterruptPipeStateMgmt));
                    if (FAILED(hr))
                    {...}
                }
            }
        }
    } 

HRESULT
CMyDevice::OnD0Entry(
    __in IWDFDevice*  pWdfDevice,
    __in WDF_POWER_DEVICE_STATE  previousState
    )
{
...
    m_pIoTargetInterruptPipeStateMgmt->Start();
...
    return S_OK;
}

-see-also

IWDFIoTargetStateManagement

IWDFRemoteTarget::Stop