usbi_dbg("handling I/O completion with errcode %d", io_result);
- if (io_result == ERROR_NOT_SUPPORTED) {
- /* The WinCE USB layer (and therefore the USB Kernel Wrapper Driver) will report
- * USB_ERROR_STALL/ERROR_NOT_SUPPORTED in situations where the endpoint isn't actually
- * stalled.
+ if (io_result == ERROR_NOT_SUPPORTED &&
+ transfer->type != LIBUSB_TRANSFER_TYPE_CONTROL) {
+ /* For functional stalls, the WinCE USB layer (and therefore the USB Kernel Wrapper
+ * Driver) will report USB_ERROR_STALL/ERROR_NOT_SUPPORTED in situations where the
+ * endpoint isn't actually stalled.
*
* One example of this is that some devices will occasionally fail to reply to an IN
* token. The WinCE USB layer carries on with the transaction until it is completed
* (or cancelled) but then completes it with USB_ERROR_STALL.
*
- * This code therefore needs to confirm that there really is a stall error, but checking
- * the pipe status and requesting the endpoint status from the device.
+ * This code therefore needs to confirm that there really is a stall error, by both
+ * checking the pipe status and requesting the endpoint status from the device.
*/
BOOL halted = FALSE;
usbi_dbg("checking I/O completion with errcode ERROR_NOT_SUPPORTED is really a stall");
if (UkwIsPipeHalted(priv->dev, transfer->endpoint, &halted)) {
- /* The host side doesn't think the endpoint is halted, so check with the device if
- * it is stalled.
- *
- * So form a GET_STATUS control request. This is done synchronously,
- * which is a bit naughty, but this is a special corner case. */
+ /* Pipe status retrieved, so now request endpoint status by sending a GET_STATUS
+ * control request to the device. This is done synchronously, which is a bit
+ * naughty, but this is a special corner case.
+ */
WORD wStatus = 0;
DWORD written = 0;
UKW_CONTROL_HEADER ctrlHeader;
usbi_dbg("Endpoint doesn't appear to be stalled, overriding error with success");
io_result = ERROR_SUCCESS;
} else {
- usbi_dbg("Endpoint does appear to be stalled, but the host is halted, changing error");
+ usbi_dbg("Endpoint doesn't appear to be stalled, but the host is halted, changing error");
io_result = ERROR_IO_DEVICE;
}
}