I’m using WdfUsbTargetDeviceSendControlTransferSynchronously() with a
WDF_REQUEST_SEND_OPTIONS to specify a timeout but I’ve encountered a
couple of issues.
-
If I specify a 0 timeout then the call to
WdfUsbTargetDeviceSendControlTransferSynchronously() fails immediately
with a timeout. According to the documentation “If the value is zero,
the framework does not time out the request.” I suspect that this is
not true and that instead the framework doesn’t wait for the request. -
If I specify a relative timeout (600 ms or 600 seconds) the call to
WdfUsbTargetDeviceSendControlTransferSynchronously() seems to timeout in
1 second regardless of the timeout value.
Here is the code that I’m using:
WDF_REQUEST_SEND_OPTIONS SendOptions;
WDF_REQUEST_SEND_OPTIONS_INIT(&SendOptions,
WDF_REQUEST_SEND_OPTION_TIMEOUT);
WDF_REQUEST_SEND_OPTIONS_SET_TIMEOUT(&SendOptions,
WDF_REL_TIMEOUT_IN_SEC(600));
status =
WdfUsbTargetDeviceSendControlTransferSynchronously(DevContext->UsbDevice
,
WDF_NO_HANDLE,
&SendOptions,
&ControlSetupPacket,
NULL,
NULL);
The reason that I’m trying to specify a large timeout is that I have a
USB device that for one of the control transfers takes a long time (1.25
seconds) to complete under some conditions. I’ve found that when it
takes this long that the
WdfUsbTargetDeviceSendControlTransferSynchronously() call fails. What I
see on the USB using a WDM based driver is that the Setup transaction
occurs and then I get IN transactions that are NAKed for 1.25 seconds
followed by an IN which is ACKed and then the status stage which
completes the transaction successfully. With the WDF based driver I see
the Setup transaction and then 0.998 seconds of NAKed IN transactions
and then nothing resulting in a failed transaction. I thought that if I
specified a longer timeout that this would handle this situation but it
seems to have no effect.
Regards,
- Steve -