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.”
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 Mac 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 Mac 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.
Sample Code > Hardware & Drivers > USB includes both application-level and in-kernel code samples. Of particular relevance to this document is the application-level sample USBPrivateDataSample.
Additional application-level code samples are included as part of the Mac OS X Developer Tools installation package in /Developer/Examples/IOKit/usb
.
Mac 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 Mac OS X.
If you need to develop an in-kernel driver for a USB modem or networking device, refer to the following:
I/O Kit Fundamentals describes the architecture of the I/O Kit, the object-oriented framework for developing Mac OS X device drivers.
ADC members can view the AppleUSBCDCDriver project in the source code for Mac OS X v10.3.7 and later, available at Darwin Releases. To find the source code, select a version of Mac 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 Mac 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 Mac OS X Developer Tools installation package in /Developer/Examples/Kernel/IOKit/usb
.
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, Second Edition. 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 Mac 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.
Last updated: 2007-09-04