Before data can transfer, the host and device must establish a pipe. A pipe is an
association between a device’s endpoint and the host controller’s software. Host
software establishes a pipe with each endpoint address the host wants to communicate
The host establishes pipes during enumeration. If a user detaches a device from
the bus,the host removes the no longer needed pipes. The host can also request
new pipes or remove unneeded pipes by using control transfers to request an
alternate configuration or interface for a device. Every device has a default control
pipe that uses endpoint zero.
The configuration information received by the host includes an endpoint
descriptor for each endpoint that the device wantsto use. Each endpoint
descriptor contains an endpoint address, the type of transfer the endpoint supports,
the maximum size of data packets, and, when appropriate, the desired
interval for transfers.
TYPES OF TRANSFERS
Devices with varied and differing requirements for transfer rate, response time,
and error correcting can all use USB. Each of the four types of data transfersmeets different needs. Each device can support the transfer types that are best
suited for its purpose. Table 2-1 summarizes the features and uses of each type.
Control transfers are the only type with functions defined by the USB specification.
Control transfers enable the host to read information about a device, set a
device’s address, and select configurations and other settings.With driver support,
control transfers can also contain class- and vendor-specific requests that
send and receive data for any purpose. All USB devices must support control
Bulk transfers are intended for applications where the rate of transfer isn’t critical,
such as sending a file to a printer, receiving data from a scanner, or accessing
files on a drive. For theseapplications, quick transfers are nice, but the data can
wait if necessary. On a busy bus, bulk transfers have to wait, but on a bus that is
otherwise idle, bulk transfers are the fastest type. Low speed devices don’t support bulk endpoints. Devices aren’t required to support bulk transfers, but a
specific device class can require them.
Interrupt transfers are for devices that mustreceive the host’s or device’s attention
periodically, or with low latency, or delay. Other than control transfers,
interrupt transfers are the only way low-speed devices can transfer data. Keyboards
and mice use interrupt transfers to send keypress and mouse-movement
data. Interrupt transfers can use any speed. Devices aren’t required to support
interrupt transfers, but a specificdevice class can require them.
Isochronous transfers have guaranteed delivery time but no error correcting.
Data that uses isochronous transfers incudes streaming audio and video. Isochronous
is the only transfer type that doesn’t support automatic re-transmitting
of data received with errors, so occasional errors must be acceptable. Low-speed
devices don’t support isochronous endpoints.Devices aren’t required to support
isochronous transfers, but a specific device class can require them.
STREAM AND MESSAGE PÍPES
In addition to classifying a pipe by the type of transfer it carries, the USB specification
defines pipes as either stream or message. Control transfers use bidirectional
message pipes; all other transfer types use unidirectional stream pipes.
In a control transfer’s message pipe, a transfer begins with a transaction containing
a request. Depending on the request, to complete the transfer, the host and
device may exchange data and status information, or the device may just send
status information. Each control transfer has at least one transaction that sends
information in each direction.
If a device...