Introduction to Working With HID Class Device Interfaces
What Are HID Class Device Interfaces?
The device interface mechanism supported by the I/O Kit gives applications the ability to communicate with hardware from outside the kernel. This document describes how to use the device interface provided by the Human Interface Device (HID) family to access HID class devices (such as keyboards, mice, and uninterruptible power supplies) from applications running on OS X.
Who Should Read This Document?
You should read this document if you are an application developer who needs to write custom code to communicate with a HID class device from user space.
Organization of This Document
The document is divided into two main chapters:
USB HID Overview provides basic information about HID class devices and the OS X HID Manager.
Working With Legacy HID Class Device Interfaces briefly outlines the process of accessing a HID class device and then presents a detailed code sample illustrating this process by acquiring access to a joystick.
Although the sample code in this document has been checked for accuracy, it is not intended to meet the needs of a commercial application. For example, error handling is minimal and simply facilitates debugging of this code—you should develop your own techniques for detecting and handling errors. Therefore Apple does not recommend that you directly incorporate the entire sample program into a commercial application.
This document assumes you are familiar with the general I/O Kit and device interface information presented in Accessing Hardware From Applications. In particular, for definitions of I/O Kit terms used in this document such as matching dictionary, family, and driver, see the overview of I/O Kit terms and concepts in the chapter Accessing Hardware From Applications.
A detailed description of the HID class specification is beyond the scope of this document—for more information, including the complete listing of HID usage tables, visit the USB website at http://www.usb.org.
For API documentation, see the
IOHIDKeys.h entries in I/O Kit Framework Reference.