You are previewing Bootstrap Yourself with Linux-USB Stack: Design, Develop, Debug, and Validate Embedded USB.
O'Reilly logo
Bootstrap Yourself with Linux-USB Stack: Design, Develop, Debug, and Validate Embedded USB

Book Description

Learn to design, develop, and validate USB systems with ease, using this valuable resource that provides a detailed bootstrap session on the Linux-USB design and implementation. BOOTSTRAP YOURSELF WITH LINUX-USB STACK: DESIGN, DEVELOP, DEBUG, AND VALIDATE EMBEDDED USB SYSTEMS offers an in-depth tour of the Linux USB stack, clearly and meticulously explaining how to develop drivers for USB device and host controllers on Linux. It moves on to explore the interfaces and data structures of USB module with UML diagrams, concluding each chapter with a sample implementation that applies the information just covered. A comprehensive look at the various tools and methods available on Linux to validate a USB system is also provided. Using a clear, straightforward writing style, this will be a powerful tool for readers as they learn to develop a protocol stack with proper architecture and design, ultimately leading to better quality, maintainability, and testability.

Table of Contents

  1. Copyright
    1. Dedication
  2. Acknowledgments
  3. About the Author
  4. Introduction
    1. What You’ll Find in this Book
    2. Who this Book is for
    3. How this Book is Organized
    4. CD-ROM Downloads
  5. 1. USB and Linux: Introduction
    1. USB: The Path and the Market
      1. USB Hardware
        1. USB Transceiver
        2. Standalone USB Controller
        3. Integrated USB Controller
      2. USB Market
    2. Linux USB
    3. Summary
  6. 2. USB: An Overview
    1. USB System Architecture
      1. USB Host
        1. Client Software
        2. USB System Software
        3. Host Controller
      2. USB Device
        1. Function
        2. USB Logical Device
        3. USB Bus Interface
      3. Communication Flow
      4. Endpoints
      5. Pipes
    2. Enumeration
      1. Descriptors
    3. USB Transfers
      1. Control Transfer
      2. Bulk Transfer
      3. Interrupt Transfer
      4. Isochronous Transfer
    4. Terms to Remember
    5. Summary
    6. More Reading
  7. 3. Overview of the Linux USB Subsystem
    1. Linux USB Host Subsystem
      1. USB HCD Driver Menu
        1. Enable EHCI HCD Support
        2. Enable OHCI HCD Support
        3. Enable UHCI HCD Support
      2. USB Class Driver Menu
        1. Mass Storage Class
        2. Serial Class
        3. CDC Ethernet Support
      3. Miscellaneous Host Drivers
        1. Debug Infrastructure
        2. File Systems
        3. Power Management
        4. Test Infrastructure
    2. Linux USB Gadget Subsystem
    3. Summary
    4. More Reading
  8. I. USB Host
    1. 4. Linux USB Host Driver
      1. Overview of a General USB Host Stack Architecture
        1. Host Software
        2. USB Driver
        3. HCD
      2. Overview of Linux USB Host Stack Architecture
        1. usbcore
          1. Device Management
          2. Power Management
          3. USB Hub Driver
          4. USB Host Driver
          5. HCD Interfaces
        2. Linux USB HCD
      3. Summary
      4. More Reading
    2. 5. USB Device Notification
      1. Bootstrap: Notifier Chain
      2. Linux USB Notification
        1. Writing a Simple USB Notification-Subscriber
      3. Summary
      4. More Reading
    3. 6. Device File System
      1. Bootstrap Essentials: Virtual File System
      2. Linux USB Device File System
      3. Creating the Linux USB File System
      4. Summary
      5. More Reading
    4. 7. Power Management
      1. Bootstrap Essentials: Power Management
      2. Linux USB Power Management
      3. Setting up Linux-USB Power Management
      4. Summary
      5. More Reading
    5. 8. Hub
      1. Bootstrap Essentials: Linux USB Hub
      2. Linux USB Hub Framework
      3. Summary
      4. More Reading
    6. 9. Generic Driver
      1. Bootstrap Essentials: Linux USB Generic Driver
      2. Linux USB usbcore-generic Driver Framework
      3. Developing a USB Device Driver
      4. Summary
      5. More Reading
    7. 10. Host Driver for Embedded Controller
      1. Bootstrap Linux USB HCD
      2. Linux USB HCD
      3. Sample Implementation of USB HCD
      4. Summary
      5. More Reading
  9. II. USB Device
    1. 11. Linux USB Gadget Driver
      1. Overview of USB Device Stack Architecture
        1. Device Firmware Driver
        2. Chapter—9: Driver/USB Device Framework
        3. USB Class Driver
      2. Overview of Linux USB Gadget Driver Architecture
        1. USB Controller Driver
        2. Gadget Driver
        3. Class Driver
      3. Summary
      4. More Reading
    2. 12. Peripheral Device Controller Driver
      1. Bootstrap Essentials: Platform Driver
      2. Linux USB Peripheral Controller Driver
      3. USB Device Controller Driver
      4. Summary
      5. More Reading
    3. 13. Gadget Driver
      1. Bootstrap Essentials: Gadget Driver
        1. USB Gadget Data Structure and Methods
        2. USB Endpoint Data Structure and Methods
        3. Gadget Driver Data Structure and Methods
        4. USB Request Data Structure
        5. Gadget Driver Utility Functions
      2. Gadget Driver: Design
        1. gadget register
        2. gadget unregister
        3. USB Enumeration
        4. Power Management
        5. OUT Transfer
        6. IN Transfer
      3. Gadget Driver: Implementation
      4. Summary
      5. More Reading
    4. 14. Class Driver
      1. Bootstrap Essentials: Class Drivers
      2. Class Driver: Design
      3. Simple Composite Class Driver: Loopback
      4. Summary
      5. More Reading
  10. III. USB OTG
    1. 15. Linux USB OTG Driver
      1. Bootstrap Essentials: OTG Driver
      2. OTG Driver Framework
      3. OTG Framework: Sample
      4. Summary
      5. More Reading
  11. IV. Miscellaneous Linux USB Subsystems
    1. 16. USB Virtual File Systems
      1. Overview of usbfs
        1. usbfs: devices File
        2. Application Based on the devices File
          1. Graphical User Interface: USBView
          2. Command Line: usbtree
        3. usbfs: BBB/DDD Files
      2. Overview of sysfs
        1. Application of sysfs: /sys/bus/usb Files
      3. Overview of gadgetfs
        1. Application of gadgetfs: /dev/gadget Files
        2. Gadget Debug FS
      4. Summary
      5. More Reading
    2. 17. User Space USB Drivers
      1. Overview: USB User Mode Drivers
      2. USB User Mode Driver Using libusb
        1. Utilities Using libusb
          1. libptp
          2. usbutils
        2. A Simple USB Test Application Using libusb
      3. USB User Mode Driver Using UIO
        1. Bootstrap: Linux UIO
        2. UIO-Based USB Controller Driver
      4. User Mode Driver Using gadgetfs
      5. Summary
      6. More Reading
    3. 18. Debugging Using Linux USB
      1. USB Monitor: usbmon
        1. Bootstrap: USB Monitor
        2. USB Monitor Internals
        3. How to Use usbmon
      2. Debug Using usbfs_snoop
      3. Verbose Debugging for Host-Side USB
      4. Summary
      5. More Reading
    4. 19. Test Using Linux USB
      1. Linux USB Unit Test Driver
      2. Linux USB Functional Test
        1. Storage USB Gadget
        2. Serial USB Gadget
        3. USB Network Gadget
        4. HID (Human Interface Devices) USB Gadget
      3. Summary
      4. More Reading
  12. Appendix USB Regression Tool
    1. Overview of USB Regression Tool
    2. Script Definitions
      1. Generic USB Functions
      2. Utility Functions
    3. Summary