An anonymous reader writes ""Have you ever wondered exactly what happens when you plug a USB device into one of those ports on your PC? How does the computer know that it is a keyboard, mouse, external hard drive, or camera? How does the computer know if it is a low-, full-, high-, or super-speed device? What is the difference anyway?
Sure, I can let the latest operating system do the work for me, but what if the platform I am targeting is very low on resources and I must write the drivers myself? How do I even attempt to read that file from my pen-drive, capture that picture from my USB camera, or even grab a key from this keyboard? Maybe like many others, I just want to do it myself anyway. Remember when we use to take dad’s drill apart to see how it worked?
These questions were asked many years ago when the first USB controllers were starting to show. What kind of controllers were used and how do I access them. Another mystery, the idea of how I could plug a mouse into the port and the computer would know what it was without ever installing a driver.
All of these questions inspired the book, “USB: The Universal Serial Bus”. Within the pages of this book, the author explains the ins and outs (pun intended) and how to communicate with an attached device, starting with programming the PCI(e) interface, all without any calls to the underlining operating system.
Once a controller is found and identified, the process to reset and start the controller, creating a USB stack, and finally sending and receiving packets from attached devices, is explained.
This book also has many examples, with detailed diagrams, of many different types of control, interrupt, and bulk delivery devices. Along with the body of text are side-notes, or tidbits if you will, quirks, errors, and less documented items about the USB, a brief history, code examples, and many tables and figures to explain the process from connection to an operational ready to use device.
The text is written so that the reader needs very little knowledge of operating system programming and shows how to accomplish the task at hand with no outside help. In other words, it is not dependent on any existing operating systems. The only operating system dependency is the ability to view the files on the included disc, and if the example code is executed, the ability boot the included FreeDOS (http://www.freedos.org/) floppy disk image.
What? I can hear it already, “who has a floppy disk drive?” The advantage we have today is the ability to emulate whole operating systems. When the author was doing research for the book, he wrote a majority of the core USB emulation code within the Bochs emulator (http://bochs.sourceforge.net/). The current code, thanks to others that have helped, will emulate the needed floppy drive, but more importantly, will emulate a UHCI controller interface along with the new xHCI Super Speed controller interface and a few attached devices. Of course it is not perfect, but it does do a fine job for those needing to use an emulator for their work.
In conclusion, if you ever wanted to work with the bare-bones USB hardware, for work or play, the text within this book will get you started, and started fairly quickly. It is easy to follow, shows step-by-step procedures to get a working USB stack in all four major controller interfaces, the UHCI, OHCI, EHCI, and the new Super Speed xHCI controller.
For more information, please visit:
or visit your online retail book store.""