IWDFIoTargetStateManagement::Stop method

The Stop method stops sending queued requests to a local I/O target.

Syntax


HRESULT Stop(
  [in]  WDF_IO_TARGET_SENT_IO_ACTION Action
);

Parameters

Action [in]

A WDF_IO_TARGET_SENT_IO_ACTION-typed value that identifies how to handle sent I/O when the I/O target object is stopped.

Return value

Stop always returns S_OK.

Remarks

If your driver can detect recoverable device errors, you might want your driver to call Stop to temporarily stop sending requests to the local I/O target, then later call IWDFIoTargetStateManagement::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::OnD0Exit callback function must call Stop to stop the reader.

If a driver has called Stop, it can still send a request to the target by setting the WDF_REQUEST_OPTION_IGNORE_TARGET_STATE flag when it calls IWDFIoRequest::Send. If a driver sets this flag, the driver can send a request, such as a request to reset a USB pipe (see IWDFUsbTargetPipe::Reset), to a device after the driver has called Stop.

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

Your driver can call Stop multiple times without calling IWDFIoTargetStateManagement::Start. For example, your driver might do the following:

  1. Call Stop and specify an Action value of WdfIoTargetLeaveSentIoPending.

  2. Determine whether the target should resume processing I/O requests.

  3. If the target should resume, call IWDFIoTargetStateManagement::Start. Otherwise, call Stop again with an Action value of WdfIoTargetCancelSentIo.

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

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

Examples

The following code example shows how an IPnpCallback::OnD0Exit callback function can call Stop, if the driver uses a continuous reader for a USB pipe. (To see how to obtain the IWDFIoTargetStateManagement interface, see the code example at IWDFIoTargetStateManagement::Start.)


HRESULT
CMyDevice::OnD0Exit(
    __in IWDFDevice*  pWdfDevice,
    __in WDF_POWER_DEVICE_STATE  previousState
    )
{
    HRESULT hr;
    hr = m_pIoTargetInterruptPipeStateMgmt->Stop(WdfIoTargetCancelSentIo);
    return hr;
}

Requirements

End of support

Unavailable in UMDF 2.0 and later.

Minimum UMDF version

1.5

Header

Wudfddi.h (include Wudfddi.h)

DLL

WUDFx.dll

See also

IWDFIoTargetStateManagement
IWDFRemoteTarget::Stop

 

 

Send comments about this topic to Microsoft

Show:
© 2014 Microsoft. All rights reserved.