Skip to content

Instantly share code, notes, and snippets.

@chrispaynter
Forked from ArthurYidi/device properties.swift
Created December 29, 2020 20:56
Show Gist options
  • Save chrispaynter/9a5794547ace916883f9faff5703fd81 to your computer and use it in GitHub Desktop.
Save chrispaynter/9a5794547ace916883f9faff5703fd81 to your computer and use it in GitHub Desktop.
Get HID Device Properties
let keys = [kIOHIDTransportKey, kIOHIDVendorIDKey, kIOHIDVendorIDSourceKey, kIOHIDProductIDKey, kIOHIDVersionNumberKey, kIOHIDManufacturerKey, kIOHIDProductKey, kIOHIDSerialNumberKey, kIOHIDCountryCodeKey, kIOHIDStandardTypeKey, kIOHIDLocationIDKey, kIOHIDDeviceUsageKey, kIOHIDDeviceUsagePageKey, kIOHIDDeviceUsagePairsKey, kIOHIDPrimaryUsageKey, kIOHIDPrimaryUsagePageKey, kIOHIDMaxInputReportSizeKey, kIOHIDMaxOutputReportSizeKey, kIOHIDMaxFeatureReportSizeKey, kIOHIDReportIntervalKey, kIOHIDSampleIntervalKey, kIOHIDBatchIntervalKey, kIOHIDRequestTimeoutKey, kIOHIDReportDescriptorKey, kIOHIDResetKey, kIOHIDKeyboardLanguageKey, kIOHIDAltHandlerIdKey, kIOHIDBuiltInKey, kIOHIDDisplayIntegratedKey, kIOHIDProductIDMaskKey, kIOHIDProductIDArrayKey, kIOHIDPowerOnDelayNSKey, kIOHIDCategoryKey, kIOHIDMaxResponseLatencyKey, kIOHIDUniqueIDKey, kIOHIDPhysicalDeviceUniqueIDKey]
for key in keys {
if let prop = IOHIDDeviceGetProperty(device, key) {
print("\t" + key + ": \(prop)")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment