Contents

kIOHIDGCSyntheticDeviceKey

A key that specifies whether the device is a game controller synthetic HID device.

Declaration

var kIOHIDGCSyntheticDeviceKey: String { get }

Mentioned in

Discussion

This key is present with a Boolean value of true on all game controller synthetic HID devices that the Game Controller framework creates.

If your app needs to exclude these synthetic HID devices from discovery by IOHIDManagerRef, IOServiceGetMatchingServices(_:_:_:), or IOServiceAddMatchingNotification(_:_:_:_:_:_:), include the kIOHIDGCSyntheticDeviceKey with a value of false in the matching criteria.

IOHIDManagerRef manager = IOHIDManagerCreate(kCFAllocatorDefault, kIOHIDManagerOptionNone);
IOHIDManagerSetDeviceMatching(manager, (__bridge CFDictionaryRef)@{
    @kIOProviderClassKey: @kIOHIDDeviceKey,
    @kIOHIDGCSyntheticDeviceKey: @(NO)
});

Your code can check whether an io_service_t or an IOHIDDeviceRef refers to a game controller synthetic HID device by querying the value of the kIOHIDGCSyntheticDeviceKey property.

if ( IOHIDDeviceGetProperty(device, CFSTR(kIOHIDGCSyntheticDeviceKey)) == kCFBooleanTrue ) {
    // This is a synthetic HID device.
}

See Also

Game Controller framework migration from IOKit