信息
您所需的主题如下所示。但此主题未包含在此库中。

IUsbTargetPipeContinuousReaderCallbackReadersFailed::OnReaderFailure 方法

A driver's OnReaderFailure event callback function informs the driver that a continuous reader has reported an error while processing a read request.

语法

BOOL OnReaderFailure(
  [in]  IWDFUsbTargetPipe *pPipe,
  [in]  HRESULT hrStatus
);

参数

pPipe [in]

A pointer to the IWDFUsbTargetPipe interface for the USB pipe on which the driver has enabled a continuous reader.

hrStatus [in]

The HRESULT-typed status value that the USB pipe's I/O target returned.

返回值

The OnReaderFailure event callback function must return a Boolean value. If the return value is TRUE, the framework resets the USB pipe and then restarts the continuous reader. If the callback function returns FALSE, the framework does not reset the device or restart the continuous reader.

评论

To register an OnReaderFailure callback function, your driver must provide a pointer to the driver's IUsbTargetPipeContinuousReaderCallbackReadersFailed interface when it calls IWDFUsbTargetPipe2::ConfigureContinuousReader.

If a driver has created a continuous reader for a USB pipe, the framework calls the driver's OnReaderFailure callback function if the driver's I/O target reports an error when it completes a read request. (If the I/O target successfully completes the request, the framework calls the driver's IUsbTargetPipeContinuousReaderCallbackReadComplete::OnReaderCompletion callback function.)

Before the framework calls a driver's OnReaderFailure callback function, it tries to cancel all in-progress read requests. No read requests are in progress when the framework calls the OnReaderFailure callback function. The framework does not queue any additional read requests until the OnReaderFailure callback function returns.

For information about how the framework synchronizes calls to the OnReaderFailure callback function with calls to other callback functions, see the Remarks section of IUsbTargetPipeContinuousReaderCallbackReadComplete::OnReaderCompletion.

The OnReaderFailure callback function must not call IWDFIoTargetStateManagement::Stop to stop the continuous reader's USB target. (In fact, calling IWDFIoTargetStateManagement::Stop in an OnReaderFailure callback function causes a deadlock.) In addition, the callback function must not call IWDFIoTargetStateManagement::Start to restart the continuous reader. Instead, the framework restarts the reader if the callback function returns TRUE. For more information about when to call IWDFIoTargetStateManagement::Start and IWDFIoTargetStateManagement::Stop for a continuous reader, see Working with USB Pipes in UMDF.

If a driver does not provide an OnReaderFailure callback function and the driver's I/O target reports an error, the framework resets the USB pipe and restarts the continuous reader.

For more information about the OnReaderFailure callback function and USB I/O targets, see Handling a USB I/O Target.

要求

版本

Available in version UMDF 1.9 and later.

标头

Wudfusb.h (包括Wudfusb.h)

另请参见

IUsbTargetPipeContinuousReaderCallbackReadComplete::OnReaderCompletion

 

 

社区附加资源

显示:
© 2014 Microsoft