USB: The Universal Serial Bus
Benjamin David Lunt
Available here, Amazon, Kindle version, or your favorite online book source
Please go to the bottom of this page and write a review. Thank you.
The 2nd Edition is now available. See this .pdf for what's new
Volume Eight of a series of books on Operating System Design
I have a blog about this and other similar items
See below for customer comments
View the Errata 1st Ed., 2nd Ed.
Visit my FaceBook page
I am still interested in your help. If you have a chance, please have a look at this page.
Have a look at my Figure Eight page that shows how to create your own USB Device.
Have a look at my ATTiny2313 device that doesn't "hard code" the LED's to the board. You can attach it to a bread board and use it as you please.
This book is for those who are building an operating system, writing embedded code, or just want to learn how to communicate with the USB hardware and attached devices directly through hardware programming.
This book will show you how to find and initialize each of the four major USB Host Controllers, set up USB stacks, and communicate with attached devices. It has detailed information and examples of each step required to accomplish this.
Detailed information for the UHCI, OHCI, EHCI, and the new Super Speed xHCI controller is easy to follow and understand.
Information in the book or on the CD-ROM may include
• quirks of different controllers
• quirks of different devices
• specific errors and "gotchas" to watch for
• step by step instructions to get a device's descriptor(s)
• Details and/or C Source code to:
• Find a USB controller on the PCI(e) bus using only the PCI hardware.
• Find information about the USB controller
• Find a device attached
• Retrieve the attached device's Device Descriptor
• Read from a USB Mass Storage Devices
• Read from a USB external Floppy Drive
• Parse the HID device descriptor
• Retrieve Mouse movement
• Retrieve Keypress information
• Print to a USB printer
• Set up and use an External Hub
Suggested information you will need prior to reading this book are readily available and may be included on the available companion CD-ROM, may include:
• Specification documents for the UHCI, OHCI, EHCI, and xHCI Host Controllers
• USB specification documents versions 1.1, 2.0, and 3.0
• USB HID specification
• Knowledge of system programming on an Intel 80x386 based system
• Knowledge of the C Language and an available C Compiler
• along with other system related knowledge
It is not required that you have extensive knowledge of USB or the PCI(e) bridge it resides on. This book explains in detail how to get started, even if you have little or no knowledge of this technology.
Amazon now has a "Look Inside" of the first few pages of the book including the Contents showing in a bit more detail what is referenced in the book.
The Companion CD-ROM
The companion CD-ROM will not be available with the purchase of the book via book outlets and online shopping.
However, with any form of proof of purchase, the CD-ROM can be sent to you as an .ISO image via email, or sent as a CD-ROM via USPS. (A small postage fee may be applied).
I can be contacted at fys [at] fysnet [dot] net.
 A proof of purchase would consist of, but not limited to:
- Confirmation email from seller, copied/pasted to a request email to the address
- Image of a register receipt sent as an attachment to the address above
- Randomly chosen chapter/page/paragraph/sentence-within-that-paragraph
combination (chosen by you)
I am just trying "to keep the honest honest". You know, once you have the book, I will send you the ISO. I don't question whether you have it or not. :-)
Table of Contents
1. Overview of the USB
2. The PCI Hardware
3. The UHCI Hardware
4. The UHCI Stack
5. The OHCI Hardware
6. The OHCI Stack
7. The EHCI Hardware
8. The EHCI Stack
9. The xHCI Hardware
10. The xHCI Stack
11. Device Enumeration with the UHCI Stack Frame
12. Device Enumeration with the OHCI Stack Frame
13. Device Enumeration with the EHCI Stack Frame
14. Device Enumeration with the xHCI
15. Using the USB Mouse
16. Using the USB Keyboard
17. Using the USB Mass Storage Device
18. Using the USB Floppy Storage Device
19. Using the USB External Hub
20. Using a USB Printer Device
21. Using a USB HUB on the xHCI Root Hub
22. Using a USB 3.0 Mass Storage Device
23. Using a USB Protocol Analyzer
24. The Human Interface Device
25. Using a USB Video Camera
26. Setting Up the USB Video Camera
27. The EHCI and ISO Transfers
Appendix A - Disc Contents
Appendix B - Included Utilities/Source Code
Appendix C - Tables and Figures
Appendix D - Notes for all Controller Types/Devices
Appendix E - Request Sense Return Data
Appendix F - Brief History of USB
Appendix G - xHCI TRB Types and Completion Codes
Appendix H - USB OTG (On The Go)
Appendix I - USB Class Codes
Appendix J - Device Firmware Upgrade
Appendix K - New Type C USB Connector
Appendix Q - Building a Simple USB Device
Appendix X - For More Information
A more detailed Table of Contents (pdf), stripped directly out of the book.
- "As I heard, USB is difficult, but your book makes it much easier", Robert Nagy
- "Wow, thank you very much for the prompt response and an excellent book!", Simon Gustavsson
- "The book is very well written and an excellent/practical supplement to the specifications (which get rather dry)", Jacob von Chorus
- "Can't wait to get deep into these. Thanks for publishing this series. The font and pageing formats are AWESOME.", Daniel de la Rosa
- Keep up the good work... I love the work that you have already done with the USB. No one explains things from a low level perspective anymore, that's why I am so glad I came across your OS series.", Michael Tindal
- "I have purchased your USB book and am very pleased with the layout and information. It is the best publication I have on the topic.", Gordon Simpson
- I have written OHCI based USB drivers for an embedded device (written in ARM assembler for an MCS8140 CPU), but was unfamiliar with the EHCI stack and needed to implement some high speed devices. Like most standards, the EHCI standard is written in a way that describes each piece of the jigsaw precisely, but makes it difficult to understand how the pieces fit together. Unlike the previous (and more expensive) book I purchased, your book has assisted tremendously.", Dave Mould
- "... let me thank you for [a] great book which is not only great from [a] technical point of view but is also a great and easy read as well. I'm looking forward to see[ing] the rest of [the] books from your OS development series.", A. Czarnowski.
- "I'm benifitting from it already", G. Curran.
- "The UHCI part was very informative", M. Kalme.
- "I appreciate the effort that you put into this project", M. Gonta.
- "Thank you", P. Wang.
- "I'm a hobbist working in a USB Stack for SGI Irix, and your book has been very helpful!! It's just what I was looking for!!", BSDero.
- "...it certainly looks promising as a complementary (and reassuring!) resource for some of the more complicated aspects of the USB...", cod3b453.
- "I bought your book [a] few days ago and I just can't tell how much I benefited from it already. Thanks for your inspiration and kindness.", Evan Ko.
- "I'm benifitting from it already.", Gertrude.
- "Thank you so much for your wonderful USB book, which will be of great assistance to me, and, I am sure, to many others.", Howard Levine.
- "Thank you very much for a great book.", Jordi Sanfeliu.
- "Great book!", Karl.
- "Thanks a lot for writing the book, I have barely read anything I am already enjoying it!", Lars Bokkers.
- "Great Job!", Loren Blaney.
- "I got the book on Friday and couldn't stop reading it :). Thank You for this book!", Madis Kalme.
- "Thank you for an excellent book. I received my copy of the book yesterday and I have been reading it since.", Markku Niemela.
- "It's great", Martin.
- "By the way, I can't wait for more books of this series, very informative and complete :)", Max.
- "Thanks for your great book.", Mike.
- "Very interesting and good complement to the USB specifications.", P. Regnier.
- "I have purchased your great book that covers details on the USB technology", Ralf.
- "This is a good book. Packed with useful information. I have already learned much from it.", Robert.
- "...ready to start delving into the intricate details of the USB system...", Ron.
- "Thank you for taking time to write that informative USB book.", Thomas Loepfe.
- "Thanks for the book.", Tom Ehlert.
- "Very nice book! Thanks very much!"
- "I am finding it fascinating...", Roger Ray
- "For starters, great book. I'm a USB newbie with a project to complete and your book has helped far more than any other source.", Larry Guertin
- "I've now read through it at speed to get an overview of its content and I'm deeply impressed at the amount of work that's gone into it. This is the book that will ensure that the hobby OS is still possible after (U)EFI leads to the extinction of the BIOS.", David Cooper
- "Thank you for taking the time to write this book", Florin
- "great book by the way :)", Kaz Baygan
- "I've just ordered your book, and am already enjoying it!", Oleg FInkelshteyn
- "I started looking for a good USB book, stumbled upon some reviews of your book, and thought 'this seems like the exact thing I need!'. What a great surprise when the book finally arrived.", Inaki Etxebarria