问题
USB 2.0 specifies 4 types of transfers (in section 5.4 Transfer Types):
- Control Transfers
 - Isochronous Transfers
 - Interrupt Transfers
 - Bulk Transfers
 
Section 5.8 says that Bulk Transfers provide:
- Access to the USB on a bandwidth-available basis
 - Retry of transfers, in the case of occasional delivery failure due to errors on the bus
 - Guaranteed delivery of data but no guarantee of bandwidth or latency
 
(Emphasis mine.)
I don't see a similar statement for Control Transfers. Do they also guarantee delivery? If not, how are users expected to handle failures?
Please provide a citation(s) to support your answer.
回答1:
The USB specification provides robust error detection and recovery for control transfers. The control transfer will either be completed or the USB host will know that it failed, and I think that's what "guaranteed delivery" is supposed to mean. This is important because control transfers are used to set up the device when you plug it into a computer and they are also used for many important purposes by the various USB device classes (e.g. they are used to set the baud rate of a serial port on a USB CDC ACM device).
From section 5.5.5 of the USB 2.0 specification:
The USB provides robust error detection and recovery/retransmission for errors that occur during control transfers. Transmitters and receivers can remain synchronized with regard to where they are in a control transfer and recover with minimum effort. Retransmission of Data and Status packets can be detected by a receiver via data retry indicators in the packet. A transmitter can reliably determine that its corresponding receiver has successfully accepted a transmitted packet by information returned in a handshake to the packet. The protocol allows for distinguishing a retransmitted packet from its original packet except for a control Setup packet. Setup packets may be retransmitted due to a transmission error; however, Setup packets cannot indicate that a packet is an original or a retried transmission.
The only transfer type without guaranteed delivery is isochronous. Also, the start of frame (SOF) packets don't have guaranteed delivery.
来源:https://stackoverflow.com/questions/38981712/do-usb-control-transfers-guarantee-delivery