<!--
{
  "availability" : [
    "DriverKit: -",
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "HIDDriverKit",
  "identifier" : "/documentation/HIDDriverKit/IOUserHIDEventService",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "HIDDriverKit"
    ],
    "preciseIdentifier" : "c:@S@IOUserHIDEventService"
  },
  "title" : "IOUserHIDEventService"
}
-->

# IOUserHIDEventService

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

```
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`](/documentation/HIDDriverKit/IOUserHIDEventService/handleReport) method and use it to iterate over the report contents and dispatch any relevant events. To get the report data, call the [`getElements`](/documentation/HIDDriverKit/IOUserHIDEventService/getElements) method each time a new report arrives. (Also call that method in your service’s [`Start`](/documentation/HIDDriverKit/IOUserHIDEventService/Start) method to create the elements initially.) The method returns a set of [`IOHIDElement`](/documentation/HIDDriverKit/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 ``doc://com.apple.hiddriverkit/documentation/HIDDriverKit/IOHIDInterface``.|
|`IOUserClass`                                                                                             |The name of your custom subclass.                                                                                                      |
|<doc://com.apple.documentation/documentation/BundleResources/Information-Property-List/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

[`virtual bool init();`](/documentation/HIDDriverKit/IOUserHIDEventService/init)

Handles the basic initialization of the event service.

[`virtual kern_return_t Start(IOService *provider);`](/documentation/HIDDriverKit/IOUserHIDEventService/Start)

Starts the current event service and associates it with the specified provider object.

[`virtual bool handleStart(IOService *provider);`](/documentation/HIDDriverKit/IOUserHIDEventService/handleStart)

Performs additional initialization during the startup of the event service.

[`virtual kern_return_t Stop(IOService *provider);`](/documentation/HIDDriverKit/IOUserHIDEventService/Stop)

Stops the event service associated with the specified provider.

[`virtual void free();`](/documentation/HIDDriverKit/IOUserHIDEventService/free)

Performs any final cleanup for the service.

### Responding to Input Reports

[`virtual OSArray * getElements();`](/documentation/HIDDriverKit/IOUserHIDEventService/getElements)

Returns an array of elements that contain the parsed data from the HID device’s report.

[`virtual void handleReport(uint64_t timestamp, uint8_t *report, uint32_t reportLength, IOHIDReportType type, uint32_t reportID);`](/documentation/HIDDriverKit/IOUserHIDEventService/handleReport)

Converts an incoming device report into dispatchable events.

[`virtual void ReportAvailable(uint64_t timestamp, uint32_t reportID, uint32_t reportLength, IOHIDReportType type, IOMemoryDescriptor *report, OSAction *action);`](/documentation/HIDDriverKit/IOUserHIDEventService/ReportAvailable)

Notifies the event service that an updated report is available from the HID device.

### Dispatching Events to the System

[`virtual kern_return_t dispatchDigitizerStylusEvent(uint64_t timeStamp, IOHIDDigitizerStylusData *stylusData);`](/documentation/HIDDriverKit/IOUserHIDEventService/dispatchDigitizerStylusEvent)

Dispatches a digitizer stylus event to the system.

[`virtual kern_return_t dispatchDigitizerTouchEvent(uint64_t timeStamp, IOHIDDigitizerTouchData *touchData, uint32_t touchDataCount);`](/documentation/HIDDriverKit/IOUserHIDEventService/dispatchDigitizerTouchEvent)

Dispatches a digitizer touch event to the system.

### Checking the Supported Usage

[`virtual bool conformsTo(uint32_t usagePage, uint32_t usage);`](/documentation/HIDDriverKit/IOUserHIDEventService/conformsTo)

Returns a Boolean value that indicates whether the service conforms to the specified HID usage and page information.

### Performing Private Tasks

[`bool createReportPool();`](/documentation/HIDDriverKit/IOUserHIDEventService/createReportPool)

[`virtual void dispatchEvent(IOHIDEvent *event);`](/documentation/HIDDriverKit/IOUserHIDEventService/dispatchEvent)

Dispatches a HID event to the system.

### Instance Methods

[`virtual kern_return_t SetLEDState(uint32_t usagePage, uint32_t usage, bool on);`](/documentation/HIDDriverKit/IOUserHIDEventService/SetLEDState)

[`virtual kern_return_t SetProperties(OSDictionary *properties);`](/documentation/HIDDriverKit/IOUserHIDEventService/SetProperties)

[`virtual kern_return_t dispatchExtendedGameControllerEvent(uint64_t timeStamp, IOFixed dpadUp, IOFixed dpadDown, IOFixed dpadLeft, IOFixed dpadRight, IOFixed faceX, IOFixed faceY, IOFixed faceA, IOFixed faceB, IOFixed shoulderL1, IOFixed shoulderR1, IOFixed shoulderL2, IOFixed shoulderR2, IOFixed joystickX, IOFixed joystickY, IOFixed joystickZ, IOFixed joystickRz, bool thumbstickButtonLeft, bool thumbstickButtonRight, IOFixed buttonL4, IOFixed buttonR4, IOFixed buttonL5, IOFixed buttonR5, IOOptionBits options);`](/documentation/HIDDriverKit/IOUserHIDEventService/dispatchExtendedGameControllerEvent)

[`virtual kern_return_t dispatchExtendedGameControllerEventWithOptionalButtons(uint64_t timeStamp, IOFixed dpadUp, IOFixed dpadDown, IOFixed dpadLeft, IOFixed dpadRight, IOFixed faceX, IOFixed faceY, IOFixed faceA, IOFixed faceB, IOFixed shoulderL1, IOFixed shoulderR1, IOFixed shoulderL2, IOFixed shoulderR2, IOFixed joystickX, IOFixed joystickY, IOFixed joystickZ, IOFixed joystickRz, bool thumbstickButtonLeft, bool thumbstickButtonRight, IOFixed shoulderL4, IOFixed shoulderR4, IOFixed bottomM1, IOFixed bottomM2, IOFixed bottomM3, IOFixed bottomM4, IOOptionBits options);`](/documentation/HIDDriverKit/IOUserHIDEventService/dispatchExtendedGameControllerEventWithOptionalButtons)

[`virtual kern_return_t dispatchStandardGameControllerEvent(uint64_t timeStamp, IOFixed dpadUp, IOFixed dpadDown, IOFixed dpadLeft, IOFixed dpadRight, IOFixed faceX, IOFixed faceY, IOFixed faceA, IOFixed faceB, IOFixed shoulderL1, IOFixed shoulderR1, IOFixed shoulderL2, IOFixed shoulderR2, IOFixed joystickX, IOFixed joystickY, IOFixed joystickZ, IOFixed joystickRz, bool thumbstickButtonLeft, bool thumbstickButtonRight, IOOptionBits options);`](/documentation/HIDDriverKit/IOUserHIDEventService/dispatchStandardGameControllerEvent)

[`virtual kern_return_t processReport(uint64_t timestamp, uint64_t report, uint32_t reportLength, IOHIDReportType type, uint32_t reportID);`](/documentation/HIDDriverKit/IOUserHIDEventService/processReport)

## Relationships

### Inherits From

[`IOHIDEventService`](/documentation/HIDDriverKit/IOHIDEventService)

### Inherited By

[`IOUserHIDEventDriver`](/documentation/HIDDriverKit/IOUserHIDEventDriver)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)