Contents

IOUserHIDEventService

A service that parses HID report data into elements that you can use to dispatch events.

Declaration

class IOUserHIDEventService;

Overview

Subclass IOUserHIDEventService when you want to process incoming data from a HID device before dispatching it to the system. An event service collects the report from a device, parses it into individual data elements, and dispatches events based on the information in those elements. Create a custom event service when you need to synthesize custom event data, or when you need to process the existing data before dispatching the corresponding events.

To implement a custom event service, override the handleReport method and use it to iterate over the report contents and dispatch any relevant events. To get the report data, call the getElements method each time a new report arrives. (Also call that method in your service’s Start method to create the elements initially.) The method returns a set of IOHIDElement objects that contain a parsed version of the report data. Each time you call the method, the system updates the elements to incorporate the data from the latest report.

Specify the Driver’s Personality Information

When you subclass IOUserHIDEventService, update the IOKitPersonalities key of your driver extension’s Info.plist file with information to match your driver to appropriate hardware. For this class, always include the keys and values in the following table.

Key

Discussion

IOClass

The value AppleUserHIDEventService.

IOProviderClass

The provider class information. For HID interfaces, specify Iohidinterface.

IOUserClass

The name of your custom subclass.

Cfbundleidentifier

The bundle identifier of your driver.

You may add other keys to assist with the matching process. For example, you might include the VendorID, ProductID, PrimaryUsagePage, and PrimaryUsage keys to match against specific USB devices and HID usage types. The USB specification defines which keys to include when matching your driver to a USB device. For information about the specific key combinations, see Universal Serial Bus Common Class Specification at https://www.usb.org.

Topics

Running the Service

Responding to Input Reports

Dispatching Events to the System

Checking the Supported Usage

Performing Private Tasks

Instance Methods

See Also

Driver Interfaces