Introduction to USB Device Interface Guide
The I/O Kit provides a device interface mechanism that allows applications to communicate with and control hardware from outside the kernel. This document focuses on how to use that mechanism to create an application that detects the attachment of a USB device, communicates with it, and detects its detachment.
This document does not describe how to develop an in-kernel driver for a USB modem or networking device. If you need to do this, refer to the documentation and sample code listed in See Also.
Organization of This Document
This document contains the following chapters:
USB Device Overview provides an overview of USB device architecture and terminology and describes how USB devices are represented in OS X.
Working With USB Device Interfaces describes how to use the device interface mechanism to create a command-line tool that accesses a USB device.
Document Revision History lists the revisions of this document.
The ADC Reference Library contains several documents on device driver development for OS X and numerous sample drivers and applications.
Accessing Hardware From Applications describes various ways to access devices from outside the kernel, including the device interface mechanism provided by the I/O Kit. For an overview of the I/O Kit terms and concepts used in this document, read the chapter Device Access and the I/O Kit.
I/O Kit Framework Reference contains API reference for I/O Kit methods and functions and for specific device families.
OS X Man Pages provides access to existing reference documentation for BSD and POSIX functions and tools in a convenient HTML format.
The usb mailing list provides a forum for discussing technical issues relating to USB devices in OS X.
If you need to develop an in-kernel driver for a USB modem or networking device, refer to the following:
IOKit Fundamentals describes the architecture of the I/O Kit, the object-oriented framework for developing OS X device drivers.
ADC members can view the AppleUSBCDCDriver project in the source code for OS X v10.3.7 and later, available at Darwin Releases. To find the source code, select a version of OS X equal to or greater than v10.3.7 and click Source (choose the source for the PPC version, if there's a choice). This displays a new page, which lists the open source projects available for the version of OS X you've chosen. Scroll down to AppleUSBCDCDriver and click it to view the source. Be prepared to supply your ADC member name and password.
Additional code samples that demonstrate specific in-kernel driver programming techniques are included as part of the OS X Developer Tools installation package in
If you're ready to create a universal binary version of your USB device-access application to run in an Intel-based Macintosh, see Universal Binary Programming Guidelines. The Universal Binary Programming Guidelines describes the differences between the Intel and PowerPC architectures and provides tips for developing a universal binary.
If you are working with a device that complies with the USB mass storage specification but declares its device class to be vendor specific, see Mass Storage Device Driver Programming Guide for information on how to ensure the correct built-in driver loads for the device.
Apple provides additional USB information (including the OS X USB Debug Kits) at http://developer.apple.com/hardwaredrivers/usb/index.html.
A detailed description of the USB device specification is beyond the scope of this document—for more information, see Universal Serial Bus Specification Revision 2.0 available at http://www.usb.org.