FAQ - What is the difference between a USB Host and USB
Device?
Universal Serial Bus (USB) is not like an Ethernet
connection. In an Ethernet network all end-points are the same and can
both initiate and receive connection requests.
In a USB system, only the host can initiate a
connection. The Devices are in fact slaves to the Host as master - only
speaking when spoken to, and unable to "listen in" to conversations
happening with other Devices on the link at other times.
A single USB Host may be connected to up to 127 Devices
via a cascade of USB hubs up to 6 levels deep. The only time that a USB
Device actually "demands" a host notice it is when it first connects to
a hub, when a process called "enumeration" happens and the host assigns
the Device an ID number for the period it remains connected. The Host
also notes when Devices are disconnected from the link. USB Devices may
be connected/disconnected at any time without requiring the systems be
rebooted or otherwise notified - this is "Hot Swapping" - although some
programmatic uses of the devices may object or cause errors if a device
is disconnected in the middle of for example a file transfer without
notification.
Devices cannot interrupt each other but instead must
wait for the host to finish other conversations and poll to see if the
Device has traffic available.
The nature of this division betwen Host and Device is
recognized in the typical cable - the host "A" end being wider than it
is high compared to the more nearly square shape of the device "B" end.
The extension to the original USB specification called
USB On-the-go (USBOTG) allows for a host to become a device and vice
versa, but at any given time there is only one host on the link, and in
a situation where the host and device swap roles, there can only be one
device on the link. The initial role of host/device is determined by
which end of the cable is plugged into which unit. Thereafter the
switching, if allowed, is done under program control. The typical
USBOTG smart device has a socket which will accept either end of the
USBOTG cable. An example of this use might be 2 PDAs connecting to each
other to share data, as opposed to a PDA (usually a Device) connecting
to a desktop PC (usually a Host)
