USB device communication is based on pipes (logical channels). A pipe is a connection
from the host controller to a logical entity, found on a device, and named an endpoint.
Because pipes correspond 1-to-1 to endpoints, the terms are sometimes used interchangeably. A
USB device could have up to 32 endpoints (16 IN, 16 OUT), though it's rare to have so many. An
endpoint is defined and numbered by the device during initialization (the period after physical
connection called "enumeration") and so is relatively permanent, whereas a pipe may be opened and
closed.
Endpoints are grouped into interfaces and each interface is associated with a single
device function. An exception to this is endpoint zero, which is used for device configuration and
is not associated with any interface.
There are two types of pipe: stream and message. A message pipe is bi-directional and is used for
control transfers. Message pipes are typically used for short, simple commands to the device, and a
status response, used, for example, by the bus control pipe number 0. A stream pipe is a
uni-directional pipe connected to a uni-directional endpoint that transfers data using an
isochronous, interrupt, or bulk transfer:
- Isochronous transfers — At some guaranteed data rate (often, but not necessarily,
as fast as possible) but with possible data loss (e.g., realtime audio or video)
- Interrupt transfers — Devices that need guaranteed quick responses (bounded
latency) (e.g., pointing devices and keyboards)
- Bulk transfers — Large sporadic transfers using all remaining available bandwidth,
but with no guarantees on bandwidth or latency (e.g., file transfers)
| isochronous | interrupt | bulk
|
guaranteed latency | X | X |
|
guaranteed data uncorrupted | | X | X
|