Alan Stern wrote:
Daniel and David:
This kernel patch implements the plan we discussed for handling short
bulk transfers. It adds a new URB flag: USBDEVFS_URB_XFER_START.
Here's how it works:
Thanks, this is great!!
When libusb breaks a bulk-IN transfer up into multiple URBs, it should
set
USBDEVFS_URB_SHORT_NOT_OK | USBDEVFS_URB_XFER_START
in the flags for the first URB, and
USBDEVFS_URB_SHORT_NOT_OK
for all the following ones. If any of these URBs completes with an
error before libusb has finished submitting all of them, it should stop
the submissions (they'll fail anyway with an EREMOTEIO error; perhaps
a different code would be better). It probably already does this.
Is EREMOTEIO used for any other condition here?
I think the important thing is that it is unique so that we can detect
the condition easily.
At the moment, if the submission of an URB fails, libusb cancels all the
URBs previously successfully submitted as part of that transfer, and
eventually reports a failure condition in the asynchronous callback,
once all of the cancelled URBs have been reaped.
In this specific case (submit failed because a previous URB in the same
transfer already completed and completed early), we'd want to report
success.
Can we do something similar for BULK OUT too? If an URB fails before
transferring all data, cancel all URBs up until the start of the next
transfer.
I like David's suggestion of preserving the old meaning of
USBDEVFS_URB_SHORT_NOT_OK.
Daniel
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html