Chapter 23. USB
RS-232 serial ports are one of the oldest I/O technologies still in use today. They really haven’t changed a lot in the last 20 years. RS-232 serial ports work reliably and work well, but a 20-year-old technology designed for 300-baud modems, daisy-wheel printers, and 16-bit processors with 4.77-MHz clock rates doesn’t suffice for digital video, DVD burners, and optical mice. Consequently, more modern computers have switched to a different serial protocol known as Universal Serial Bus (USB).
Hardware-wise, USB is much faster and thus better suited for the data transfer needs of today’s more bandwidth-hungry devices. USB also uses a different connector that’s much easier to plug in and unplug and less susceptible to bent pins and broken ports. USB cables carry power as well as data, so small USB devices that don’t draw a lot of current don’t need separate power cords. However, to a Java programmer there are two key differences:
Many different devices can be connected to the same USB port. Indeed, up to 127 different devices may be daisy chained to a single USB controller.
Data is sent to and received from USB devices in individual I/O request packets (IRPs). The stream classes are not used.
This makes communicating with USB devices more complex than reading and writing the streams from the single device on a serial port.
There are several extant versions of USB. The basic architecture and APIs are the same regardless of version. As a software developer or end user, the ...
Get Java I/O, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.