diff --git a/include/IOKit/IOKit.h b/include/IOKit/IOKit.h
new file mode 100644
index 0000000..4d9c38e
--- /dev/null
+++ b/include/IOKit/IOKit.h
@@ -0,0 +1 @@
+IOKitLib.h
\ No newline at end of file
diff --git a/include/IOKit/IOKitKeys.h b/include/IOKit/IOKitKeys.h
new file mode 100644
index 0000000..62395d5
--- /dev/null
+++ b/include/IOKit/IOKitKeys.h
@@ -0,0 +1,164 @@
+/*
+ * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ *
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ *
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
+ *
+ * Common symbol definitions for IOKit.
+ *
+ * HISTORY
+ *
+ */
+
+
+#ifndef _IOKIT_IOKITKEYS_H
+#define _IOKIT_IOKITKEYS_H
+
+// properties found in the registry root
+#define kIOKitBuildVersionKey "IOKitBuildVersion"
+#define kIOKitDiagnosticsKey "IOKitDiagnostics"
+ // a dictionary keyed by plane name
+#define kIORegistryPlanesKey "IORegistryPlanes"
+#define kIOCatalogueKey "IOCatalogue"
+
+// registry plane names
+#define kIOServicePlane "IOService"
+#define kIOPowerPlane "IOPower"
+#define kIODeviceTreePlane "IODeviceTree"
+#define kIOAudioPlane "IOAudio"
+#define kIOFireWirePlane "IOFireWire"
+#define kIOUSBPlane "IOUSB"
+
+// registry ID number
+#define kIORegistryEntryIDKey "IORegistryEntryID"
+
+// IOService class name
+#define kIOServiceClass "IOService"
+
+// IOResources class name
+#define kIOResourcesClass "IOResources"
+
+// IOService driver probing property names
+#define kIOClassKey "IOClass"
+#define kIOProbeScoreKey "IOProbeScore"
+#define kIOKitDebugKey "IOKitDebug"
+
+// IOService matching property names
+#define kIOProviderClassKey "IOProviderClass"
+#define kIONameMatchKey "IONameMatch"
+#define kIOPropertyMatchKey "IOPropertyMatch"
+#define kIOPathMatchKey "IOPathMatch"
+#define kIOLocationMatchKey "IOLocationMatch"
+#define kIOParentMatchKey "IOParentMatch"
+#define kIOResourceMatchKey "IOResourceMatch"
+#define kIOMatchedServiceCountKey "IOMatchedServiceCountMatch"
+
+#define kIONameMatchedKey "IONameMatched"
+
+#define kIOMatchCategoryKey "IOMatchCategory"
+#define kIODefaultMatchCategoryKey "IODefaultMatchCategory"
+
+// IOService default user client class, for loadable user clients
+#define kIOUserClientClassKey "IOUserClientClass"
+
+// key to find IOMappers
+#define kIOMapperIDKey "IOMapperID"
+
+#define kIOUserClientCrossEndianKey "IOUserClientCrossEndian"
+#define kIOUserClientCrossEndianCompatibleKey "IOUserClientCrossEndianCompatible"
+#define kIOUserClientSharedInstanceKey "IOUserClientSharedInstance"
+// diagnostic string describing the creating task
+#define kIOUserClientCreatorKey "IOUserClientCreator"
+
+// IOService notification types
+#define kIOPublishNotification "IOServicePublish"
+#define kIOFirstPublishNotification "IOServiceFirstPublish"
+#define kIOMatchedNotification "IOServiceMatched"
+#define kIOFirstMatchNotification "IOServiceFirstMatch"
+#define kIOTerminatedNotification "IOServiceTerminate"
+
+// IOService interest notification types
+#define kIOGeneralInterest "IOGeneralInterest"
+#define kIOBusyInterest "IOBusyInterest"
+#define kIOAppPowerStateInterest "IOAppPowerStateInterest"
+#define kIOPriorityPowerStateInterest "IOPriorityPowerStateInterest"
+
+#define kIOPlatformDeviceMessageKey "IOPlatformDeviceMessage"
+
+// IOService interest notification types
+#define kIOCFPlugInTypesKey "IOCFPlugInTypes"
+
+// properties found in services that implement command pooling
+#define kIOCommandPoolSizeKey "IOCommandPoolSize" // (OSNumber)
+
+// properties found in services that have transfer constraints
+#define kIOMaximumBlockCountReadKey "IOMaximumBlockCountRead" // (OSNumber)
+#define kIOMaximumBlockCountWriteKey "IOMaximumBlockCountWrite" // (OSNumber)
+#define kIOMaximumByteCountReadKey "IOMaximumByteCountRead" // (OSNumber)
+#define kIOMaximumByteCountWriteKey "IOMaximumByteCountWrite" // (OSNumber)
+#define kIOMaximumSegmentCountReadKey "IOMaximumSegmentCountRead" // (OSNumber)
+#define kIOMaximumSegmentCountWriteKey "IOMaximumSegmentCountWrite" // (OSNumber)
+#define kIOMaximumSegmentByteCountReadKey "IOMaximumSegmentByteCountRead" // (OSNumber)
+#define kIOMaximumSegmentByteCountWriteKey "IOMaximumSegmentByteCountWrite" // (OSNumber)
+#define kIOMinimumSegmentAlignmentByteCountKey "IOMinimumSegmentAlignmentByteCount" // (OSNumber)
+#define kIOMaximumSegmentAddressableBitCountKey "IOMaximumSegmentAddressableBitCount" // (OSNumber)
+
+// properties found in services that wish to describe an icon
+//
+// IOIcon =
+// {
+// CFBundleIdentifier = "com.example.driver.example";
+// IOBundleResourceFile = "example.icns";
+// };
+//
+// where IOBundleResourceFile is the filename of the resource
+
+#define kIOIconKey "IOIcon" // (OSDictionary)
+#define kIOBundleResourceFileKey "IOBundleResourceFile" // (OSString)
+
+#define kIOBusBadgeKey "IOBusBadge" // (OSDictionary)
+#define kIODeviceIconKey "IODeviceIcon" // (OSDictionary)
+
+// property of root that describes the machine's serial number as a string
+#define kIOPlatformSerialNumberKey "IOPlatformSerialNumber" // (OSString)
+
+// property of root that describes the machine's UUID as a string
+#define kIOPlatformUUIDKey "IOPlatformUUID" // (OSString)
+
+// IODTNVRAM property keys
+#define kIONVRAMDeletePropertyKey "IONVRAM-DELETE-PROPERTY"
+#define kIODTNVRAMPanicInfoKey "aapl,panic-info"
+
+// keys for complex boot information
+#define kIOBootDeviceKey "IOBootDevice" // dict | array of dicts
+#define kIOBootDevicePathKey "IOBootDevicePath" // arch-neutral OSString
+#define kIOBootDeviceSizeKey "IOBootDeviceSize" // OSNumber of bytes
+
+// keys for OS Version information
+#define kOSBuildVersionKey "OS Build Version"
+
+#endif /* ! _IOKIT_IOKITKEYS_H */
diff --git a/include/IOKit/IOKitLib.h b/include/IOKit/IOKitLib.h
new file mode 100644
index 0000000..6503923
--- /dev/null
+++ b/include/IOKit/IOKitLib.h
@@ -0,0 +1,1424 @@
+/*
+ * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_LICENSE_HEADER_START@
+ *
+ * The contents of this file constitute Original Code as defined in and
+ * are subject to the Apple Public Source License Version 1.1 (the
+ * "License"). You may not use this file except in compliance with the
+ * License. Please obtain a copy of the License at
+ * http://www.apple.com/publicsource and read it before using this file.
+ *
+ * This Original Code and all software distributed under the License are
+ * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
+ * License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * @APPLE_LICENSE_HEADER_END@
+ */
+/*
+ * HISTORY
+ *
+ */
+
+/*
+ * IOKit user library
+ */
+
+#ifndef _IOKIT_IOKITLIB_H
+#define _IOKIT_IOKITLIB_H
+
+#ifdef KERNEL
+#error This file is not for kernel use
+#endif
+
+#include
+#include
+
+#include
+#include
+
+#include
+#include
+#include
+
+#include "IOTypes.h"
+#include "IOKitKeys.h"
+
+#include "OSMessageNotification.h"
+
+#include
+
+__BEGIN_DECLS
+
+/*! @header IOKitLib
+IOKitLib implements non-kernel task access to common IOKit object types - IORegistryEntry, IOService, IOIterator etc. These functions are generic - families may provide API that is more specific.
+IOKitLib represents IOKit objects outside the kernel with the types io_object_t, io_registry_entry_t, io_service_t, & io_connect_t. Function names usually begin with the type of object they are compatible with - eg. IOObjectRelease can be used with any io_object_t. Inside the kernel, the c++ class hierarchy allows the subclasses of each object type to receive the same requests from user level clients, for example in the kernel, IOService is a subclass of IORegistryEntry, which means any of the IORegistryEntryXXX functions in IOKitLib may be used with io_service_t's as well as io_registry_t's. There are functions available to introspect the class of the kernel object which any io_object_t et al. represents.
+IOKit objects returned by all functions should be released with IOObjectRelease.
+*/
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+typedef struct IONotificationPort * IONotificationPortRef;
+
+
+/*! @typedef IOServiceMatchingCallback
+ @abstract Callback function to be notified of IOService publication.
+ @param refcon The refcon passed when the notification was installed.
+ @param iterator The notification iterator which now has new objects.
+*/
+typedef void
+(*IOServiceMatchingCallback)(
+ void * refcon,
+ io_iterator_t iterator );
+
+/*! @typedef IOServiceInterestCallback
+ @abstract Callback function to be notified of changes in state of an IOService.
+ @param refcon The refcon passed when the notification was installed.
+ @param service The IOService whose state has changed.
+ @param messageType A messageType enum, defined by IOKit/IOMessage.h or by the IOService's family.
+ @param messageArgument An argument for the message, dependent on the messageType.
+*/
+
+typedef void
+(*IOServiceInterestCallback)(
+ void * refcon,
+ io_service_t service,
+ uint32_t messageType,
+ void * messageArgument );
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*! @const kIOMasterPortDefault
+ @abstract The default mach port used to initiate communication with IOKit.
+ @discussion When specifying a master port to IOKit functions, the NULL argument indicates "use the default". This is a synonym for NULL, if you'd rather use a named constant.
+*/
+
+extern
+const mach_port_t kIOMasterPortDefault;
+
+/*! @function IOMasterPort
+ @abstract Returns the mach port used to initiate communication with IOKit.
+ @discussion Functions that don't specify an existing object require the IOKit master port to be passed. This function obtains that port.
+ @param bootstrapPort Pass MACH_PORT_NULL for the default.
+ @param masterPort The master port is returned.
+ @result A kern_return_t error code. */
+
+kern_return_t
+IOMasterPort( mach_port_t bootstrapPort,
+ mach_port_t * masterPort );
+
+
+/*! @function IONotificationPortCreate
+ @abstract Creates and returns a notification object for receiving IOKit notifications of new devices or state changes.
+ @discussion Creates the notification object to receive notifications from IOKit of new device arrivals or state changes. The notification object can be supply a CFRunLoopSource, or mach_port_t to be used to listen for events.
+ @param masterPort The master port obtained from IOMasterPort(). Pass kIOMasterPortDefault to look up the default master port.
+ @result A reference to the notification object. */
+
+IONotificationPortRef
+IONotificationPortCreate(
+ mach_port_t masterPort );
+
+/*! @function IONotificationPortDestroy
+ @abstract Destroys a notification object created with IONotificationPortCreate.
+ @param notify A reference to the notification object. */
+
+void
+IONotificationPortDestroy(
+ IONotificationPortRef notify );
+
+/*! @function IONotificationPortGetRunLoopSource
+ @abstract Returns a CFRunLoopSource to be used to listen for notifications.
+ @discussion A notification object may deliver notifications to a CFRunLoop client by adding the run loop source returned by this function to the run loop.
+ @param notify The notification object.
+ @result A CFRunLoopSourceRef for the notification object. */
+
+CFRunLoopSourceRef
+IONotificationPortGetRunLoopSource(
+ IONotificationPortRef notify );
+
+/*! @function IONotificationPortGetMachPort
+ @abstract Returns a mach_port to be used to listen for notifications.
+ @discussion A notification object may deliver notifications to a mach messaging client if they listen for messages on the port obtained from this function. Callbacks associated with the notifications may be delivered by calling IODispatchCalloutFromMessage with messages received
+ @param notify The notification object.
+ @result A mach_port for the notification object. */
+
+mach_port_t
+IONotificationPortGetMachPort(
+ IONotificationPortRef notify );
+
+/*! @function IODispatchCalloutFromMessage
+ @abstract Dispatches callback notifications from a mach message.
+ @discussion A notification object may deliver notifications to a mach messaging client, which should call this function to generate the callbacks associated with the notifications arriving on the port.
+ @param unused Not used, set to zero.
+ @param msg A pointer to the message received.
+ @param reference Pass the IONotificationPortRef for the object. */
+
+void
+IODispatchCalloutFromMessage(
+ void *unused,
+ mach_msg_header_t *msg,
+ void *reference );
+
+/*! @function IOCreateReceivePort
+ @abstract Creates and returns a mach port suitable for receiving IOKit messages of the specified type.
+ @discussion In the future IOKit may use specialized messages and ports
+ instead of the standard ports created by mach_port_allocate(). Use this
+ function instead of mach_port_allocate() to ensure compatibility with future
+ revisions of IOKit.
+ @param msgType Type of message to be sent to this port
+ (kOSNotificationMessageID or kOSAsyncCompleteMessageID)
+ @param recvPort The created port is returned.
+ @result A kern_return_t error code. */
+
+kern_return_t
+IOCreateReceivePort( uint32_t msgType, mach_port_t * recvPort );
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * IOObject
+ */
+
+/*! @function IOObjectRelease
+ @abstract Releases an object handle previously returned by IOKitLib.
+ @discussion All objects returned by IOKitLib should be released with this function when access to them is no longer needed. Using the object after it has been released may or may not return an error, depending on how many references the task has to the same object in the kernel.
+ @param object The IOKit object to release.
+ @result A kern_return_t error code. */
+
+kern_return_t
+IOObjectRelease(
+ io_object_t object );
+
+/*! @function IOObjectRetain
+ @abstract Retains an object handle previously returned by IOKitLib.
+ @discussion Gives the caller an additional reference to an existing object handle previously returned by IOKitLib.
+ @param object The IOKit object to retain.
+ @result A kern_return_t error code. */
+
+kern_return_t
+IOObjectRetain(
+ io_object_t object );
+
+/*! @function IOObjectGetClass
+ @abstract Return the class name of an IOKit object.
+ @discussion This function uses the OSMetaClass system in the kernel to derive the name of the class the object is an instance of.
+ @param object The IOKit object.
+ @param className Caller allocated buffer to receive the name string.
+ @result A kern_return_t error code. */
+
+kern_return_t
+IOObjectGetClass(
+ io_object_t object,
+ io_name_t className );
+
+/*! @function CFStringRef IOObjectCopyClass
+ @abstract Return the class name of an IOKit object.
+ @discussion This function does the same thing as IOObjectGetClass, but returns the result as a CFStringRef.
+ @param object The IOKit object.
+ @result The resulting CFStringRef. This should be released by the caller. If a valid object is not passed in, then NULL is returned.*/
+
+CFStringRef
+IOObjectCopyClass(io_object_t object)
+AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+
+/*! @function CFStringRef IOObjectCopySuperclassForClass
+ @abstract Return the superclass name of the given class.
+ @discussion This function uses the OSMetaClass system in the kernel to derive the name of the superclass of the class.
+ @param classname The name of the class as a CFString.
+ @result The resulting CFStringRef. This should be released by the caller. If there is no superclass, or a valid class name is not passed in, then NULL is returned.*/
+
+CFStringRef
+IOObjectCopySuperclassForClass(CFStringRef classname)
+AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+
+/*! @function CFStringRef IOObjectCopyBundleIdentifierForClass
+ @abstract Return the bundle identifier of the given class.
+ @discussion This function uses the OSMetaClass system in the kernel to derive the name of the kmod, which is the same as the bundle identifier.
+ @param classname The name of the class as a CFString.
+ @result The resulting CFStringRef. This should be released by the caller. If a valid class name is not passed in, then NULL is returned.*/
+
+CFStringRef
+IOObjectCopyBundleIdentifierForClass(CFStringRef classname)
+AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+
+/*! @function IOObjectConformsTo
+ @abstract Performs an OSDynamicCast operation on an IOKit object.
+ @discussion This function uses the OSMetaClass system in the kernel to determine if the object will dynamic cast to a class, specified as a C-string. In other words, if the object is of that class or a subclass.
+ @param object An IOKit object.
+ @param className The name of the class, as a C-string.
+ @result If the object handle is valid, and represents an object in the kernel that dynamic casts to the class true is returned, otherwise false. */
+
+boolean_t
+IOObjectConformsTo(
+ io_object_t object,
+ const io_name_t className );
+
+/*! @function IOObjectIsEqualTo
+ @abstract Checks two object handles to see if they represent the same kernel object.
+ @discussion If two object handles are returned by IOKitLib functions, this function will compare them to see if they represent the same kernel object.
+ @param object An IOKit object.
+ @param anObject Another IOKit object.
+ @result If both object handles are valid, and represent the same object in the kernel true is returned, otherwise false. */
+
+boolean_t
+IOObjectIsEqualTo(
+ io_object_t object,
+ io_object_t anObject );
+
+/*! @function IOObjectGetRetainCount
+ @abstract Returns kernel retain count of an IOKit object.
+ @discussion This function may be used in diagnostics to determine the current retain count of the kernel object.
+ @param object An IOKit object.
+ @result If the object handle is valid, the kernel objects retain count is returned, otherwise zero is returned. */
+
+uint32_t
+IOObjectGetRetainCount(
+ io_object_t object );
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * IOIterator, subclass of IOObject
+ */
+
+/*! @function IOIteratorNext
+ @abstract Returns the next object in an iteration.
+ @discussion This function returns the next object in an iteration, or zero if no more remain or the iterator is invalid.
+ @param iterator An IOKit iterator handle.
+ @result If the iterator handle is valid, the next element in the iteration is returned, otherwise zero is returned. The element should be released by the caller when it is finished. */
+
+io_object_t
+IOIteratorNext(
+ io_iterator_t iterator );
+
+/*! @function IOIteratorReset
+ @abstract Resets an iteration back to the beginning.
+ @discussion If an iterator is invalid, or if the caller wants to start over, IOIteratorReset will set the iteration back to the beginning.
+ @param iterator An IOKit iterator handle. */
+
+void
+IOIteratorReset(
+ io_iterator_t iterator );
+
+/*! @function IOIteratorIsValid
+ @abstract Checks an iterator is still valid.
+ @discussion Some iterators will be made invalid if changes are made to the structure they are iterating over. This function checks the iterator is still valid and should be called when IOIteratorNext returns zero. An invalid iterator can be reset and the iteration restarted.
+ @param iterator An IOKit iterator handle.
+ @result True if the iterator handle is valid, otherwise false is returned. */
+
+boolean_t
+IOIteratorIsValid(
+ io_iterator_t iterator );
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * IOService, subclass of IORegistryEntry
+ */
+
+/*!
+ @function IOServiceGetMatchingService
+ @abstract Look up a registered IOService object that matches a matching dictionary.
+ @discussion This is the preferred method of finding IOService objects currently registered by IOKit (that is, objects that have had their registerService() methods invoked). To find IOService objects that aren't yet registered, use an iterator as created by IORegistryEntryCreateIterator(). IOServiceAddMatchingNotification can also supply this information and install a notification of new IOServices. The matching information used in the matching dictionary may vary depending on the class of service being looked up.
+ @param masterPort The master port obtained from IOMasterPort(). Pass kIOMasterPortDefault to look up the default master port.
+ @param matching A CF dictionary containing matching information, of which one reference is always consumed by this function (Note prior to the Tiger release there was a small chance that the dictionary might not be released if there was an error attempting to serialize the dictionary). IOKitLib can construct matching dictionaries for common criteria with helper functions such as IOServiceMatching, IOServiceNameMatching, IOBSDNameMatching, IOOpenFirmwarePathMatching.
+ @result The first service matched is returned on success. The service must be released by the caller.
+ */
+
+io_service_t
+IOServiceGetMatchingService(
+ mach_port_t masterPort,
+ CFDictionaryRef matching );
+
+/*! @function IOServiceGetMatchingServices
+ @abstract Look up registered IOService objects that match a matching dictionary.
+ @discussion This is the preferred method of finding IOService objects currently registered by IOKit (that is, objects that have had their registerService() methods invoked). To find IOService objects that aren't yet registered, use an iterator as created by IORegistryEntryCreateIterator(). IOServiceAddMatchingNotification can also supply this information and install a notification of new IOServices. The matching information used in the matching dictionary may vary depending on the class of service being looked up.
+ @param masterPort The master port obtained from IOMasterPort(). Pass kIOMasterPortDefault to look up the default master port.
+ @param matching A CF dictionary containing matching information, of which one reference is always consumed by this function (Note prior to the Tiger release there was a small chance that the dictionary might not be released if there was an error attempting to serialize the dictionary). IOKitLib can construct matching dictionaries for common criteria with helper functions such as IOServiceMatching, IOServiceNameMatching, IOBSDNameMatching, IOOpenFirmwarePathMatching.
+ @param existing An iterator handle is returned on success, and should be released by the caller when the iteration is finished.
+ @result A kern_return_t error code. */
+
+kern_return_t
+IOServiceGetMatchingServices(
+ mach_port_t masterPort,
+ CFDictionaryRef matching,
+ io_iterator_t * existing );
+
+
+kern_return_t
+IOServiceAddNotification(
+ mach_port_t masterPort,
+ const io_name_t notificationType,
+ CFDictionaryRef matching,
+ mach_port_t wakePort,
+ uintptr_t reference,
+ io_iterator_t * notification ) DEPRECATED_ATTRIBUTE;
+
+/*! @function IOServiceAddMatchingNotification
+ @abstract Look up registered IOService objects that match a matching dictionary, and install a notification request of new IOServices that match.
+ @discussion This is the preferred method of finding IOService objects that may arrive at any time. The type of notification specifies the state change the caller is interested in, on IOService's that match the match dictionary. Notification types are identified by name, and are defined in IOKitKeys.h. The matching information used in the matching dictionary may vary depending on the class of service being looked up.
+ @param notifyPort A IONotificationPortRef object that controls how messages will be sent when the armed notification is fired. When the notification is delivered, the io_iterator_t representing the notification should be iterated through to pick up all outstanding objects. When the iteration is finished the notification is rearmed. See IONotificationPortCreate.
+ @param notificationType A notification type from IOKitKeys.h
+ kIOPublishNotification Delivered when an IOService is registered.
+ kIOFirstPublishNotification Delivered when an IOService is registered, but only once per IOService instance. Some IOService's may be reregistered when their state is changed.
+ kIOMatchedNotification Delivered when an IOService has had all matching drivers in the kernel probed and started.
+ kIOFirstMatchNotification Delivered when an IOService has had all matching drivers in the kernel probed and started, but only once per IOService instance. Some IOService's may be reregistered when their state is changed.
+ kIOTerminatedNotification Delivered after an IOService has been terminated.
+ @param matching A CF dictionary containing matching information, of which one reference is always consumed by this function (Note prior to the Tiger release there was a small chance that the dictionary might not be released if there was an error attempting to serialize the dictionary). IOKitLib can construct matching dictionaries for common criteria with helper functions such as IOServiceMatching, IOServiceNameMatching, IOBSDNameMatching, IOOpenFirmwarePathMatching.
+ @param callback A callback function called when the notification fires.
+ @param refCon A reference constant for the callbacks use.
+ @param notification An iterator handle is returned on success, and should be released by the caller when the notification is to be destroyed. The notification is armed when the iterator is emptied by calls to IOIteratorNext - when no more objects are returned, the notification is armed. Note the notification is not armed when first created.
+ @result A kern_return_t error code. */
+
+kern_return_t
+IOServiceAddMatchingNotification(
+ IONotificationPortRef notifyPort,
+ const io_name_t notificationType,
+ CFDictionaryRef matching,
+ IOServiceMatchingCallback callback,
+ void * refCon,
+ io_iterator_t * notification );
+
+/*! @function IOServiceAddInterestNotification
+ @abstract Register for notification of state changes in an IOService.
+ @discussion IOService objects deliver notifications of their state changes to their clients via the IOService::message API, and to other interested parties including callers of this function. Message type s are defined IOKit/IOMessage.h.
+ @param notifyPort A IONotificationPortRef object that controls how messages will be sent when the notification is fired. See IONotificationPortCreate.
+ @param interestType A notification type from IOKitKeys.h
+ kIOGeneralInterest General state changes delivered via the IOService::message API.
+ kIOBusyInterest Delivered when the IOService changes its busy state to or from zero. The message argument contains the new busy state causing the notification.
+ @param callback A callback function called when the notification fires, with messageType and messageArgument for the state change.
+ @param refCon A reference constant for the callbacks use.
+ @param notification An object handle is returned on success, and should be released by the caller when the notification is to be destroyed.
+ @result A kern_return_t error code. */
+
+kern_return_t
+IOServiceAddInterestNotification(
+ IONotificationPortRef notifyPort,
+ io_service_t service,
+ const io_name_t interestType,
+ IOServiceInterestCallback callback,
+ void * refCon,
+ io_object_t * notification );
+
+/*! @function IOServiceMatchPropertyTable
+ @abstract Match an IOService objects with matching dictionary.
+ @discussion This function calls the matching method of an IOService object and returns the boolean result.
+ @param service The IOService object to match.
+ @param matching A CF dictionary containing matching information. IOKitLib can construct matching dictionaries for common criteria with helper functions such as IOServiceMatching, IOServiceNameMatching, IOBSDNameMatching, IOOpenFirmwarePathMatching.
+ @param matches The boolean result is returned.
+ @result A kern_return_t error code. */
+
+kern_return_t
+IOServiceMatchPropertyTable(
+ io_service_t service,
+ CFDictionaryRef matching,
+ boolean_t * matches );
+
+/*! @function IOServiceGetBusyState
+ @abstract Returns the busyState of an IOService.
+ @discussion Many activities in IOService are asynchronous. When registration, matching, or termination is in progress on an IOService, its busyState is increased by one. Change in busyState to or from zero also changes the IOService's provider's busyState by one, which means that an IOService is marked busy when any of the above activities is ocurring on it or any of its clients.
+ @param service The IOService whose busyState to return.
+ @param busyState The busyState count is returned.
+ @result A kern_return_t error code. */
+
+kern_return_t
+IOServiceGetBusyState(
+ io_service_t service,
+ uint32_t * busyState );
+
+/*! @function IOServiceWaitQuiet
+ @abstract Wait for an IOService's busyState to be zero.
+ @discussion Blocks the caller until an IOService is non busy, see IOServiceGetBusyState.
+ @param service The IOService wait on.
+ @param waitTime Specifies a maximum time to wait.
+ @result Returns an error code if mach synchronization primitives fail, kIOReturnTimeout, or kIOReturnSuccess. */
+
+kern_return_t
+IOServiceWaitQuiet(
+ io_service_t service,
+ mach_timespec_t * waitTime );
+
+/*! @function IOKitGetBusyState
+ @abstract Returns the busyState of all IOServices.
+ @discussion Many activities in IOService are asynchronous. When registration, matching, or termination is in progress on an IOService, its busyState is increased by one. Change in busyState to or from zero also changes the IOService's provider's busyState by one, which means that an IOService is marked busy when any of the above activities is ocurring on it or any of its clients. IOKitGetBusyState returns the busy state of the root of the service plane which reflects the busy state of all IOServices.
+ @param masterPort The master port obtained from IOMasterPort(). Pass kIOMasterPortDefault to look up the default master port.
+ @param busyState The busyState count is returned.
+ @result A kern_return_t error code. */
+
+kern_return_t
+IOKitGetBusyState(
+ mach_port_t masterPort,
+ uint32_t * busyState );
+
+/*! @function IOKitWaitQuiet
+ @abstract Wait for a all IOServices' busyState to be zero.
+ @discussion Blocks the caller until all IOServices are non busy, see IOKitGetBusyState.
+ @param masterPort The master port obtained from IOMasterPort(). Pass kIOMasterPortDefault to look up the default master port.
+ @param waitTime Specifies a maximum time to wait.
+ @result Returns an error code if mach synchronization primitives fail, kIOReturnTimeout, or kIOReturnSuccess. */
+
+kern_return_t
+IOKitWaitQuiet(
+ mach_port_t masterPort,
+ mach_timespec_t * waitTime );
+
+/*! @function IOServiceOpen
+ @abstract A request to create a connection to an IOService.
+ @discussion A non kernel client may request a connection be opened via the IOServiceOpen() library function, which will call IOService::newUserClient in the kernel. The rules & capabilities of user level clients are family dependent, the default IOService implementation returns kIOReturnUnsupported.
+ @param service The IOService object to open a connection to, usually obtained via the IOServiceGetMatchingServices or IOServiceAddNotification APIs.
+ @param owningTask The mach task requesting the connection.
+ @param type A constant specifying the type of connection to be created, interpreted only by the IOService's family.
+ @param connect An io_connect_t handle is returned on success, to be used with the IOConnectXXX APIs. It should be destroyed with IOServiceClose().
+ @result A return code generated by IOService::newUserClient. */
+
+kern_return_t
+IOServiceOpen(
+ io_service_t service,
+ task_port_t owningTask,
+ uint32_t type,
+ io_connect_t * connect );
+
+/*! @function IOServiceRequestProbe
+ @abstract A request to rescan a bus for device changes.
+ @discussion A non kernel client may request a bus or controller rescan for added or removed devices, if the bus family does automatically notice such changes. For example, SCSI bus controllers do not notice device changes. The implementation of this routine is family dependent, and the default IOService implementation returns kIOReturnUnsupported.
+ @param service The IOService object to request a rescan, usually obtained via the IOServiceGetMatchingServices or IOServiceAddNotification APIs.
+ @param options An options mask, interpreted only by the IOService's family.
+ @result A return code generated by IOService::requestProbe. */
+
+kern_return_t
+IOServiceRequestProbe(
+ io_service_t service,
+ uint32_t options );
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * IOService connection
+ */
+
+/*! @function IOServiceClose
+ @abstract Close a connection to an IOService and destroy the connect handle.
+ @discussion A connection created with the IOServiceOpen should be closed when the connection is no longer to be used with IOServiceClose.
+ @param connect The connect handle created by IOServiceOpen. It will be destroyed by this function, and should not be released with IOObjectRelease.
+ @result A kern_return_t error code. */
+
+kern_return_t
+IOServiceClose(
+ io_connect_t connect );
+
+/*! @function IOConnectAddRef
+ @abstract Adds a reference to the connect handle.
+ @discussion Adds a reference to the connect handle.
+ @param connect The connect handle created by IOServiceOpen.
+ @result A kern_return_t error code. */
+
+kern_return_t
+IOConnectAddRef(
+ io_connect_t connect );
+
+/*! @function IOConnectRelease
+ @abstract Remove a reference to the connect handle.
+ @discussion Removes a reference to the connect handle. If the last reference is removed an implicit IOServiceClose is performed.
+ @param connect The connect handle created by IOServiceOpen.
+ @result A kern_return_t error code. */
+
+kern_return_t
+IOConnectRelease(
+ io_connect_t connect );
+
+/*! @function IOConnectGetService
+ @abstract Returns the IOService a connect handle was opened on.
+ @discussion Finds the service object a connection was opened on.
+ @param connect The connect handle created by IOServiceOpen.
+ @param service On succes, the service handle the connection was opened on, which should be released with IOObjectRelease.
+ @result A kern_return_t error code. */
+
+kern_return_t
+IOConnectGetService(
+ io_connect_t connect,
+ io_service_t * service );
+
+/*! @function IOConnectSetNotificationPort
+ @abstract Set a port to receive family specific notifications.
+ @discussion This is a generic method to pass a mach port send right to be be used by family specific notifications.
+ @param connect The connect handle created by IOServiceOpen.
+ @param type The type of notification requested, not interpreted by IOKit and family defined.
+ @param port The port to which to send notifications.
+ @param reference Some families may support passing a reference parameter for the callers use with the notification.
+ @result A kern_return_t error code. */
+
+kern_return_t
+IOConnectSetNotificationPort(
+ io_connect_t connect,
+ uint32_t type,
+ mach_port_t port,
+ uintptr_t reference );
+
+/*! @function IOConnectMapMemory
+ @abstract Map hardware or shared memory into the caller's task.
+ @discussion This is a generic method to create a mapping in the callers task. The family will interpret the type parameter to determine what sort of mapping is being requested. Cache modes and placed mappings may be requested by the caller.
+ @param connect The connect handle created by IOServiceOpen.
+ @param memoryType What is being requested to be mapped, not interpreted by IOKit and family defined. The family may support physical hardware or shared memory mappings.
+ @param intoTask The task port for the task in which to create the mapping. This may be different to the task which the opened the connection.
+ @param atAddress An in/out parameter - if the kIOMapAnywhere option is not set, the caller should pass the address where it requests the mapping be created, otherwise nothing need to set on input. The address of the mapping created is passed back on sucess.
+ @param ofSize The size of the mapping created is passed back on success.
+ @result A kern_return_t error code. */
+
+#if !__LP64__
+kern_return_t
+IOConnectMapMemory(
+ io_connect_t connect,
+ uint32_t memoryType,
+ task_port_t intoTask,
+ vm_address_t *atAddress,
+ vm_size_t *ofSize,
+ IOOptionBits options );
+
+kern_return_t IOConnectMapMemory64
+#else
+kern_return_t IOConnectMapMemory
+#endif
+ (io_connect_t connect,
+ uint32_t memoryType,
+ task_port_t intoTask,
+ mach_vm_address_t *atAddress,
+ mach_vm_size_t *ofSize,
+ IOOptionBits options );
+
+/*! @function IOConnectUnmapMemory
+ @abstract Remove a mapping made with IOConnectMapMemory.
+ @discussion This is a generic method to remove a mapping in the callers task.
+ @param connect The connect handle created by IOServiceOpen.
+ @param memoryType The memory type originally requested in IOConnectMapMemory.
+ @param intoTask The task port for the task in which to remove the mapping. This may be different to the task which the opened the connection.
+ @param atAddress The address of the mapping to be removed.
+ @result A kern_return_t error code. */
+
+#if !__LP64__
+kern_return_t
+IOConnectUnmapMemory(
+ io_connect_t connect,
+ uint32_t memoryType,
+ task_port_t fromTask,
+ vm_address_t atAddress );
+
+kern_return_t IOConnectUnmapMemory64
+#else
+kern_return_t IOConnectUnmapMemory
+#endif
+ (io_connect_t connect,
+ uint32_t memoryType,
+ task_port_t fromTask,
+ mach_vm_address_t atAddress );
+
+/*! @function IOConnectSetCFProperties
+ @abstract Set CF container based properties on a connection.
+ @discussion This is a generic method to pass a CF container of properties to the connection. The properties are interpreted by the family and commonly represent configuration settings, but may be interpreted as anything.
+ @param connect The connect handle created by IOServiceOpen.
+ @param properties A CF container - commonly a CFDictionary but this is not enforced. The container should consist of objects which are understood by IOKit - these are currently : CFDictionary, CFArray, CFSet, CFString, CFData, CFNumber, CFBoolean, and are passed in the kernel as the corresponding OSDictionary etc. objects.
+ @result A kern_return_t error code returned by the family. */
+
+kern_return_t
+IOConnectSetCFProperties(
+ io_connect_t connect,
+ CFTypeRef properties );
+
+/*! @function IOConnectSetCFProperty
+ @abstract Set a CF container based property on a connection.
+ @discussion This is a generic method to pass a CF property to the connection. The property is interpreted by the family and commonly represent configuration settings, but may be interpreted as anything.
+ @param connect The connect handle created by IOServiceOpen.
+ @param propertyName The name of the property as a CFString.
+ @param property A CF container - should consist of objects which are understood by IOKit - these are currently : CFDictionary, CFArray, CFSet, CFString, CFData, CFNumber, CFBoolean, and are passed in the kernel as the corresponding OSDictionary etc. objects.
+ @result A kern_return_t error code returned by the object. */
+
+kern_return_t
+IOConnectSetCFProperty(
+ io_connect_t connect,
+ CFStringRef propertyName,
+ CFTypeRef property );
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+// Combined LP64 & ILP32 Extended IOUserClient::externalMethod
+
+kern_return_t
+IOConnectCallMethod(
+ mach_port_t connection, // In
+ uint32_t selector, // In
+ const uint64_t *input, // In
+ uint32_t inputCnt, // In
+ const void *inputStruct, // In
+ size_t inputStructCnt, // In
+ uint64_t *output, // Out
+ uint32_t *outputCnt, // In/Out
+ void *outputStruct, // Out
+ size_t *outputStructCnt) // In/Out
+AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+
+kern_return_t
+IOConnectCallAsyncMethod(
+ mach_port_t connection, // In
+ uint32_t selector, // In
+ mach_port_t wake_port, // In
+ uint64_t *reference, // In
+ uint32_t referenceCnt, // In
+ const uint64_t *input, // In
+ uint32_t inputCnt, // In
+ const void *inputStruct, // In
+ size_t inputStructCnt, // In
+ uint64_t *output, // Out
+ uint32_t *outputCnt, // In/Out
+ void *outputStruct, // Out
+ size_t *outputStructCnt) // In/Out
+AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+
+kern_return_t
+IOConnectCallStructMethod(
+ mach_port_t connection, // In
+ uint32_t selector, // In
+ const void *inputStruct, // In
+ size_t inputStructCnt, // In
+ void *outputStruct, // Out
+ size_t *outputStructCnt) // In/Out
+AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+
+kern_return_t
+IOConnectCallAsyncStructMethod(
+ mach_port_t connection, // In
+ uint32_t selector, // In
+ mach_port_t wake_port, // In
+ uint64_t *reference, // In
+ uint32_t referenceCnt, // In
+ const void *inputStruct, // In
+ size_t inputStructCnt, // In
+ void *outputStruct, // Out
+ size_t *outputStructCnt) // In/Out
+AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+
+kern_return_t
+IOConnectCallScalarMethod(
+ mach_port_t connection, // In
+ uint32_t selector, // In
+ const uint64_t *input, // In
+ uint32_t inputCnt, // In
+ uint64_t *output, // Out
+ uint32_t *outputCnt) // In/Out
+AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+
+kern_return_t
+IOConnectCallAsyncScalarMethod(
+ mach_port_t connection, // In
+ uint32_t selector, // In
+ mach_port_t wake_port, // In
+ uint64_t *reference, // In
+ uint32_t referenceCnt, // In
+ const uint64_t *input, // In
+ uint32_t inputCnt, // In
+ uint64_t *output, // Out
+ uint32_t *outputCnt) // In/Out
+AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+kern_return_t
+IOConnectTrap0(io_connect_t connect,
+ uint32_t index );
+
+kern_return_t
+IOConnectTrap1(io_connect_t connect,
+ uint32_t index,
+ uintptr_t p1 );
+
+kern_return_t
+IOConnectTrap2(io_connect_t connect,
+ uint32_t index,
+ uintptr_t p1,
+ uintptr_t p2);
+
+kern_return_t
+IOConnectTrap3(io_connect_t connect,
+ uint32_t index,
+ uintptr_t p1,
+ uintptr_t p2,
+ uintptr_t p3);
+
+kern_return_t
+IOConnectTrap4(io_connect_t connect,
+ uint32_t index,
+ uintptr_t p1,
+ uintptr_t p2,
+ uintptr_t p3,
+ uintptr_t p4);
+
+kern_return_t
+IOConnectTrap5(io_connect_t connect,
+ uint32_t index,
+ uintptr_t p1,
+ uintptr_t p2,
+ uintptr_t p3,
+ uintptr_t p4,
+ uintptr_t p5);
+
+kern_return_t
+IOConnectTrap6(io_connect_t connect,
+ uint32_t index,
+ uintptr_t p1,
+ uintptr_t p2,
+ uintptr_t p3,
+ uintptr_t p4,
+ uintptr_t p5,
+ uintptr_t p6);
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*! @function IOConnectAddClient
+ @abstract Inform a connection of a second connection.
+ @discussion This is a generic method to inform a family connection of a second connection, and is rarely used.
+ @param connect The connect handle created by IOServiceOpen.
+ @param client Another connect handle created by IOServiceOpen.
+ @result A kern_return_t error code returned by the family. */
+
+kern_return_t
+IOConnectAddClient(
+ io_connect_t connect,
+ io_connect_t client );
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * IORegistry accessors
+ */
+
+/*! @function IORegistryGetRootEntry
+ @abstract Return a handle to the registry root.
+ @discussion This method provides an accessor to the root of the registry for the machine. The root may be passed to a registry iterator when iterating a plane, and contains properties that describe the available planes, and diagnostic information for IOKit.
+ @param masterPort The master port obtained from IOMasterPort(). Pass kIOMasterPortDefault to look up the default master port.
+ @result A handle to the IORegistryEntry root instance, to be released with IOObjectRelease by the caller, or MACH_PORT_NULL on failure. */
+
+io_registry_entry_t
+IORegistryGetRootEntry(
+ mach_port_t masterPort );
+
+/*! @function IORegistryEntryFromPath
+ @abstract Looks up a registry entry by path.
+ @discussion This function parses paths to lookup registry entries. The path should begin with ':' If there are characters remaining unparsed after an entry has been looked up, this is considered an invalid lookup. Paths are further documented in IORegistryEntry.h
+ @param masterPort The master port obtained from IOMasterPort(). Pass kIOMasterPortDefault to look up the default master port.
+ @param path A C-string path.
+ @result A handle to the IORegistryEntry witch was found with the path, to be released with IOObjectRelease by the caller, or MACH_PORT_NULL on failure. */
+
+io_registry_entry_t
+IORegistryEntryFromPath(
+ mach_port_t masterPort,
+ const io_string_t path );
+
+// options for IORegistryCreateIterator(), IORegistryEntryCreateIterator, IORegistryEntrySearchCFProperty()
+enum {
+ kIORegistryIterateRecursively = 0x00000001,
+ kIORegistryIterateParents = 0x00000002
+};
+
+/*! @function IORegistryCreateIterator
+ @abstract Create an iterator rooted at the registry root.
+ @discussion This method creates an IORegistryIterator in the kernel that is set up with options to iterate children of the registry root entry, and to recurse automatically into entries as they are returned, or only when instructed with calls to IORegistryIteratorEnterEntry. The iterator object keeps track of entries that have been recursed into previously to avoid loops.
+ @param masterPort The master port obtained from IOMasterPort(). Pass kIOMasterPortDefault to look up the default master port.
+ @param plane The name of an existing registry plane. Plane names are defined in IOKitKeys.h, eg. kIOServicePlane.
+ @param options kIORegistryIterateRecursively may be set to recurse automatically into each entry as it is returned from IOIteratorNext calls on the registry iterator.
+ @param iterator A created iterator handle, to be released by the caller when it has finished with it.
+ @result A kern_return_t error code. */
+
+kern_return_t
+IORegistryCreateIterator(
+ mach_port_t masterPort,
+ const io_name_t plane,
+ IOOptionBits options,
+ io_iterator_t * iterator );
+
+/*! @function IORegistryEntryCreateIterator
+ @abstract Create an iterator rooted at a given registry entry.
+ @discussion This method creates an IORegistryIterator in the kernel that is set up with options to iterate children or parents of a root entry, and to recurse automatically into entries as they are returned, or only when instructed with calls to IORegistryIteratorEnterEntry. The iterator object keeps track of entries that have been recursed into previously to avoid loops.
+ @param entry The root entry to begin the iteration at.
+ @param plane The name of an existing registry plane. Plane names are defined in IOKitKeys.h, eg. kIOServicePlane.
+ @param options kIORegistryIterateRecursively may be set to recurse automatically into each entry as it is returned from IOIteratorNext calls on the registry iterator. kIORegistryIterateParents may be set to iterate the parents of each entry, by default the children are iterated.
+ @param iterator A created iterator handle, to be released by the caller when it has finished with it.
+ @result A kern_return_t error code. */
+
+kern_return_t
+IORegistryEntryCreateIterator(
+ io_registry_entry_t entry,
+ const io_name_t plane,
+ IOOptionBits options,
+ io_iterator_t * iterator );
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * IORegistryIterator, subclass of IOIterator
+ */
+
+/*! @function IORegistryIteratorEnterEntry
+ @abstract Recurse into the current entry in the registry iteration.
+ @discussion This method makes the current entry, ie. the last entry returned by IOIteratorNext, the root in a new level of recursion.
+ @result A kern_return_t error code. */
+
+kern_return_t
+IORegistryIteratorEnterEntry(
+ io_iterator_t iterator );
+
+/*! @function IORegistryIteratorExitEntry
+ @abstract Exits a level of recursion, restoring the current entry.
+ @discussion This method undoes an IORegistryIteratorEnterEntry, restoring the current entry. If there are no more levels of recursion to exit false is returned, otherwise true is returned.
+ @result kIOReturnSuccess if a level of recursion was undone, kIOReturnNoDevice if no recursive levels are left in the iteration. */
+
+kern_return_t
+IORegistryIteratorExitEntry(
+ io_iterator_t iterator );
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * IORegistryEntry, subclass of IOObject
+ */
+
+/*! @function IORegistryEntryGetName
+ @abstract Returns a C-string name assigned to a registry entry.
+ @discussion Registry entries can be named in a particular plane, or globally. This function returns the entry's global name. The global name defaults to the entry's meta class name if it has not been named.
+ @param entry The registry entry handle whose name to look up.
+ @param name The caller's buffer to receive the name.
+ @result A kern_return_t error code. */
+
+kern_return_t
+IORegistryEntryGetName(
+ io_registry_entry_t entry,
+ io_name_t name );
+
+/*! @function IORegistryEntryGetNameInPlane
+ @abstract Returns a C-string name assigned to a registry entry, in a specified plane.
+ @discussion Registry entries can be named in a particular plane, or globally. This function returns the entry's name in the specified plane or global name if it has not been named in that plane. The global name defaults to the entry's meta class name if it has not been named.
+ @param entry The registry entry handle whose name to look up.
+ @param plane The name of an existing registry plane. Plane names are defined in IOKitKeys.h, eg. kIOServicePlane.
+ @param name The caller's buffer to receive the name.
+ @result A kern_return_t error code. */
+
+kern_return_t
+IORegistryEntryGetNameInPlane(
+ io_registry_entry_t entry,
+ const io_name_t plane,
+ io_name_t name );
+
+/*! @function IORegistryEntryGetLocationInPlane
+ @abstract Returns a C-string location assigned to a registry entry, in a specified plane.
+ @discussion Registry entries can given a location string in a particular plane, or globally. If the entry has had a location set in the specified plane that location string will be returned, otherwise the global location string is returned. If no global location string has been set, an error is returned.
+ @param entry The registry entry handle whose name to look up.
+ @param plane The name of an existing registry plane. Plane names are defined in IOKitKeys.h, eg. kIOServicePlane.
+ @param location The caller's buffer to receive the location string.
+ @result A kern_return_t error code. */
+
+kern_return_t
+IORegistryEntryGetLocationInPlane(
+ io_registry_entry_t entry,
+ const io_name_t plane,
+ io_name_t location );
+
+/*! @function IORegistryEntryGetPath
+ @abstract Create a path for a registry entry.
+ @discussion The path for a registry entry is copied to the caller's buffer. The path describes the entry's attachment in a particular plane, which must be specified. The path begins with the plane name followed by a colon, and then followed by '/' separated path components for each of the entries between the root and the registry entry. An alias may also exist for the entry, and will be returned if available.
+ @param entry The registry entry handle whose path to look up.
+ @param plane The name of an existing registry plane. Plane names are defined in IOKitKeys.h, eg. kIOServicePlane.
+ @param path A char buffer allocated by the caller.
+ @result IORegistryEntryGetPath will fail if the entry is not attached in the plane, or if the buffer is not large enough to contain the path. */
+
+kern_return_t
+IORegistryEntryGetPath(
+ io_registry_entry_t entry,
+ const io_name_t plane,
+ io_string_t path );
+
+/*! @function IORegistryEntryCreateCFProperties
+ @abstract Create a CF dictionary representation of a registry entry's property table.
+ @discussion This function creates an instantaneous snapshot of a registry entry's property table, creating a CFDictionary analogue in the caller's task. Not every object available in the kernel is represented as a CF container; currently OSDictionary, OSArray, OSSet, OSSymbol, OSString, OSData, OSNumber, OSBoolean are created as their CF counterparts.
+ @param entry The registry entry handle whose property table to copy.
+ @param properties A CFDictionary is created and returned the caller on success. The caller should release with CFRelease.
+ @param allocator The CF allocator to use when creating the CF containers.
+ @param options No options are currently defined.
+ @result A kern_return_t error code. */
+
+kern_return_t
+IORegistryEntryCreateCFProperties(
+ io_registry_entry_t entry,
+ CFMutableDictionaryRef * properties,
+ CFAllocatorRef allocator,
+ IOOptionBits options );
+
+/*! @function IORegistryEntryCreateCFProperty
+ @abstract Create a CF representation of a registry entry's property.
+ @discussion This function creates an instantaneous snapshot of a registry entry property, creating a CF container analogue in the caller's task. Not every object available in the kernel is represented as a CF container; currently OSDictionary, OSArray, OSSet, OSSymbol, OSString, OSData, OSNumber, OSBoolean are created as their CF counterparts.
+ @param entry The registry entry handle whose property to copy.
+ @param key A CFString specifying the property name.
+ @param allocator The CF allocator to use when creating the CF container.
+ @param options No options are currently defined.
+ @result A CF container is created and returned the caller on success. The caller should release with CFRelease. */
+
+CFTypeRef
+IORegistryEntryCreateCFProperty(
+ io_registry_entry_t entry,
+ CFStringRef key,
+ CFAllocatorRef allocator,
+ IOOptionBits options );
+
+/*! @function IORegistryEntrySearchCFProperty
+ @abstract Create a CF representation of a registry entry's property.
+ @discussion This function creates an instantaneous snapshot of a registry entry property, creating a CF container analogue in the caller's task. Not every object available in the kernel is represented as a CF container; currently OSDictionary, OSArray, OSSet, OSSymbol, OSString, OSData, OSNumber, OSBoolean are created as their CF counterparts.
+This function will search for a property, starting first with specified registry entry's property table, then iterating recusively through either the parent registry entries or the child registry entries of this entry. Once the first occurrence is found, it will lookup and return the value of the property, using the same semantics as IORegistryEntryCreateCFProperty. The iteration keeps track of entries that have been recursed into previously to avoid loops.
+ @param entry The registry entry at which to start the search.
+ @param plane The name of an existing registry plane. Plane names are defined in IOKitKeys.h, eg. kIOServicePlane.
+ @param key A CFString specifying the property name.
+ @param allocator The CF allocator to use when creating the CF container.
+ @param options kIORegistryIterateRecursively may be set to recurse automatically into the registry hierarchy. Without this option, this method degenerates into the standard IORegistryEntryCreateCFProperty() call. kIORegistryIterateParents may be set to iterate the parents of the entry, in place of the children.
+ @result A CF container is created and returned the caller on success. The caller should release with CFRelease. */
+
+CFTypeRef
+IORegistryEntrySearchCFProperty(
+ io_registry_entry_t entry,
+ const io_name_t plane,
+ CFStringRef key,
+ CFAllocatorRef allocator,
+ IOOptionBits options );
+
+/* @function IORegistryEntryGetProperty - deprecated,
+ use IORegistryEntryCreateCFProperty */
+
+kern_return_t
+IORegistryEntryGetProperty(
+ io_registry_entry_t entry,
+ const io_name_t propertyName,
+ io_struct_inband_t buffer,
+ uint32_t * size );
+
+/*! @function IORegistryEntrySetCFProperties
+ @abstract Set CF container based properties in a registry entry.
+ @discussion This is a generic method to pass a CF container of properties to an object in the registry. Setting properties in a registry entry is not generally supported, it is more common to support IOConnectSetCFProperties for connection based property setting. The properties are interpreted by the object.
+ @param entry The registry entry whose properties to set.
+ @param properties A CF container - commonly a CFDictionary but this is not enforced. The container should consist of objects which are understood by IOKit - these are currently : CFDictionary, CFArray, CFSet, CFString, CFData, CFNumber, CFBoolean, and are passed in the kernel as the corresponding OSDictionary etc. objects.
+ @result A kern_return_t error code returned by the object. */
+
+kern_return_t
+IORegistryEntrySetCFProperties(
+ io_registry_entry_t entry,
+ CFTypeRef properties );
+
+/*! @function IORegistryEntrySetCFProperty
+ @abstract Set a CF container based property in a registry entry.
+ @discussion This is a generic method to pass a CF container as a property to an object in the registry. Setting properties in a registry entry is not generally supported, it is more common to support IOConnectSetCFProperty for connection based property setting. The property is interpreted by the object.
+ @param entry The registry entry whose property to set.
+ @param propertyName The name of the property as a CFString.
+ @param property A CF container - should consist of objects which are understood by IOKit - these are currently : CFDictionary, CFArray, CFSet, CFString, CFData, CFNumber, CFBoolean, and are passed in the kernel as the corresponding OSDictionary etc. objects.
+ @result A kern_return_t error code returned by the object. */
+
+kern_return_t
+IORegistryEntrySetCFProperty(
+ io_registry_entry_t entry,
+ CFStringRef propertyName,
+ CFTypeRef property );
+
+/*! @function IORegistryEntryGetChildIterator
+ @abstract Returns an iterator over an registry entry's child entries in a plane.
+ @discussion This method creates an iterator which will return each of a registry entry's child entries in a specified plane.
+ @param entry The registry entry whose children to iterate over.
+ @param plane The name of an existing registry plane. Plane names are defined in IOKitKeys.h, eg. kIOServicePlane.
+ @param iterator The created iterator over the children of the entry, on success. The iterator must be released when the iteration is finished.
+ @result A kern_return_t error code. */
+
+kern_return_t
+IORegistryEntryGetChildIterator(
+ io_registry_entry_t entry,
+ const io_name_t plane,
+ io_iterator_t * iterator );
+
+/*! @function IORegistryEntryGetChildEntry
+ @abstract Returns the first child of a registry entry in a plane.
+ @discussion This function will return the child which first attached to a registry entry in a plane.
+ @param entry The registry entry whose child to look up.
+ @param plane The name of an existing registry plane. Plane names are defined in IOKitKeys.h, eg. kIOServicePlane.
+ @param child The first child of the registry entry, on success. The child must be released by the caller.
+ @result A kern_return_t error code. */
+
+kern_return_t
+IORegistryEntryGetChildEntry(
+ io_registry_entry_t entry,
+ const io_name_t plane,
+ io_registry_entry_t * child );
+
+/*! @function IORegistryEntryGetParentIterator
+ @abstract Returns an iterator over an registry entry's parent entries in a plane.
+ @discussion This method creates an iterator which will return each of a registry entry's parent entries in a specified plane.
+ @param entry The registry entry whose parents to iterate over.
+ @param plane The name of an existing registry plane. Plane names are defined in IOKitKeys.h, eg. kIOServicePlane.
+ @param iterator The created iterator over the parents of the entry, on success. The iterator must be released when the iteration is finished.
+ @result A kern_return_t error. */
+
+kern_return_t
+IORegistryEntryGetParentIterator(
+ io_registry_entry_t entry,
+ const io_name_t plane,
+ io_iterator_t * iterator );
+
+/*! @function IORegistryEntryGetParentEntry
+ @abstract Returns the first parent of a registry entry in a plane.
+ @discussion This function will return the parent to which the registry entry was first attached in a plane.
+ @param entry The registry entry whose parent to look up.
+ @param plane The name of an existing registry plane. Plane names are defined in IOKitKeys.h, eg. kIOServicePlane.
+ @param child The first parent of the registry entry, on success. The parent must be released by the caller.
+ @result A kern_return_t error code. */
+
+kern_return_t
+IORegistryEntryGetParentEntry(
+ io_registry_entry_t entry,
+ const io_name_t plane,
+ io_registry_entry_t * parent );
+
+/*! @function IORegistryEntryInPlane
+ @abstract Determines if the registry entry is attached in a plane.
+ @discussion This method determines if the entry is attached in a plane to any other entry.
+ @param entry The registry entry.
+ @param plane The name of an existing registry plane. Plane names are defined in IOKitKeys.h, eg. kIOServicePlane.
+ @result If the entry has a parent in the plane, true is returned, otherwise false is returned. */
+
+boolean_t
+IORegistryEntryInPlane(
+ io_registry_entry_t entry,
+ const io_name_t plane );
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * Matching dictionary creation helpers
+ */
+
+/*! @function IOServiceMatching
+ @abstract Create a matching dictionary that specifies an IOService class match.
+ @discussion A very common matching criteria for IOService is based on its class. IOServiceMatching will create a matching dictionary that specifies any IOService of a class, or its subclasses. The class is specified by C-string name.
+ @param name The class name, as a const C-string. Class matching is successful on IOService's of this class or any subclass.
+ @result The matching dictionary created, is returned on success, or zero on failure. The dictionary is commonly passed to IOServiceGetMatchingServices or IOServiceAddNotification which will consume a reference, otherwise it should be released with CFRelease by the caller. */
+
+CFMutableDictionaryRef
+IOServiceMatching(
+ const char * name );
+
+/*! @function IOServiceNameMatching
+ @abstract Create a matching dictionary that specifies an IOService name match.
+ @discussion A common matching criteria for IOService is based on its name. IOServiceNameMatching will create a matching dictionary that specifies an IOService with a given name. Some IOServices created from the OpenFirmware device tree will perform name matching on the standard OF compatible, name, model properties.
+ @param name The IOService name, as a const C-string.
+ @result The matching dictionary created, is returned on success, or zero on failure. The dictionary is commonly passed to IOServiceGetMatchingServices or IOServiceAddNotification which will consume a reference, otherwise it should be released with CFRelease by the caller. */
+
+CFMutableDictionaryRef
+IOServiceNameMatching(
+ const char * name );
+
+/*! @function IOBSDNameMatching
+ @abstract Create a matching dictionary that specifies an IOService match based on BSD device name.
+ @discussion IOServices that represent BSD devices have an associated BSD name. This function creates a matching dictionary that will match IOService's with a given BSD name.
+ @param masterPort The master port obtained from IOMasterPort(). Pass kIOMasterPortDefault to look up the default master port.
+ @param options No options are currently defined.
+ @param bsdName The BSD name, as a const char *.
+ @result The matching dictionary created, is returned on success, or zero on failure. The dictionary is commonly passed to IOServiceGetMatchingServices or IOServiceAddNotification which will consume a reference, otherwise it should be released with CFRelease by the caller. */
+
+CFMutableDictionaryRef
+IOBSDNameMatching(
+ mach_port_t masterPort,
+ uint32_t options,
+ const char * bsdName );
+
+/*! @function IOOpenFirmwarePathMatching
+ @abstract Create a matching dictionary that specifies an IOService match based on an OpenFirmware device path.
+ @discussion Certain IOServices (currently, block and ethernet boot devices) may be looked up by a path that specifies their location in the OpenFirmware device tree, represented in the registry by the kIODeviceTreePlane plane. This function creates a matching dictionary that will match IOService's found with a given OpenFirmware device path.
+ @param masterPort The master port obtained from IOMasterPort(). Pass kIOMasterPortDefault to look up the default master port.
+ @param options No options are currently defined.
+ @param path The OpenFirmware device path, as a const char *.
+ @result The matching dictionary created, is returned on success, or zero on failure. The dictionary is commonly passed to IOServiceGetMatchingServices or IOServiceAddNotification which will consume a reference, otherwise it should be released with CFRelease by the caller. */
+
+CFMutableDictionaryRef
+IOOpenFirmwarePathMatching(
+ mach_port_t masterPort,
+ uint32_t options,
+ const char * path );
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*! @function IOServiceOFPathToBSDName
+ @abstract Utility to look up an IOService from its OpenFirmware device path, and return its BSD device name if available.
+ @discussion Certain IOServices (currently, block and ethernet boot devices) may be looked up by a path that specifies their location in the OpenFirmware device tree, represented in the registry by the kIODeviceTreePlane plane. This function looks up an IOService object with a given OpenFirmware device path, and returns its associated BSD device name.
+ @param masterPort The master port obtained from IOMasterPort(). Pass kIOMasterPortDefault to look up the default master port.
+ @param openFirmwarePath The OpenFirmware device path, as a const char *.
+ @param bsdName The BSD name, as a const char *, is copied to the callers buffer.
+ @result A kern_return_t error code. */
+
+kern_return_t
+IOServiceOFPathToBSDName(mach_port_t masterPort,
+ const io_name_t openFirmwarePath,
+ io_name_t bsdName);
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*! @typedef IOAsyncCallback0
+ @abstract standard callback function for asynchronous I/O requests with
+ no extra arguments beyond a refcon and result code.
+ @param refcon The refcon passed into the original I/O request
+ @param result The result of the I/O operation
+*/
+typedef void (*IOAsyncCallback0)(void *refcon, IOReturn result);
+
+/*! @typedef IOAsyncCallback1
+ @abstract standard callback function for asynchronous I/O requests with
+ one extra argument beyond a refcon and result code.
+ This is often a count of the number of bytes transferred
+ @param refcon The refcon passed into the original I/O request
+ @param result The result of the I/O operation
+ @param arg0 Extra argument
+*/
+typedef void (*IOAsyncCallback1)(void *refcon, IOReturn result, void *arg0);
+
+/*! @typedef IOAsyncCallback2
+ @abstract standard callback function for asynchronous I/O requests with
+ two extra arguments beyond a refcon and result code.
+ @param refcon The refcon passed into the original I/O request
+ @param result The result of the I/O operation
+ @param arg0 Extra argument
+ @param arg1 Extra argument
+*/
+typedef void (*IOAsyncCallback2)(void *refcon, IOReturn result, void *arg0, void *arg1);
+
+/*! @typedef IOAsyncCallback
+ @abstract standard callback function for asynchronous I/O requests with
+ lots of extra arguments beyond a refcon and result code.
+ @param refcon The refcon passed into the original I/O request
+ @param result The result of the I/O operation
+ @param args Array of extra arguments
+ @param numArgs Number of extra arguments
+*/
+typedef void (*IOAsyncCallback)(void *refcon, IOReturn result, void **args,
+ uint32_t numArgs);
+
+
+/* Internal use */
+
+kern_return_t
+OSGetNotificationFromMessage(
+ mach_msg_header_t * msg,
+ uint32_t index,
+ uint32_t * type,
+ uintptr_t * reference,
+ void ** content,
+ vm_size_t * size );
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/* Internal use */
+
+kern_return_t
+IOCatalogueSendData(
+ mach_port_t masterPort,
+ uint32_t flag,
+ const char *buffer,
+ uint32_t size );
+
+kern_return_t
+IOCatalogueTerminate(
+ mach_port_t masterPort,
+ uint32_t flag,
+ io_name_t description );
+
+kern_return_t
+IOCatalogueGetData(
+ mach_port_t masterPort,
+ uint32_t flag,
+ char **buffer,
+ uint32_t *size );
+
+kern_return_t
+IOCatalogueModuleLoaded(
+ mach_port_t masterPort,
+ io_name_t name );
+
+kern_return_t
+IOCatalogueReset(
+ mach_port_t masterPort,
+ uint32_t flag );
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+// obsolete API
+
+#if !defined(__LP64__)
+
+// for Power Mgt
+
+typedef struct IOObject IOObject;
+
+// for MacOS.app
+
+kern_return_t
+IORegistryDisposeEnumerator(
+ io_enumerator_t enumerator ) DEPRECATED_ATTRIBUTE;
+
+kern_return_t
+IOMapMemory(
+ io_connect_t connect,
+ uint32_t memoryType,
+ task_port_t intoTask,
+ vm_address_t * atAddress,
+ vm_size_t * ofSize,
+ uint32_t flags ) DEPRECATED_ATTRIBUTE;
+
+// for CGS
+
+kern_return_t
+IOCompatibiltyNumber(
+ mach_port_t connect,
+ uint32_t * objectNumber ) DEPRECATED_ATTRIBUTE;
+
+// Traditional IOUserClient transport routines
+kern_return_t
+IOConnectMethodScalarIScalarO(
+ io_connect_t connect,
+ uint32_t index,
+ IOItemCount scalarInputCount,
+ IOItemCount scalarOutputCount,
+ ... ) AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5;
+
+kern_return_t
+IOConnectMethodScalarIStructureO(
+ io_connect_t connect,
+ uint32_t index,
+ IOItemCount scalarInputCount,
+ IOByteCount * structureSize,
+ ... ) AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5;
+
+kern_return_t
+IOConnectMethodScalarIStructureI(
+ io_connect_t connect,
+ uint32_t index,
+ IOItemCount scalarInputCount,
+ IOByteCount structureSize,
+ ... ) AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5;
+
+kern_return_t
+IOConnectMethodStructureIStructureO(
+ io_connect_t connect,
+ uint32_t index,
+ IOItemCount structureInputSize,
+ IOByteCount * structureOutputSize,
+ void * inputStructure,
+ void * ouputStructure ) AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5;
+
+// Compatability with earlier Mig interface routines
+#if IOCONNECT_NO_32B_METHODS
+
+kern_return_t
+io_connect_map_memory(
+ io_connect_t connect,
+ uint32_t memoryType,
+ task_port_t intoTask,
+ vm_address_t *atAddress,
+ vm_size_t *ofSize,
+ IOOptionBits options) DEPRECATED_ATTRIBUTE;
+
+kern_return_t
+io_connect_unmap_memory(
+ io_connect_t connect,
+ uint32_t memoryType,
+ task_port_t fromTask,
+ vm_address_t atAddress) DEPRECATED_ATTRIBUTE;
+
+kern_return_t
+io_connect_method_scalarI_scalarO(
+ mach_port_t connection,
+ int selector,
+ io_scalar_inband_t input,
+ mach_msg_type_number_t inputCnt,
+ io_scalar_inband_t output,
+ mach_msg_type_number_t *outputCnt) DEPRECATED_ATTRIBUTE;
+
+kern_return_t
+io_connect_method_scalarI_structureO(
+ mach_port_t connection,
+ int selector,
+ io_scalar_inband_t input,
+ mach_msg_type_number_t inputCnt,
+ io_struct_inband_t output,
+ mach_msg_type_number_t *outputCnt) DEPRECATED_ATTRIBUTE;
+
+kern_return_t
+io_connect_method_scalarI_structureI(
+ mach_port_t connection,
+ int selector,
+ io_scalar_inband_t input,
+ mach_msg_type_number_t inputCnt,
+ io_struct_inband_t inputStruct,
+ mach_msg_type_number_t inputStructCnt) DEPRECATED_ATTRIBUTE;
+
+kern_return_t
+io_connect_method_structureI_structureO(
+ mach_port_t connection,
+ int selector,
+ io_struct_inband_t input,
+ mach_msg_type_number_t inputCnt,
+ io_struct_inband_t output,
+ mach_msg_type_number_t *outputCnt) DEPRECATED_ATTRIBUTE;
+
+kern_return_t
+io_async_method_scalarI_scalarO(
+ mach_port_t connection,
+ mach_port_t wake_port,
+ io_async_ref_t reference,
+ mach_msg_type_number_t referenceCnt,
+ int selector,
+ io_scalar_inband_t input,
+ mach_msg_type_number_t inputCnt,
+ io_scalar_inband_t output,
+ mach_msg_type_number_t *outputCnt) DEPRECATED_ATTRIBUTE;
+
+kern_return_t
+io_async_method_scalarI_structureO(
+ mach_port_t connection,
+ mach_port_t wake_port,
+ io_async_ref_t reference,
+ mach_msg_type_number_t referenceCnt,
+ int selector,
+ io_scalar_inband_t input,
+ mach_msg_type_number_t inputCnt,
+ io_struct_inband_t output,
+ mach_msg_type_number_t *outputCnt) DEPRECATED_ATTRIBUTE;
+
+kern_return_t
+io_async_method_scalarI_structureI(
+ mach_port_t connection,
+ mach_port_t wake_port,
+ io_async_ref_t reference,
+ mach_msg_type_number_t referenceCnt,
+ int selector,
+ io_scalar_inband_t input,
+ mach_msg_type_number_t inputCnt,
+ io_struct_inband_t inputStruct,
+ mach_msg_type_number_t inputStructCnt) DEPRECATED_ATTRIBUTE;
+
+kern_return_t
+io_async_method_structureI_structureO(
+ mach_port_t connection,
+ mach_port_t wake_port,
+ io_async_ref_t reference,
+ mach_msg_type_number_t referenceCnt,
+ int selector,
+ io_struct_inband_t input,
+ mach_msg_type_number_t inputCnt,
+ io_struct_inband_t output,
+ mach_msg_type_number_t *outputCnt) DEPRECATED_ATTRIBUTE;
+#endif // IOCONNECT_NO_32B_METHODS
+
+#endif /* defined(__LP64__) */
+
+__END_DECLS
+
+#endif /* ! _IOKIT_IOKITLIB_H */
diff --git a/include/IOKit/IOMessage.h b/include/IOKit/IOMessage.h
new file mode 100644
index 0000000..4a571b9
--- /dev/null
+++ b/include/IOKit/IOMessage.h
@@ -0,0 +1,220 @@
+/*
+ * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ *
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may notificationused to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ *
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+
+#ifndef __IOKIT_IOMESSAGE_H
+#define __IOKIT_IOMESSAGE_H
+
+#include
+#include
+
+/*!
+ * @header IOMessage.h
+ *
+ * Defines message type constants for several IOKit messaging API's.
+ *
+ */
+
+typedef UInt32 IOMessage;
+
+#define iokit_common_msg(message) (UInt32)(sys_iokit|sub_iokit_common|message)
+#define iokit_family_msg(sub,message) (UInt32)(sys_iokit|sub|message)
+
+/*!
+ * @defined iokit_vendor_specific_msg
+ * @discussion iokit_vendor_specific_msg passes messages in the sub_iokit_vendor_specific
+ * subsystem. It can be used to generate messages that are used for private
+ * communication between vendor specific code with the IOService::message() etc. APIs.
+ */
+#define iokit_vendor_specific_msg(message) (UInt32)(sys_iokit|sub_iokit_vendor_specific|message)
+
+#define kIOMessageServiceIsTerminated iokit_common_msg(0x010)
+#define kIOMessageServiceIsSuspended iokit_common_msg(0x020)
+#define kIOMessageServiceIsResumed iokit_common_msg(0x030)
+
+#define kIOMessageServiceIsRequestingClose iokit_common_msg(0x100)
+#define kIOMessageServiceIsAttemptingOpen iokit_common_msg(0x101)
+#define kIOMessageServiceWasClosed iokit_common_msg(0x110)
+
+#define kIOMessageServiceBusyStateChange iokit_common_msg(0x120)
+
+#define kIOMessageConsoleSecurityChange iokit_common_msg(0x128)
+
+#define kIOMessageServicePropertyChange iokit_common_msg(0x130)
+
+#define kIOMessageCopyClientID iokit_common_msg(0x330)
+
+#define kIOMessageSystemCapabilityChange iokit_common_msg(0x340)
+#define kIOMessageDeviceSignaledWakeup iokit_common_msg(0x350)
+
+
+/*!
+ * @defined kIOMessageDeviceWillPowerOff
+ * @discussion Indicates the device is about to move to a lower power state.
+ * Sent to IOKit interest notification clients of type kIOAppPowerStateInterest
+ * and kIOGeneralInterest.
+ */
+#define kIOMessageDeviceWillPowerOff iokit_common_msg(0x210)
+
+/*!
+ * @defined kIOMessageDeviceHasPoweredOn
+ * @discussion Indicates the device has just moved to a higher power state.
+ * Sent to IOKit interest notification clients of type kIOAppPowerStateInterest
+ * and kIOGeneralInterest.
+ */
+#define kIOMessageDeviceHasPoweredOn iokit_common_msg(0x230)
+
+/*! @group In-kernel system shutdown and restart notifications
+ */
+
+/*!
+ * @defined kIOMessageSystemWillPowerOff
+ * @discussion Indicates an imminent system shutdown. Recipients have a limited
+ * amount of time to respond, otherwise the system will timeout and
+ * shutdown even without a response.
+ * Delivered to in-kernel IOKit drivers via IOService::systemWillShutdown(),
+ * and to clients of registerPrioritySleepWakeInterest().
+ * Never delivered to user space notification clients.
+ */
+#define kIOMessageSystemWillPowerOff iokit_common_msg(0x250)
+
+/*!
+ * @defined kIOMessageSystemWillRestart
+ * @discussion Indicates an imminent system restart. Recipients have a limited
+ * amount of time to respond, otherwise the system will timeout and
+ * restart even without a response.
+ * Delivered to in-kernel IOKit drivers via IOService::systemWillShutdown(),
+ * and to clients of registerPrioritySleepWakeInterest().
+ * Never delivered to user space notification clients.
+ */
+#define kIOMessageSystemWillRestart iokit_common_msg(0x310)
+
+/*!
+ * @defined kIOMessageSystemPagingOff
+ * @discussion Indicates an imminent system shutdown, paging device now unavailable.
+ * Recipients have a limited amount of time to respond, otherwise the
+ * system will timeout and shutdown even without a response.
+ * Delivered to clients of registerPrioritySleepWakeInterest().
+ * Never delivered to user space notification clients.
+ */
+#define kIOMessageSystemPagingOff iokit_common_msg(0x255)
+
+
+/*! @group System sleep and wake notifications
+ */
+
+/*!
+ * @defined kIOMessageCanSystemSleep
+ * @discussion Announces/Requests permission to proceed to system sleep.
+ * Delivered to in-kernel IOKit drivers via kIOGeneralInterest
+ * and kIOPriorityPowerStateInterest.
+ * Delivered to user clients of IORegisterForSystemPower.
+ */
+#define kIOMessageCanSystemSleep iokit_common_msg(0x270)
+
+/*!
+ * @defined kIOMessageSystemWillNotSleep
+ * @discussion Announces that the system has retracted a previous attempt to sleep;
+ * it follows kIOMessageCanSystemSleep.
+ * Delivered to in-kernel IOKit drivers via kIOGeneralInterest
+ * and kIOPriorityPowerStateInterest.
+ * Delivered to user clients of IORegisterForSystemPower.
+ */
+#define kIOMessageSystemWillNotSleep iokit_common_msg(0x290)
+
+/*!
+ * @defined kIOMessageSystemWillSleep
+ * @discussion Announces that sleep is beginning.
+ * Delivered to in-kernel IOKit drivers via kIOGeneralInterest
+ * and kIOPriorityPowerStateInterest.
+ * Delivered to user clients of IORegisterForSystemPower.
+ */
+#define kIOMessageSystemWillSleep iokit_common_msg(0x280)
+
+/*!
+ * @defined kIOMessageSystemWillPowerOn
+ * @discussion Announces that the system is beginning to power the device tree; most
+ * devices are unavailable at this point..
+ * Delivered to in-kernel IOKit drivers via kIOGeneralInterest
+ * and kIOPriorityPowerStateInterest.
+ * Delivered to user clients of IORegisterForSystemPower.
+ */
+#define kIOMessageSystemWillPowerOn iokit_common_msg(0x320)
+
+/*!
+ * @defined kIOMessageSystemHasPoweredOn
+ * @discussion Announces that the system and its devices have woken up.
+ * Delivered to in-kernel IOKit drivers via kIOGeneralInterest
+ * and kIOPriorityPowerStateInterest.
+ * Delivered to user clients of IORegisterForSystemPower.
+ */
+#define kIOMessageSystemHasPoweredOn iokit_common_msg(0x300)
+
+/*! @group Unused and deprecated notifications
+ */
+
+/*!
+ * @defined kIOMessageCanDevicePowerOff
+ * @discussion Delivered to kIOAppPowerStateInterest clients of
+ * devices that implement their own idle timeouts.
+ * This message type is almost never used.
+ */
+#define kIOMessageCanDevicePowerOff iokit_common_msg(0x200)
+
+/*!
+ * @defined kIOMessageDeviceWillNotPowerOff
+ * @discussion This IOKit interest notification is largely unused;
+ * it's not very interesting.
+ */
+#define kIOMessageDeviceWillNotPowerOff iokit_common_msg(0x220)
+
+/*!
+ * @defined kIOMessageSystemWillNotPowerOff
+ * @deprecated This IOKit message is unused.
+ */
+#define kIOMessageSystemWillNotPowerOff iokit_common_msg(0x260)
+
+/*!
+ * @defined kIOMessageCanSystemPowerOff
+ * @deprecated This IOKit message is unused.
+ */
+#define kIOMessageCanSystemPowerOff iokit_common_msg(0x240)
+
+/*!
+ * @defined kIOMessageDeviceWillPowerOn
+ * @discussion IOService power mgt does not send kIOMessageDeviceWillPowerOn.
+ */
+#define kIOMessageDeviceWillPowerOn iokit_common_msg(0x215)
+
+/*!
+ * @defined kIOMessageDeviceHasPoweredOff
+ * @discussion IOService power mgt does not send kIOMessageDeviceHasPoweredOff.
+ */
+#define kIOMessageDeviceHasPoweredOff iokit_common_msg(0x225)
+
+
+#endif /* ! __IOKIT_IOMESSAGE_H */
diff --git a/include/IOKit/IOReturn.h b/include/IOKit/IOReturn.h
new file mode 100644
index 0000000..38811b6
--- /dev/null
+++ b/include/IOKit/IOReturn.h
@@ -0,0 +1,137 @@
+/*
+ * Copyright (c) 1998-2002 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ *
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ *
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * HISTORY
+ */
+
+/*
+ * Core IOReturn values. Others may be family defined.
+ */
+
+#ifndef __IOKIT_IORETURN_H
+#define __IOKIT_IORETURN_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include
+
+typedef kern_return_t IOReturn;
+
+#ifndef sys_iokit
+#define sys_iokit err_system(0x38)
+#endif /* sys_iokit */
+#define sub_iokit_common err_sub(0)
+#define sub_iokit_usb err_sub(1)
+#define sub_iokit_firewire err_sub(2)
+#define sub_iokit_block_storage err_sub(4)
+#define sub_iokit_graphics err_sub(5)
+#define sub_iokit_networking err_sub(6)
+#define sub_iokit_bluetooth err_sub(8)
+#define sub_iokit_pmu err_sub(9)
+#define sub_iokit_acpi err_sub(10)
+#define sub_iokit_smbus err_sub(11)
+#define sub_iokit_ahci err_sub(12)
+#define sub_iokit_powermanagement err_sub(13)
+//#define sub_iokit_hidsystem err_sub(14)
+#define sub_iokit_scsi err_sub(16)
+//#define sub_iokit_pccard err_sub(21)
+
+#define sub_iokit_vendor_specific err_sub(-2)
+#define sub_iokit_reserved err_sub(-1)
+
+#define iokit_common_err(return) (sys_iokit|sub_iokit_common|return)
+#define iokit_family_err(sub,return) (sys_iokit|sub|return)
+#define iokit_vendor_specific_err(return) (sys_iokit|sub_iokit_vendor_specific|return)
+
+#define kIOReturnSuccess KERN_SUCCESS // OK
+#define kIOReturnError iokit_common_err(0x2bc) // general error
+#define kIOReturnNoMemory iokit_common_err(0x2bd) // can't allocate memory
+#define kIOReturnNoResources iokit_common_err(0x2be) // resource shortage
+#define kIOReturnIPCError iokit_common_err(0x2bf) // error during IPC
+#define kIOReturnNoDevice iokit_common_err(0x2c0) // no such device
+#define kIOReturnNotPrivileged iokit_common_err(0x2c1) // privilege violation
+#define kIOReturnBadArgument iokit_common_err(0x2c2) // invalid argument
+#define kIOReturnLockedRead iokit_common_err(0x2c3) // device read locked
+#define kIOReturnLockedWrite iokit_common_err(0x2c4) // device write locked
+#define kIOReturnExclusiveAccess iokit_common_err(0x2c5) // exclusive access and
+ // device already open
+#define kIOReturnBadMessageID iokit_common_err(0x2c6) // sent/received messages
+ // had different msg_id
+#define kIOReturnUnsupported iokit_common_err(0x2c7) // unsupported function
+#define kIOReturnVMError iokit_common_err(0x2c8) // misc. VM failure
+#define kIOReturnInternalError iokit_common_err(0x2c9) // internal error
+#define kIOReturnIOError iokit_common_err(0x2ca) // General I/O error
+//#define kIOReturn???Error iokit_common_err(0x2cb) // ???
+#define kIOReturnCannotLock iokit_common_err(0x2cc) // can't acquire lock
+#define kIOReturnNotOpen iokit_common_err(0x2cd) // device not open
+#define kIOReturnNotReadable iokit_common_err(0x2ce) // read not supported
+#define kIOReturnNotWritable iokit_common_err(0x2cf) // write not supported
+#define kIOReturnNotAligned iokit_common_err(0x2d0) // alignment error
+#define kIOReturnBadMedia iokit_common_err(0x2d1) // Media Error
+#define kIOReturnStillOpen iokit_common_err(0x2d2) // device(s) still open
+#define kIOReturnRLDError iokit_common_err(0x2d3) // rld failure
+#define kIOReturnDMAError iokit_common_err(0x2d4) // DMA failure
+#define kIOReturnBusy iokit_common_err(0x2d5) // Device Busy
+#define kIOReturnTimeout iokit_common_err(0x2d6) // I/O Timeout
+#define kIOReturnOffline iokit_common_err(0x2d7) // device offline
+#define kIOReturnNotReady iokit_common_err(0x2d8) // not ready
+#define kIOReturnNotAttached iokit_common_err(0x2d9) // device not attached
+#define kIOReturnNoChannels iokit_common_err(0x2da) // no DMA channels left
+#define kIOReturnNoSpace iokit_common_err(0x2db) // no space for data
+//#define kIOReturn???Error iokit_common_err(0x2dc) // ???
+#define kIOReturnPortExists iokit_common_err(0x2dd) // port already exists
+#define kIOReturnCannotWire iokit_common_err(0x2de) // can't wire down
+ // physical memory
+#define kIOReturnNoInterrupt iokit_common_err(0x2df) // no interrupt attached
+#define kIOReturnNoFrames iokit_common_err(0x2e0) // no DMA frames enqueued
+#define kIOReturnMessageTooLarge iokit_common_err(0x2e1) // oversized msg received
+ // on interrupt port
+#define kIOReturnNotPermitted iokit_common_err(0x2e2) // not permitted
+#define kIOReturnNoPower iokit_common_err(0x2e3) // no power to device
+#define kIOReturnNoMedia iokit_common_err(0x2e4) // media not present
+#define kIOReturnUnformattedMedia iokit_common_err(0x2e5)// media not formatted
+#define kIOReturnUnsupportedMode iokit_common_err(0x2e6) // no such mode
+#define kIOReturnUnderrun iokit_common_err(0x2e7) // data underrun
+#define kIOReturnOverrun iokit_common_err(0x2e8) // data overrun
+#define kIOReturnDeviceError iokit_common_err(0x2e9) // the device is not working properly!
+#define kIOReturnNoCompletion iokit_common_err(0x2ea) // a completion routine is required
+#define kIOReturnAborted iokit_common_err(0x2eb) // operation aborted
+#define kIOReturnNoBandwidth iokit_common_err(0x2ec) // bus bandwidth would be exceeded
+#define kIOReturnNotResponding iokit_common_err(0x2ed) // device not responding
+#define kIOReturnIsoTooOld iokit_common_err(0x2ee) // isochronous I/O request for distant past!
+#define kIOReturnIsoTooNew iokit_common_err(0x2ef) // isochronous I/O request for distant future
+#define kIOReturnNotFound iokit_common_err(0x2f0) // data was not found
+#define kIOReturnInvalid iokit_common_err(0x1) // should never be seen
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ! __IOKIT_IORETURN_H */
diff --git a/include/IOKit/IOTypes.h b/include/IOKit/IOTypes.h
new file mode 100644
index 0000000..473797a
--- /dev/null
+++ b/include/IOKit/IOTypes.h
@@ -0,0 +1,250 @@
+/*
+ * Copyright (c) 1998-2006 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ *
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ *
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+#ifndef __IOKIT_IOTYPES_H
+#define __IOKIT_IOTYPES_H
+
+#ifndef IOKIT
+#define IOKIT 1
+#endif /* !IOKIT */
+
+#if KERNEL
+#include
+#else
+#include
+#include
+#endif
+
+#include "IOReturn.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef NULL
+#if defined (__cplusplus)
+#define NULL 0
+#else
+#define NULL ((void *)0)
+#endif
+#endif
+
+/*
+ * Simple data types.
+ */
+#ifndef __MACTYPES__ /* CF MacTypes.h */
+#ifndef __TYPES__ /* guess... Mac Types.h */
+
+#include
+#include
+
+#endif /* __TYPES__ */
+#endif /* __MACTYPES__ */
+
+#if KERNEL
+#include
+#endif
+
+typedef UInt32 IOOptionBits;
+typedef SInt32 IOFixed;
+typedef UInt32 IOVersion;
+typedef UInt32 IOItemCount;
+typedef UInt32 IOCacheMode;
+
+typedef UInt32 IOByteCount32;
+typedef UInt64 IOByteCount64;
+
+typedef UInt32 IOPhysicalAddress32;
+typedef UInt64 IOPhysicalAddress64;
+typedef UInt32 IOPhysicalLength32;
+typedef UInt64 IOPhysicalLength64;
+
+#ifdef __LP64__
+typedef mach_vm_address_t IOVirtualAddress;
+#else
+typedef vm_address_t IOVirtualAddress;
+#endif
+
+#if defined(__LP64__) && defined(KERNEL)
+typedef IOByteCount64 IOByteCount;
+#else
+typedef IOByteCount32 IOByteCount;
+#endif
+
+typedef IOVirtualAddress IOLogicalAddress;
+
+#if defined(__LP64__) && defined(KERNEL)
+
+typedef IOPhysicalAddress64 IOPhysicalAddress;
+typedef IOPhysicalLength64 IOPhysicalLength;
+#define IOPhysical32( hi, lo ) ((UInt64) lo + ((UInt64)(hi) << 32))
+#define IOPhysSize 64
+
+#else
+
+typedef IOPhysicalAddress32 IOPhysicalAddress;
+typedef IOPhysicalLength32 IOPhysicalLength;
+#define IOPhysical32( hi, lo ) (lo)
+#define IOPhysSize 32
+
+#endif
+
+
+typedef struct
+{
+ IOPhysicalAddress address;
+ IOByteCount length;
+} IOPhysicalRange;
+
+typedef struct
+{
+ IOVirtualAddress address;
+ IOByteCount length;
+} IOVirtualRange;
+
+#ifdef __LP64__
+typedef IOVirtualRange IOAddressRange;
+#else /* !__LP64__ */
+typedef struct
+{
+ mach_vm_address_t address;
+ mach_vm_size_t length;
+} IOAddressRange;
+#endif /* !__LP64__ */
+
+/*
+ * Map between #defined or enum'd constants and text description.
+ */
+typedef struct {
+ int value;
+ const char *name;
+} IONamedValue;
+
+
+/*
+ * Memory alignment -- specified as a power of two.
+ */
+typedef unsigned int IOAlignment;
+
+#define IO_NULL_VM_TASK ((vm_task_t)0)
+
+
+/*
+ * Pull in machine specific stuff.
+ */
+
+//#include
+
+#ifndef MACH_KERNEL
+
+#ifndef __IOKIT_PORTS_DEFINED__
+#define __IOKIT_PORTS_DEFINED__
+#ifdef KERNEL
+typedef struct OSObject * io_object_t;
+#else /* KERNEL */
+typedef mach_port_t io_object_t;
+#endif /* KERNEL */
+#endif /* __IOKIT_PORTS_DEFINED__ */
+
+#include
+
+typedef io_object_t io_connect_t;
+typedef io_object_t io_enumerator_t;
+typedef io_object_t io_iterator_t;
+typedef io_object_t io_registry_entry_t;
+typedef io_object_t io_service_t;
+
+#define IO_OBJECT_NULL ((io_object_t) 0)
+
+#endif /* MACH_KERNEL */
+
+// IOConnectMapMemory memoryTypes
+enum {
+ kIODefaultMemoryType = 0
+};
+
+enum {
+ kIODefaultCache = 0,
+ kIOInhibitCache = 1,
+ kIOWriteThruCache = 2,
+ kIOCopybackCache = 3,
+ kIOWriteCombineCache = 4
+};
+
+// IOMemory mapping options
+enum {
+ kIOMapAnywhere = 0x00000001,
+
+ kIOMapCacheMask = 0x00000700,
+ kIOMapCacheShift = 8,
+ kIOMapDefaultCache = kIODefaultCache << kIOMapCacheShift,
+ kIOMapInhibitCache = kIOInhibitCache << kIOMapCacheShift,
+ kIOMapWriteThruCache = kIOWriteThruCache << kIOMapCacheShift,
+ kIOMapCopybackCache = kIOCopybackCache << kIOMapCacheShift,
+ kIOMapWriteCombineCache = kIOWriteCombineCache << kIOMapCacheShift,
+
+ kIOMapUserOptionsMask = 0x00000fff,
+
+ kIOMapReadOnly = 0x00001000,
+
+ kIOMapStatic = 0x01000000,
+ kIOMapReference = 0x02000000,
+ kIOMapUnique = 0x04000000
+#ifdef XNU_KERNEL_PRIVATE
+ , kIOMap64Bit = 0x08000000
+#endif
+};
+
+/*! @enum Scale Factors
+ @discussion Used when a scale_factor parameter is required to define a unit of time.
+ @constant kNanosecondScale Scale factor for nanosecond based times.
+ @constant kMicrosecondScale Scale factor for microsecond based times.
+ @constant kMillisecondScale Scale factor for millisecond based times.
+ @constant kTickScale Scale factor for the standard (100Hz) tick.
+ @constant kSecondScale Scale factor for second based times. */
+
+enum {
+ kNanosecondScale = 1,
+ kMicrosecondScale = 1000,
+ kMillisecondScale = 1000 * 1000,
+ kSecondScale = 1000 * 1000 * 1000,
+ kTickScale = (kSecondScale / 100)
+};
+
+/* compatibility types */
+
+#ifndef KERNEL
+
+typedef unsigned int IODeviceNumber;
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ! __IOKIT_IOTYPES_H */
diff --git a/include/IOKit/OSKext.h b/include/IOKit/OSKext.h
new file mode 100644
index 0000000..2da9b41
--- /dev/null
+++ b/include/IOKit/OSKext.h
@@ -0,0 +1,2752 @@
+/*
+ * Copyright (c) 2008 Apple Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ *
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ *
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+#ifndef __OSKEXT_H__
+#define __OSKEXT_H__
+
+#include
+
+__BEGIN_DECLS
+
+#include
+//#include
+//#include
+//#include
+#include
+#include
+
+// xxx - should I use "Clear" everywhere I use "Flush"
+
+/*!
+ * @header
+ * @ignore CF_EXPORT
+ * @ignore
+ *
+ * The OSKext library provides a comprehensive interface for creating,
+ * examining, and loading kernel extensions (kexts).
+ *
+ * NOTICE: This library is neither thread-safe nor garbage-collection
+ * safe. You must use your own locking with threads sharing access to OSKext.
+ * You can not use this library in an application with garbage collection.
+ */
+
+#pragma mark Types and Constants
+/*******************************************************************************
+* Types and Constants
+*******************************************************************************/
+
+/*!
+ * @typedef OSKextRef
+ * @abstract A reference to a kernel extension object.
+ *
+ * @discussion
+ * The OSKextRef type refers to a KXKext object, which represents a kernel
+ * extension bundle on disk, from an archive, or loaded into the kernel.
+ * OSKext is an opaque type that defines the characteristics and behavior of
+ * OSKext objects.
+ *
+ * The kernel counterpart of OSKext is the OSKext libkern C++ class.
+ */
+typedef struct __OSKext * OSKextRef
+ ;
+
+#define kOSKextBundleExtension "kext"
+#define kOSKextMkextExtension "mkext"
+
+/*!
+ * @typedef OSKextDiagnosticsFlags
+ * @constant kOSKextDiagnosticsFlagAll
+ * @constant kOSKextDiagnosticsFlagValidation
+ * @constant kOSKextDiagnosticsFlagAuthentication
+ * @constant kOSKextDiagnosticsFlagDependencies
+ * @constant kOSKextDiagnosticsFlagWarnings
+ */
+enum {
+ kOSKextDiagnosticsFlagNone = (UInt32) 0x0U,
+
+ kOSKextDiagnosticsFlagValidation = (UInt32) 0x1U,
+ kOSKextDiagnosticsFlagAuthentication = (UInt32) 0x2U,
+ kOSKextDiagnosticsFlagDependencies = (UInt32) 0x4U,
+ kOSKextDiagnosticsFlagWarnings = (UInt32) 0x8U,
+
+ kOSKextDiagnosticsFlagAll = (UInt32)0xFFFFFFFFU,
+};
+typedef UInt32 OSKextDiagnosticsFlags;
+typedef UInt64 OSKextLogFlags;
+typedef SInt64 OSKextVersion;
+typedef kern_return_t OSReturn;
+
+typedef uint8_t OSKextExcludeLevel;
+#define kOSKextExcludeNone (0)
+#define kOSKextExcludeKext (1)
+#define kOSKextExcludeAll (2)
+
+/* Top-level keys for diagnostics dicts. See @link OSKextCopyDiagnostics@/link.
+ */
+// xxx - not sure we need to include these, but it's convenient
+const CFStringRef kOSKextDiagnosticsValidationKey;
+const CFStringRef kOSKextDiagnosticsAuthenticationKey;
+const CFStringRef kOSKextDiagnosticsLinkLoadKey;
+const CFStringRef kOSKextDiagnosticsDependenciesKey;
+const CFStringRef kOSKextDiagnosticsWarningsKey;
+
+#pragma mark Basic CF Functions
+/*********************************************************************
+* Basic CF Functions
+*********************************************************************/
+
+/*!
+ * @function OSKextGetTypeID
+ * @abstract Returns the type identifier for the OSKext opaque type.
+ *
+ * @result The type identifier for the OSKext opaque type.
+ */
+CF_EXPORT CFTypeID
+OSKextGetTypeID(void)
+ ;
+
+#pragma mark Module Configuration
+/*********************************************************************
+* Module Configuration
+*********************************************************************/
+
+/*!
+ * @function OSKextSetArchitecture
+ * @abstract Sets the architecture used for operations on kexts.
+ *
+ * @param anArch
+ * An NXArchInfo pointer with cputype/subtype or name set.
+ * Ownership remains with the caller.
+ * Pass NULL to set the architecture to taht of the running kernel.
+ *
+ * @result
+ * true if the architecture was set as desired,
+ * false if anArch was not found;
+ * if false, the architecture will now be that
+ * of the running kernel.
+ * xxx - should it just be left unchanged instead?
+ *
+ * @discussion
+ * The kext library uses this architecture for any architecture-specific
+ * operation, such as property lookups
+ * (see @link OSKextGetValueForInfoDictionaryKey@/link),
+ * dependency resolution, executable access during validation and linking.
+ * The kext architecture is initially that of the running kernel (not of
+ * the user-space process).
+ *
+ * This function looks up the system NXArchInfo struct
+ * for the struct passed in, first using the cputype/subtype, and if that fails,
+ * the name. You can therefore use this function to set the architecture
+ * from an architecture name alone by passing an NXArchInfo struct
+ * with the desired name,
+ * but the cputype/subtype set to CPU_TYPE_ANY and CPU_SUBTYPE_ANY.
+ *
+ * Changing the kext architecture causes all kexts to flush their load info
+ * and dependencies with @link OSKextFlushLoadInfo@/link.
+ */
+// xxx - should this also have a flushDependenciesFlag?
+CF_EXPORT Boolean
+OSKextSetArchitecture(const NXArchInfo * archInfo)
+ ;
+
+/*!
+ * @function OSKextGetArchitecture
+ * @abstract Gets the architecutre used for operations on kexts.
+ *
+ * @result
+ * The architecture used for operations on kexts.
+ * The caller does not own the returned pointer and should not free it.
+ *
+ * @discussion
+ * The kext library uses this architecture for any architecture-specific
+ * operation, such as property lookups
+ * (see @link OSKextGetValueForInfoDictionaryKey@/link),
+ * dependency resolution, executable access during validation and linking.
+ * The kext architecture is initially that of the running kernel (not of
+ * the user-space process).
+ */
+CF_EXPORT const NXArchInfo *
+OSKextGetArchitecture(void)
+ ;
+
+/*!
+ * @function OSKextGetRunningKernelArchitecture
+ * @abstract Returns the architecture of the running kernel.
+ *
+ * @result
+ * The architecture of the running kernel.
+ * The caller does not own the returned pointer and should not free it.
+ *
+ * @discussion
+ * This function consults the kernel task and returns a pointer to the
+ * NXArchInfo struct representing its architecture.
+ * The running kernel's architecture does not necessarily match that
+ * of user space tasks (for example, a 32-bit user space task could be
+ * running with a 64-bit kernel, or vice-versa).
+ */
+CF_EXPORT const NXArchInfo *
+OSKextGetRunningKernelArchitecture(void)
+ ;
+
+/*! @function OSKextGetLogFlags
+ @param kext The kext to get the log flags. Pass NULL to get the global flag. */
+CF_EXPORT OSKextLogFlags OSKextGetLogFlags(OSKextRef kext);
+/*! @function OSKextSetLogFlags */
+CF_EXPORT void OSKextSetLogFlags(OSKextRef kext, OSKextLogFlags logFlags);
+
+/*!
+ * @typedef OSKextLogFunction
+ * @abstract
+ * Prototype of a callback function used to log messages from the library.
+ *
+ * @param format A printf(3) style format string.
+ *
+ * @discussion
+ * The default log function simply prints to stderrmsgLogSpec has any bits set.
+ * If you set the log function to NULL,
+ * no log messages will be printed.
+ *
+ * Log messages have no trailing newline, to accommodate system log facilities.
+ */
+/* xxx - no CF_EXPORT, compiler dies */
+typedef void (*OSKextLogFunction)(
+ OSKextLogFlags flags,
+ const char * format,
+ ...)
+ ;
+
+/*!
+ * @function OSKextSetLogFunction
+ * @abstract Sets the function called to log messages.
+ *
+ * @param funct The log function to set.
+ *
+ * @discussion
+ * The default log function simply prints to stderr. If you set the
+ * log function to NULL, no log messages will be printed.
+ *
+ * Log messages have no trailing newline, to accommodate system log facilities.
+ */
+CF_EXPORT void
+OSKextSetLogFunction(OSKextLogFunction func)
+ ;
+
+/*!
+ * @function OSKextSetSimulatedSafeBoot
+ * @abstract Sets whether safe boot mode is simulated in the library.
+ *
+ * @param flag true to simulate safe boot mode,
+ * false to not simulate.
+ *
+ * @discussion
+ * Kexts without a valid OSBundleRequired property are not allowed to load
+ * by the kernel when the system has started in safe boot mode.
+ * If you turn on simulated safe boot, the kext library can
+ * catch non-loadable kexts and present appropriate diagnostics.
+ */
+CF_EXPORT void
+OSKextSetSimulatedSafeBoot(Boolean flag)
+ ;
+
+/*!
+ * @function OSKextGetSimulatedSafeBoot
+ * @abstract Returns whether safe boot mode is simulated in the library.
+ *
+ * @result
+ * true if safe boot mode is being simulated,
+ * false if not.
+ *
+ * @discussion
+ * Kexts without a valid OSBundleRequired property are not allowed to load
+ * by the kernel when the system has started in safe boot mode.
+ * When simulated safe boot is on, the kext library can
+ * catch non-loadable kexts and present appropriate diagnostics.
+ */
+CF_EXPORT Boolean
+OSKextGetSimulatedSafeBoot(void)
+ ;
+
+/*!
+ * @function OSKextGetActualSafeBoot
+ * @abstract Returns whether safe boot mode is active.
+ *
+ * @result
+ * true if safe boot mode is active,
+ * false if not.
+ *
+ * @discussion
+ * Kexts without a valid OSBundleRequired property are not allowed to load
+ * by the kernel when the system has started in safe boot mode.
+ * The kext library ignores actual safe boot mode, leaving decisions
+ * regarding safe boot to the kernel.
+ * If you want to analyze kexts in safe boot mode using the library,
+ * call @link OSKextSetSimulatedSafeBoot@/link.
+ */
+// xxx - we used to disallow kexts w/debug-log flags in safe boot, too
+CF_EXPORT Boolean
+OSKextGetActualSafeBoot(void)
+ ;
+
+/*!
+ * @function OSKextGetSystemExtensionsFolderURLs
+ * @abstract Returns the standard system extension folder URLs.
+ *
+ * @result
+ * An array containing the standard system extension folder URLs.
+ * Ownership follows the
+ * @link //apple_ref/doc/uid/20001148-SW1 Get Rule@/link.
+ *
+ * @discussion
+ * To open all the kexts normally considered for loading by the system,
+ * pass the return value of this function to
+ * @link OSKextCreateKextsFromURLs@/link.
+ */
+CF_EXPORT CFArrayRef
+OSKextGetSystemExtensionsFolderURLs(void)
+ ;
+
+/*!
+ * @function OSKextSetRecordsDiagnostics
+ * @abstract Sets whether kexts record diagnostic information.
+ *
+ * @param flags Indicates which diagnostics to record.
+ *
+ * @discussion
+ * The kext library can record diagnostic information for kexts as
+ * problems are encountered. These diagnostics can consume a fair
+ * amount of memory, and should be generated only when desired.
+ * Recording of diagnostics is set to
+ * @link kOSKextDiagnosticsFlagNone@/link by default.
+ * Use this function to turn diagnostics recording off (or back on)
+ * for particular diagnostic types.
+ *
+ * Turning on diagnostics does not calculate or recalculate
+ * diagnostics. Call the various functions that operate on kexts
+ * to begin accumulating diagnostics.
+ *
+ * Turning diagnostics off does not clear any existing diagnostics.
+ * Use @link OSKextFlushDiagnostics@/link explicitly to clear
+ * any diagnostics currently stored.
+ *
+ * See also @link OSKextCopyDiagnostics@/link,
+ * @link OSKextValidate@/link,
+ * @link OSKextAuthenticate@/link, and
+ * @link OSKextResolveDependencies@/link.
+ */
+// Could list a pile of see also's here....
+CF_EXPORT void
+OSKextSetRecordsDiagnostics(OSKextDiagnosticsFlags flags)
+ ;
+
+/*!
+ * @function OSKextGetRecordsDiagnostics
+ * @abstract
+ * Returns what kinds of diagnostic information kexts record.
+ *
+ * @result
+ * Flags indicating which types of diagnostics are currently
+ * being recorded. You can bitwise-OR or -AND these with other flags
+ * to add or remove diagnostics being recorded with
+ * @link OSKextSetRecordsDiagnostics@/link.
+ */
+CF_EXPORT OSKextDiagnosticsFlags
+OSKextGetRecordsDiagnostics(void)
+ ;
+
+
+/*!
+ * @function OSKextSetUsesCaches
+ * @abstract Sets whether the kext library uses cache files.
+ *
+ * @param flag
+ * true to use caches,
+ * false to not use caches.
+ *
+ * @discussion
+ * The kext library normally uses caches to speed up reading kexts from
+ * the system extensions folders.
+ * Use this function to turn off use of caches; this will cause reading
+ * of kexts to be dramatically slower.
+ *
+ * See also @link OSKextGetUsesCaches@/link.
+ */
+CF_EXPORT void
+OSKextSetUsesCaches(Boolean flag)
+ ;
+
+/*!
+ * @function OSKextGetUsesCaches
+ * @abstract
+ * Returns whether the OSKext library uses cache files.
+ *
+ * @result
+ * true if the library uses caches to speed up reading of kexts,
+ * false if it doesn't.
+ *
+ * @discussion
+ * The kext library normally uses caches to speed up reading kexts from
+ * the system extensions folders.
+ * Use this function to check whether the library is using caches.
+ *
+ * See also @link OSKextGetUsesCaches@/link.
+ */
+CF_EXPORT Boolean
+OSKextGetUsesCaches(void)
+ ;
+
+#pragma mark Instance Management
+/*********************************************************************
+* Instance Management
+*********************************************************************/
+
+/*!
+ * @function OSKextCreate
+ * @abstract Read a single kext from an on-disk bundle, without plugins.
+ *
+ * @param allocator
+ * The allocator to use to allocate memory for the new object.
+ * Pass NULL or kCFAllocatorDefault
+ * to use the current default allocator.
+ * @param anURL
+ * The location of the bundle for which to create an OSKext object.
+ * @result
+ * An OSKext object created from the bundle at anURL.
+ * Ownership follows the
+ * @link //apple_ref/doc/uid/20001148-103029 Create Rule@/link.
+ *
+ * Returns NULL if there was a memory allocation problem or
+ * if the bundle doesn't exist at anURL (see Discussion).
+ * May return an existing OSKext object with the reference count incremented.
+ *
+ * @discussion
+ * Once a kext has been created, it is cached in memory; the kext bundle cache
+ * is flushed only periodically. OSKextCreate does not check that a cached kext
+ * bundle still exists in the filesystem. If a kext bundle is deleted
+ * from the filesystem, it is therefore possible for OSKextCreate
+ * to return a cached bundle that has actually been deleted.
+ *
+ * OSKext uses a CFBundle briefly during initialization, but in order
+ * to save memory and allow re-reading of kext bundle contents
+ * from disk, does not retain it. Applications can save further memory
+ * by flushing info dictionaries so that they are read from disk again
+ * when needed; see @link OSKextFlushInfoDictionary@/link.
+ */
+CF_EXPORT OSKextRef
+OSKextCreate(
+ CFAllocatorRef allocator,
+ CFURLRef anURL)
+ ;
+
+/*!
+ * @function OSKextCreateKextsFromURL
+ * @abstract Reads all kexts at an on-disk URL along with their plugins.
+ *
+ * @param allocator
+ * The allocator to use to allocate memory for the new objects.
+ * Pass NULL or kCFAllocatorDefault
+ * to use the current default allocator.
+ * @param anURL The URL to scan for kernel extensions.
+ * @result
+ * Returns an array containing the kext objects created,
+ * or NULL on failure.
+ *
+ * @discussion
+ * This function scans anURL for kexts.
+ * If anURL represents a kext,
+ * this function reads that kext and its plugins.
+ * If anURL represents a non-kext directory,
+ * this functions scans the directory's immediate contents for kext bundles
+ * and their plugins. It does not scan recursively; only plugins one level
+ * deep are read.
+ *
+ * If given an URL for a kext that is a plugin of another kext, this
+ * function does not scan for further plugins.
+ *
+ * This function does not scan for or read mkext files. Use
+ * @link OSKextCreateKextsFromMkextFile@/link to read an mkext file.
+ *
+ * See @link OSKextCreate OSKextCreate @/link for information
+ * about kext object caching.
+ */
+CFArrayRef OSKextCreateKextsFromURL(
+ CFAllocatorRef allocator,
+ CFURLRef anURL)
+ ;
+
+/*!
+ * @function OSKextCreateKextsFromURLs
+ * @abstract Reads all kexts at an array on-disk URLs along with their plugins.
+ *
+ * @param allocator
+ * The allocator to use to allocate memory for the new objects.
+ * Pass NULL or kCFAllocatorDefault
+ * to use the current default allocator.
+ * @param arrayOfURLs The URLs to scan for kernel extensions.
+ * @result
+ * Returns an array containing the kext objects created,
+ * or NULL on failure.
+ *
+ * @discussion
+ * This function scans each URL in arrayOfURLs for kexts.
+ * If a given URL represents a kext,
+ * this function reads that kext and its plugins.
+ * If the URL represents a non-kext directory, this functions scans the
+ * directory's immediate contents for kext bundles and their plugins.
+ * It does not scan recursively; only plugins one level deep are read.
+ *
+ * If given an URL for a kext that is a plugin of another kext, this
+ * function does not scan for further plugins.
+ *
+ * This function does not scan for or read mkext files. Use
+ * @link OSKextCreateKextsFromMkextFile@/link to read an mkext file.
+ *
+ * See @link OSKextCreate@/link for discussion about kext object caching.
+ */
+CF_EXPORT CFArrayRef
+OSKextCreateKextsFromURLs(
+ CFAllocatorRef allocator,
+ CFArrayRef arrayOfURLs)
+ ;
+
+/*!
+ * @function OSKextGetAllKexts
+ * @abstract
+ * Returns an array containing all of the kexts currently open in the application.
+ *
+ * @result
+ * A CFArray object containing OSKext objects for each open kext
+ * in the application. Ownership follows the
+ * @link //apple_ref/doc/uid/20001148-SW1 Get Rule@/link.
+ *
+ * @discussion
+ * This function is potentially expensive, so use with care.
+ */
+CF_EXPORT CFArrayRef
+OSKextGetAllKexts(void)
+ ;
+
+/*! @function OSKextCopyKextsWithIdentifier */
+CF_EXPORT CFArrayRef OSKextCopyKextsWithIdentifier(CFStringRef bundleID);
+/*! @function OSKextGetKextsWithIdentifiers
+ @discussion Follows Create Rule.
+ */
+CF_EXPORT CFArrayRef OSKextGetKextsWithIdentifiers(CFArrayRef bundleIDs);
+
+/*!
+ * @function OSKextGetKextWithIdentifierAndVersion
+ * @abstract
+ * Locate a kext given its program-defined identifier and version.
+ *
+ * @param aBundleID
+ * The identifier of the kext to locate.
+ * Note that identifier names are case-sensitive.
+ * @param aVersion
+ * The version of the kext to locate.
+ * @result
+ * An OSKext object, or NULL if the kext was not found.
+ * Ownership follows the
+ * @link //apple_ref/doc/uid/20001148-SW1 Get Rule@/link.
+ *
+ * @discussion
+ * For a kext to be located using its identifier and version,
+ * the kext object must have already been created.
+ * See @link OSKextGetKextWithIdentifierAndVersion@/link for more.
+ */
+// xxx - check on same-version ordering with folks
+CF_EXPORT OSKextRef
+OSKextGetKextWithIdentifierAndVersion(
+ CFStringRef aBundleID, OSKextVersion aVersion)
+ ;
+
+/*!
+ * @function OSKextGetKextsWithIdentifier
+ * @abstract Locate all kexts with a given program-defined identifier.
+ *
+ * @param aBundleID
+ * The identifier of the kext to locate.
+ * Note that identifier names are case-sensitive.
+ * @result
+ * An CFArray of kext objects with the given identifier,
+ * or NULL on error.
+ * Ownership follows the
+ * @link //apple_ref/doc/uid/20001148-103029 Create Rule@/link.
+ *
+ * @discussion
+ * This function is useful for locating duplicates of a given kext.
+ *
+ * See @link OSKextGetKextWithIdentifier@/link for general information
+ * on looking up kexts by identifier.
+ */
+CF_EXPORT CFArrayRef
+OSKextCopyKextsWithIdentifier(
+ CFStringRef aBundleID)
+ ;
+
+/*!
+ * @function OSKextGetLoadedKextWithIdentifier
+ * @abstract
+ * Locate the loaded kext with a given program-defined identifier.
+ *
+ * @param aBundleID
+ * The identifier of the kext to locate.
+ * Note that identifier names are case-sensitive.
+ * @result
+ * An OSKext object, or NULL if the kext was not found.
+ * Ownership follows the
+ * @link //apple_ref/doc/uid/20001148-SW1 Get Rule@/link.
+ *
+ * @discussion
+ * You must call @link OSKextReadLoadedKextInfo@/link before calling this
+ * function for it to find anything.
+ *
+ * See @link OSKextGetKextWithIdentifier@/link for general information
+ * on looking up kexts by identifier.
+ */
+CF_EXPORT OSKextRef
+OSKextGetLoadedKextWithIdentifier(
+ CFStringRef aBundleID)
+ ;
+
+/*!
+ * @function OSKextGetCompatibleKextWithIdentifier
+ * @abstract
+ * Locate the kext with a given program-defined identifier
+ * that is compatible with a requested version.
+ *
+ * @param aBundleID
+ * The identifier of the kext to locate.
+ * Note that identifier names are case-sensitive.
+ * @param requestedVersion
+ * The version that the kext must be compatible with.
+ * @result
+ * An OSKext object, or NULL if the kext was not found.
+ * Ownership follows the
+ * @link //apple_ref/doc/uid/20001148-SW1 Get Rule@/link.
+ *
+ * @discussion
+ * A kext is compatible with a version if that version lies between
+ * its CFBundleVersion and its OSBundleCompatibleVersion (inclusive).
+ *
+ * See @link OSKextGetKextWithIdentifier@/link for general information
+ * on looking up kexts by identifier.
+ */
+CF_EXPORT OSKextRef
+OSKextGetCompatibleKextWithIdentifier(
+ CFStringRef aBundleID,
+ OSKextVersion requestedVersion)
+ ;
+
+#pragma mark Basic Accessors
+/*********************************************************************
+* Basic Accessors
+*********************************************************************/
+
+/*!
+ * @function OSKextGetURL
+ * @abstract Returns the CFURL of a kext bundle.
+ *
+ * @param aKext The kext to get the URL for.
+ * @result A CFURL object. Ownership follows the
+ * @link //apple_ref/doc/uid/20001148-SW1 Get Rule@/link.
+ *
+ * @discussion
+ * This function returns the CFURL that aKext
+ * was originally created with.
+ * It should be resolved to its base for comparison with other kext
+ * URLs.
+ */
+CF_EXPORT CFURLRef
+OSKextGetURL(OSKextRef aKext)
+ ; // always absolute
+
+/*!
+ * @function OSKextGetIdentifier
+ * @abstract Returns the bundle identifier from a kext's information property list.
+ *
+ * @param aKext The kext to get the identifier for.
+ * @result
+ * A CFString object containing the kext bundle's identifier,
+ * or NULL if none was specified in the information property list.
+ * Ownership follows the
+ * @link //apple_ref/doc/uid/20001148-SW1 Get Rule@/link.
+ */
+CF_EXPORT CFStringRef
+OSKextGetIdentifier(OSKextRef aKext)
+ ;
+
+/*!
+ * @function OSKextGetValueForInfoDictionaryKey
+ * @abstract
+ * Returns a (possibly architecture-specific) value
+ * in a kext's information dictionary.
+ *
+ * @param aKext The kext to get the property for.
+ * @param key The base key identifying the property.
+ * @result
+ * A value corresponding to key in aKext's
+ * information dictionary.
+ * If available, an architecture-specific value is returned,
+ * otherwise the global value is returned. Ownership follows the
+ * @link //apple_ref/doc/uid/20001148-SW1 Get Rule@/link.
+ *
+ * @discussion
+ * This function first looks for a property value specific to the current kext
+ * architecture, as set with @link OSKextSetArchitecture@/link,
+ * by appending an underscore plus the architecture name to the base key.
+ * If such a value is not found, it looks for the property using the base key.
+ * For example, if the currently set architecture is i386, and
+ * IOKitPersonalities is requested, this function looks up the key
+ * IOKitPersonalities_i386; if that doesn't exist, then it uses
+ * IOKitPersonalities.
+ *
+ * Some properties are not allowed to be made architecture-specific;
+ * if such keys are defined, they are ignored by this function:
+ *
+ * * CFBundleIdentifier
+ * * CFBundleVersion
+ * * CFBundleExecutable
+ * * OSBundleIsInterface
+ * * OSKernelResource
+ *
+ * This function looks up architecture-specific values for generic bundle
+ * properties, such as CFBundlePackageType, but such values are of course
+ * ignored by CFBundle.
+ *
+ * If you want to look up a property with a raw key, get the information
+ * dictionary directly using @link OSKextCopyInfoDictionary@/link or
+ * by opening a CFBundle for the kext's URL.
+ *
+ * This function reads the info dictionary from disk if necessary.
+ * See @link OSKextFlushInfoDictionary@/link.
+ */
+CF_EXPORT CFTypeRef
+OSKextGetValueForInfoDictionaryKey(
+ OSKextRef aKext,
+ CFStringRef key)
+ ;
+
+/*!
+ * @function OSKextCopyInfoDictionary
+ * @abstract Returns a copy of a kext's information dictionary.
+ *
+ * @param aKext The kext to get the information dictionary for.
+ * @result
+ * A CFDictionary object containing the data stored in the kext's
+ * information property list.
+ * OSKext may add extra keys to this dictionary for its own use.
+ * Ownership follows the
+ * @link //apple_ref/doc/uid/20001148-103029 Create Rule@/link.
+ *
+ * @discussion
+ * This function uses @link IOCFUnserialize@/link to parse the XML
+ * of the info dictionary, in order to match the parsing used in the kernel.
+ */
+CF_EXPORT CFMutableDictionaryRef
+OSKextCopyInfoDictionary(OSKextRef aKext)
+ ;
+
+/*!
+ * @function OSKextFlushInfoDictionary
+ * @abstract Releases a kext's info dictionary.
+ *
+ * @param aKext The kext that should release its info dictionary.
+ * If NULL, all open kexts' info dictionaries
+ * are flushed.
+ *
+ * @discussion
+ * OSKexts accumulate a fair amount of information as they are created
+ * and used; when many kext objects are created the total memory
+ * consumption can be significant. If an application won't be using
+ * kexts for long periods of time, it can flush this information
+ * to save memory; the information will later be re-read from disk
+ * or recreated as necessary.
+ *
+ * Flushing info dictionaries also allows kext objects to synchronize
+ * with updates on disk; they will automatically re-sort in the
+ * internal lookup tables to reflect changed versions, for example.
+ * (xxx - well they will! that's not fully implemented yet)
+ *
+ * See also @link OSKextFlushDependencies@/link,
+ * @link OSKextFlushLoadInfo@/link,
+ * and @link OSKextFlushDiagnostics@/link.
+ *
+ * Kext objects created from an mkext cannot flush their info
+ * dictionaries.
+ */
+CF_EXPORT void
+OSKextFlushInfoDictionary(OSKextRef aKext)
+ ;
+
+/*!
+ * @function OSKextGetVersion
+ * @abstract Returns the version of a kext.
+ *
+ * @param aKext The kext to get the version for.
+ * @result The version of the kext as a 64-bit integer.
+ *
+ * @discussion
+ * xxx - needs more info on version format
+ * xxx - need to fix definition of OSKextVersion.
+ */
+CF_EXPORT OSKextVersion
+OSKextGetVersion(OSKextRef aKext)
+ ;
+
+/*!
+ * @function OSKextGetCompatibleVersion
+ * @abstract Returns the compatible version of a kext
+ *
+ * @param aKext The kext to get the compatible version for.
+ * @result The compatible version of the kext as a 64-bit integer.
+ *
+ * @discussion
+ * This function returns the value of a kext's OSBundleCompatibleVersion
+ * property, parsed into a 64-bit integer that can be compared using
+ * standard integer comparison operators.
+ *
+ * xxx - needs more info on version format, ref to tn: http://developer.apple.com/technotes/tn/tn1132.html
+ */
+CF_EXPORT OSKextVersion
+OSKextGetCompatibleVersion(OSKextRef aKext)
+ ;
+
+/*!
+ * @function OSKextCopyUUIDForArchitecture
+ * @abstract
+ * Returns the compiler-generated UUID of a kext for a given architecture.
+ *
+ * @param aKext The kext to get the UUID for.
+ * @param anArch The architecture desired.
+ * Pass NULL to get the UUID for the
+ * current architecture.
+ * @result
+ * A CFData object containing the UUID of the kext's executable
+ * for anArch, or the currently set architecture if
+ * anArch is NULL.
+ *
+ * @discussion
+ * UUIDs are used in addition to bundle versions to check the identify of
+ * kexts loaded in the kernel.
+ */
+CF_EXPORT CFDataRef
+OSKextCopyUUIDForArchitecture(OSKextRef aKext,
+ const NXArchInfo * anArch)
+ ;
+
+/*!
+ * @function OSKextIsKernelComponent
+ * @abstract Returns whether a kext represents a kerne programming interface.
+ *
+ * @param aKext The kext to examine.
+ * @result
+ * true if aKext represents
+ * a kerne programming interface, false otherwise.
+ *
+ * @discussion
+ * A small set of kexts represent interfaces built into the kernel that can
+ * be linked against individually. These are commonly known as
+ * kernel programming interfaces (KPIs),
+ * and the kexts containing them as "pseudokexts".
+ *
+ * If a kext is a kernel component, then it is also always an interface
+ * (see @link OSKextIsInterface@/link).
+ */
+CF_EXPORT Boolean
+OSKextIsKernelComponent(OSKextRef aKext)
+ ;
+
+/*!
+ * @function OSKextIsInterface
+ * @abstract
+ * Returns whether a kext acts as a linkage subset for another kext,
+ * also known as a symbol set.
+ *
+ * @param aKext The kext to examine.
+ * @result
+ * true if aKext is an interface kext,
+ * false otherwise.
+ *
+ * @discussion
+ * An interface kext has no actual code in its executable, but merely
+ * re-exports a set of symbols (typically a subset)
+ * from those of its dependencies.
+ *
+ * Currently the only interface kexts are the kernel component kexts
+ * the define the kernel programming interfaces for Mac OS X.
+ */
+CF_EXPORT Boolean
+OSKextIsInterface(OSKextRef aKext)
+ ;
+
+/*!
+ * @function OSKextIsLibrary
+ * @abstract Returns whether a kext can be declared as a library.
+ *
+ * @param aKext The kext to examine.
+ * @result
+ * true if aKext is a library kext, false
+ * otherwise.
+ *
+ * @discussion
+ * A kext is a library kext if it has a valid OSBundleCompatibleVersion
+ * property. Another kext can link against a library kext by listing
+ * the library's identifier and required version in its OSBundleLibraries
+ * property.
+ */
+CF_EXPORT Boolean
+OSKextIsLibrary(OSKextRef aKext)
+ ;
+
+/*!
+ * @function OSKextDeclaresExecutable
+ * @abstract Returns whether a kext declares a CFBundleExecutable property.
+ *
+ * @param aKext The kext to examine.
+ * @result
+ * true if aKext has a nonempty CFBundleExecutable
+ * property, false otherwise.
+ *
+ * @discussion
+ * A kext with an executable is either a loadable kext with actual executable
+ * code, or an interface kext whose executable serves to restrict linkage
+ * to a subset of the symbols of another kext. See @link OSKextIsInterface@/link
+ * for more on the latter type.
+ */
+CF_EXPORT Boolean
+OSKextDeclaresExecutable(OSKextRef aKext)
+ ;
+
+/*!
+ * @function OSKextHasLogOrDebugFlags
+ * @abstract
+ * Returns whether a kext has OSBundleEnableKextLogging set to a true value or
+ * any of its IOKitPersonalities has a nonzero IOKitDebug property.
+ *
+ * @param aKext The kext to examine.
+ * @result
+ * true if aKext has a true OSBundleEnableKextLogging
+ * property or if any personality for the currently set architecture has a
+ * nonzero IOKitDebug property, false otherwise.
+ *
+ * @discussion
+ * Kexts built for distribution should not have any logging or debug flags set.
+ */
+CF_EXPORT Boolean
+OSKextHasLogOrDebugFlags(OSKextRef aKext)
+ ;
+
+/*!
+ * @function OSKextIsLoadableInSafeBoot
+ * @abstract Returns whether the kernel will load a kext during safe boot.
+ *
+ * @param aKext The kext to examine.
+ * @result
+ * true if the kernel will allow aKext during
+ * safe boot, false otherwise.
+ *
+ * @discussion
+ * A kext is loadable during safe boot if it has an OSBundleRequired
+ * property for the kernel's architecture with a value of
+ * "Root", "Local-Root", "Network-Root", "Console", or "Safe Boot".
+ *
+ * This function does not generally cover the issue of loadability due
+ * to problems with validation, authentication, or dependency resolution.
+ * To determine whether a kext can actually be loaded, use
+ * @link OSKextIsLoadable@/link.
+ */
+CF_EXPORT Boolean
+OSKextIsLoadableInSafeBoot(OSKextRef aKext)
+ ;
+
+/*!
+ * @function OSKextCopyArchitectures
+ * @abstract
+ * Returns a list of NXArchInfo structs for the architectures
+ * found in a kext's executable.
+ *
+ * @param aKext The kext to examine.
+ * @result
+ * A NULL-terminated list of NXArchInfo
+ * struct pointers describing
+ * the architectures supported by aKext,
+ * or NULL if aKext has no executable.
+ * The caller is responsible for freeing the list, but not the individual
+ * NXArchInfo pointers.
+ */
+CF_EXPORT const NXArchInfo **
+OSKextCopyArchitectures(OSKextRef aKext)
+ ;
+
+/*!
+ * @function OSKextSupportsArchitecture
+ * @abstract Returns whether a kext has an executable for a given architecture.
+ *
+ * @param aKext The kext to examine.
+ * @param anArch The NXArchInfo description to check.
+ * If NULL, uses the currently set architecture.
+ * @result
+ * true if aKext's executable contains code for
+ * anArch.
+ *
+ * @discussion
+ */
+// null for current (NOT host) arch
+Boolean OSKextSupportsArchitecture(OSKextRef aKext,
+ const NXArchInfo * anArch)
+; // if NULL, uses current default
+
+/*!
+ * @function OSKextCopyPlugins
+ * @abstract Retrieve the plugins of a kext.
+ *
+ * @param aKext The kext to get plugins for.
+ * @result
+ * An array containing the kexts that are plugins of aKext.
+ *
+ * @discussion
+ * This function scans the plugins folder of aKext
+ * and returns an array of the kexts found.
+ * This may result in the creation of new kext objects.
+ *
+ * If aKext is a plugin of another kext
+ * see @link OSKextIsPlugin@/link),
+ * this function returns an empty array.
+ */
+CF_EXPORT CFArrayRef
+OSKextCopyPlugins(OSKextRef aKext)
+ ;
+
+/*!
+ * @function OSKextIsPlugin
+ * @abstract Returns whether a kext is a plugin of some other kext.
+ *
+ * @param aKext The kext to examine.
+ * @result
+ * true if aKext is a plugin of another kext,
+ * false otherwise.
+ *
+ * @discussion
+ * This function uses a simple algorithm that just checks for the substring
+ * ".kext/" in the absolute path leading up to the kext's bundle name.
+ */
+CF_EXPORT Boolean
+OSKextIsPlugin(OSKextRef aKext)
+ ;
+
+/*!
+ * @function OSKextCopyContainerForPluginKext
+ * @abstract Returns the kext that is the container for a plugin kext.
+ *
+ * @param aKext The kext to find a parent for.
+ * @result
+ * The kext that contains aKext in its PlugIns folder,
+ * or NULL if aKext is not a plugin.
+ * Ownership follows the
+ * @link //apple_ref/doc/uid/20001148-103029 Create Rule@/link.
+ *
+ * @discussion
+ * This function creates a kext object for the longest portion of the
+ * path leading to aKext, then checks to see whether
+ * aKext is a plugin of that kext by CFBundle's
+ * semantics. If so, that kext is returned.
+ * This may result in the creation of a new kext.
+ */
+CF_EXPORT OSKextRef
+OSKextCopyContainerForPluginKext(OSKextRef aKext)
+ ;
+
+/*!
+ * @function OSKextCopyPersonalitiesArray
+ * @abstract Returns the personalities of a kext for the current kext architecture.
+ *
+ * @param aKext The kext to retrieve personalities for.
+ * @result An array of IOKit personality dictionaries.
+ *
+ * @discussion
+ * IOKitPersonalities in kexts require some processing before being sent
+ * to the kernel, and the functions that send personalities expect an array
+ * rather than a dictionary. This function facilitates such use.
+ *
+ * Use @link OSKextGetValueForInfoDictionaryKey@/link to retrieve the raw
+ * personalities dictionary for the current architecture.
+ */
+CF_EXPORT CFArrayRef
+OSKextCopyPersonalitiesArray(OSKextRef aKext)
+ ;
+
+// xxx - would it be awful to have a function that takes a CFTypeRef that's
+// xxx - a single kext, an array of kexts, or NULL for all open kexts?
+
+/*!
+ * @function OSKextCopyPersonalitiesOfKexts
+ * @abstract
+ * Returns the personalities of multiple kexts for the current kext architecture.
+ *
+ * @param kextArray The kexts to retrieve personalities for.
+ * Pass NULL to retrieve personalities for all open kexts.
+ * @result An array of IOKit personality dictionaries.
+ *
+ * @discussion
+ * IOKitPersonalities in kexts require some processing before being sent
+ * to the kernel, and the functions that send personalities expect an array
+ * rather than a dictionary. This function facilitates such use.
+ */
+CF_EXPORT CFArrayRef
+OSKextCopyPersonalitiesOfKexts(CFArrayRef kextArray)
+ ;
+
+/*!
+ * @function OSKextCopyExecutableForArchitecture
+ * @abstract
+ * Returns a kext's Mach-O executable, thinned to a single architecture
+ * if desired.
+ *
+ * @param aKext The kext to retrieve the executable from.
+ * @param anArch The architecture desired.
+ * Pass NULL to get the whole, unthinned exectuable.
+ * @result
+ * A CFData object containing the code
+ * for the specified architecture, or NULL if it can't be found.
+ *
+ * @discussion
+ * Note that this function does not use the default kext architecture set by
+ * @link OSKextSetArchitecture@/link when given no architecture.
+ */
+CF_EXPORT CFDataRef
+OSKextCopyExecutableForArchitecture(OSKextRef aKext,
+ const NXArchInfo * anArch)
+ ;
+
+/*!
+ * @function OSKextCopyResource
+ * @abstract Returns a named resource from a kext's bundle.
+ *
+ * @param aKext The kext to get a resource from.
+ * @param resourceName The name of the requested resource.
+ * @param resourceType The abstract type of the requested resource.
+ * The type is expressed as a filename extension,
+ * such as jpg.
+ * Pass NULL if you don’t need
+ * to search by type.
+ *
+ * @result
+ * A CFData object containing the resource file's contents,
+ * or NULL if the resource can't be found.
+ *
+ * @discussion
+ * For a kext created from an on-disk URL, this function uses CFBundle
+ * semantics to locate the resource file. Note that localized resources
+ * and resource subdirectories are not available to kexts calling
+ * @link //apple_ref/c/func/OSKextRequestResource OSKextRequestResource@/link
+ * from within the kernel (because the process providing them runs as root).
+ * You can store such resources in a kext bundle and use them in applications,
+ * but they will not be available to the kext loaded in kernel.
+ */
+CF_EXPORT CFDataRef
+OSKextCopyResource(
+ OSKextRef aKext,
+ CFStringRef resourceName,
+ CFStringRef resourceType)
+ ;
+
+#pragma mark Dependency Resolution
+/*********************************************************************
+* Dependency Resolution
+*********************************************************************/
+
+/*!
+ * @function OSKextResolveDependencies
+ * @abstract Calculate the dependency graph for a kext.
+ *
+ * @param aKext The kext to resolve dependencies for.
+ * @result
+ * true if all dependencies are successfully resolved,
+ * false otherwise.
+ *
+ * @discussion
+ * This function examines the OSBundleLibraries property of aKext
+ * and looks for compatible open kexts. Priority is given to kexts marked as
+ * loaded (see @link OSKextReadLoadedKextInfo@/link and
+ * @link OSKextFlushLoadInfo@/link). Otherwise the most recent
+ * compatible version is used; if multiple kexts with the same identifier and
+ * version exist, the last one created is used.
+ *
+ * Any problems resolving dependencies are stored in a diagnostics dictionary,
+ * which you can retrieve using @link OSKextCopyDiagnostics@/link.
+ *
+ * If a kext's dependencies have already been resolved, this function does
+ * no work and returns true.
+ * If you want to recalculate a kext's dependencies, call
+ * @link OSKextFlushDependencies@/link first.
+ */
+// xxx - check on same-version ordering with folks
+CF_EXPORT Boolean
+OSKextResolveDependencies(OSKextRef aKext)
+ ;
+
+/*!
+ * @function OSKextFlushDependencies
+ * @abstract Clears the dependency graph of a kext.
+ *
+ * @param aKext The kext to flush dependencies for.
+ * Pass NULL to flush dependencies for all kexts.
+ *
+ * @discussion
+ * OSKexts accumulate a fair amount of information as they are created
+ * and used; when many kext objects are created the total memory
+ * consumption can be significant. If an application won't be using
+ * kexts for long periods of time, it can flush this information
+ * to save memory; the information will later be re-read from disk
+ * or recreated as necessary.
+ *
+ * Flushing dependencies is also useful when readling loaded kext
+ * information from the kernel with @link OSKextReadLoadedKextInfo@/link
+ * (in fact, that function takes a flag to do it as part of its work).
+ * Dependency resolution gives priority to kexts marked as loaded,
+ * so it's wise to call flush dependencies before reading load info
+ * and before doing any operation that resolves dependencies.
+ * Conversely, if you want to resolve dependencies without consideration
+ * for which kexts are loaded, call @link OSKextFlushLoadInfo@/link
+ * beforehand (with or without the flag to flush dependencies).
+ *
+ * This function also clears any dependency resolution diagnostics.
+ * See also @link OSKextFlushInfoDictionary@/link,
+ * @link OSKextFlushLoadInfo@/link,
+ * and @link OSKextFlushDiagnostics@/link.
+ */
+CF_EXPORT void
+OSKextFlushDependencies(OSKextRef aKext)
+ ;
+
+/*!
+ * @function OSKextCopyDeclaredDependencies
+ * @abstract Returns the kexts identified in a kext's OSBundleLibraries property.
+ *
+ * @param aKext The kext to get dependencies for.
+ * @param needAllFlag If true, the function returns
+ * NULL if any dependency isn't found.
+ * @result
+ * A CFArray containing the kexts found.
+ * If needAllFlag is false, the array may be missing
+ * some kexts. If needAllFlag is true and not all
+ * dependencies are found, this function returns NULL.
+ *
+ * @discussion
+ * This function calls @link OSKextResolveDependencies@/link to find
+ * dependencies.
+ */
+CF_EXPORT CFArrayRef
+OSKextCopyDeclaredDependencies(
+ OSKextRef aKext,
+ Boolean needAllFlag)
+ ;
+
+
+/*!
+ * @function OSKextCopyLinkDependencies
+ * @abstract Returns the kexts that a kext links directly against.
+ *
+ * @param aKext The kext to get dependencies for.
+ * @param needAllFlag If true, the function returns
+ * NULL if any dependency isn't found.
+ * @result
+ * A CFArray containing the kexts found.
+ * If needAllFlag is false, the array may be missing
+ * some kexts. If needAllFlag is true and not all
+ * dependencies are found, this function returns NULL.
+ *
+ * @discussion
+ * Link dependencies are how loaded kext relationships are tracked
+ * in the kernel (as shown by the kextstat(8) program).
+ * Some library kexts contain no executable, merely collecting sets of
+ * other libraries for convenience or compatiblity purposes.
+ * This function follows through such indirect libraries to find kexts
+ * with executables that aKext will actually link against.
+ *
+ * This function calls @link OSKextResolveDependencies@/link to find
+ * dependencies.
+ */
+ // xxx - need to insert a manpage link on kextstat
+CF_EXPORT CFArrayRef
+OSKextCopyLinkDependencies(
+ OSKextRef aKext,
+ Boolean needAllFlag)
+ ;
+
+/*!
+ * @function OSKextCopyLoadList
+ * @abstract
+ * Returns the entire list of kexts in the load graph of a kext
+ * (including that kext).
+ *
+ * @param aKext The kext to get the load list for.
+ * @param needAllFlag If true, the function returns
+ * NULL if any dependency isn't found.
+ * @result
+ * A CFArray containing the kexts found.
+ * If needAllFlag is false, the array may be missing
+ * some kexts. If needAllFlag is true and not all
+ * dependencies are found, this function returns NULL.
+ *
+ * @discussion
+ * The fully-resolved load list represents all the kexts needed to load
+ * aKext into the kernel, in an order guaranteed to work for
+ * sequential starting and matching with IOKit personalities.
+ *
+ * This function calls @link OSKextResolveDependencies@/link to find
+ * dependencies.
+ */
+CF_EXPORT CFMutableArrayRef
+OSKextCopyLoadList(
+ OSKextRef aKext,
+ Boolean needAllFlag)
+ ;
+
+/*!
+ * @function OSKextCopyLoadListForKexts
+ * @abstract
+ * Returns the entire list of kexts in load order of the merged load graph
+ * of the provided list of kexts (including those kexts).
+ *
+ * @param kexts The kexts to get the load list for.
+ * @param needAllFlag If true, the function returns
+ * NULL if any dependency isn't found.
+ *
+ * @result
+ * A CFArray containing the kexts found.
+ * If needAllFlag is false, the array may be missing
+ * some kexts. If needAllFlag is true and not all
+ * dependencies are found, this function returns NULL.
+ *
+ * @discussion
+ * The fully-resolved load list represents all of the kexts needed to load
+ * every kext in kexts into the kernel, in an order guaranteed to
+ * work for sequential starting and matching with IOKit personalities.
+ *
+ * This function calls @link OSKextResolveDependencies@/link to find
+ * dependencies.
+ */
+CF_EXPORT CFMutableArrayRef
+OSKextCopyLoadListForKexts(
+ CFArrayRef kexts,
+ Boolean needAllFlag)
+ ;
+
+
+/*!
+ * @function OSKextCopyAllDependencies
+ * @abstract
+ * Returns all kexts that a given kexts depends on, directly or indirectly.
+ *
+ * @param aKext The kext to get dependencies for.
+ * @param needAllFlag If true, the function returns
+ * NULL if any dependency isn't found.
+ * @result
+ * A CFArray containing the kexts found.
+ * If needAllFlag is false, the array may be missing
+ * some kexts. If needAllFlag is true and not all
+ * dependencies are found, this function returns NULL.
+ *
+ * @discussion
+ * This function calls @link OSKextResolveDependencies@/link to find
+ * dependencies.
+ */
+CF_EXPORT CFMutableArrayRef
+OSKextCopyAllDependencies(
+ OSKextRef aKext,
+ Boolean needAllFlag)
+ ;
+
+/*!
+ * @function OSKextCopyIndirectDependencies
+ * @abstract
+ * Returns all kexts that a given kexts depends on indirectly.
+ *
+ * @param aKext The kext to get dependencies for.
+ * @param needAllFlag If true, the function returns
+ * NULL if any dependency isn't found.
+ * @result
+ * A CFArray containing the kexts found.
+ * If needAllFlag is false, the array may be missing
+ * some kexts. If needAllFlag is true and not all
+ * dependencies are found, this function returns NULL.
+ *
+ * @discussion
+ * Note that the list of indirect dependencies includes all kexts declared
+ * as dependencies by the direct dependencies of aKext -
+ * it may therefore include a direct dependency as well if some other
+ * kext in the load graph declares it.
+ *
+ * This function calls @link OSKextResolveDependencies@/link to find
+ * dependencies.
+ */
+// xxx - This one isn't really useful, is it?
+CFMutableArrayRef OSKextCopyIndirectDependencies(
+ OSKextRef aKext,
+ Boolean needAllFlag)
+;
+
+/*!
+ * @function OSKextDependsOnKext
+ * @abstract
+ * Returns whether a kext depends on a given library kext,
+ * directly or indirectly.
+ *
+ * @param aKext The kext to examine.
+ * @param libraryKext The possible library kext.
+ * @param directFlag
+ * If true, only checks for a direct declared dependency;
+ * if false check for direct or indirect dependencies.
+ * @result
+ * true if aKext depends on libraryKext,
+ * either directly or indirectly per directFlag.
+ * Returns false otherwise.
+ *
+ * @discussion
+ * This function calls @link OSKextResolveDependencies@/link to find
+ * dependencies.
+ *
+ * This function works with actual dependency resolution, not potential.
+ * If there are multiple kexts with the same bundle identifier,
+ * aKext may not be the one chosen during resolution
+ * and so it might appear that no kexts depend on it, even though they could.
+ */
+CF_EXPORT Boolean
+OSKextDependsOnKext(
+ OSKextRef aKext,
+ OSKextRef libraryKext,
+ Boolean directFlag)
+ ;
+
+/*!
+ * @function OSKextCopyDependents
+ * @abstract
+ * Return all kexts that depend on a given kext, directly or indirectly.
+ *
+ * @param aKext The kext to get dependents for.
+ * @param directFlag
+ * true to get only kexts that declare a direct
+ * dependency on aKext,
+ * false to get all dependents, direct or indirect.
+ * @result
+ * An array of all kexts that ultimately depend on aKext,
+ * directly or indirectly according to directFlag.
+ *
+ * @discussion
+ * This function calls @link OSKextResolveDependencies@/link on all open
+ * kexts to find dependencies. This can be somewhat expensive.
+ *
+ * This function works with actual dependency resolution, not potential.
+ * If there are multiple kexts with the same bundle identifier,
+ * aKext may not be the one chosen during resolution
+ * and so it might appear that no kexts depend on it, even though they could.
+ */
+CF_EXPORT CFMutableArrayRef
+OSKextCopyDependents(OSKextRef aKext,
+ Boolean directFlag)
+ ;
+
+/*!
+ * @function OSKextIsCompatibleWithVersion
+ * @abstract Returns whether a library kext is compatible with a given version.
+ *
+ * @param aKext The kext to examine.
+ * @param aVersion The kext version to check compatibility with
+ *
+ * @result
+ * truer if aKext has a compatible version and
+ * if aVersion is between the version and compatible version of
+ * aKext (inclusive), false otherwise.
+ *
+ * @discussion
+ */
+CF_EXPORT Boolean
+OSKextIsCompatibleWithVersion(
+ OSKextRef aKext,
+ OSKextVersion aVersion)
+ ;
+
+/*!
+ * @function OSKextLogDependencyGraph
+ * @abstract Prints the resolved dependency graph of a kext.
+ *
+ * @param aKext The kext to log the dependency graph of.
+ * @param bundleIDFlag true to log kexts by bundle ID,
+ * false to log them by URL.
+ * @param linkFlag true to log the link graph only,
+ * false to log the full dependency graph.
+ *
+ * @discussion
+ * linkFlag allows you to display the dependencies as they will
+ * be recorded in the kernel when the kext is loaded.
+ * If it is true, then only kexts with executables are included
+ * in the logged dependency graph. If it is false, all kexts
+ * needed to load aKext are included.
+ *
+ * This function calls @link OSKextResolveDependencies@/link to find
+ * dependencies.
+ */
+CF_EXPORT void
+OSKextLogDependencyGraph(OSKextRef aKext,
+ Boolean bundleIDFlag,
+ Boolean linkFlag)
+ ;
+
+/*!
+ * @function OSKextFindLinkDependencies
+ * @abstract Finds kexts that define symbols a kext needs resolved.
+ *
+ * @param aKext The kext to examine.
+ * @param nonKPIFlag
+ * false to look in com.apple.kpi.* kernel component
+ * for kernel symbols;
+ * true to look in com.apple.kernel.* kernel components
+ * instead (not recommended for later versions of Mac OS X).
+ * @param allowUnsupportedFlag
+ * false to skip unsupported libraries in the search;
+ * true to include them.
+ * @param onedefSymbolsOut
+ * A dictionary containing symbols that were found once;
+ * keys are the symbols, values are the kexts defining the key symbol.
+ * Ownership follows the Create Rule.
+ * Pass NULL to not retrieve.
+ * @param undefinedSymbolsOut
+ * A dictionary containing symbols that weren't found;
+ * keys are the symbols, values are undefined.
+ * Ownership follows the Create Rule.
+ * Pass NULL to not retrieve.
+ * @param multiplyDefinedSymbolsOut
+ * A dictionary containing symbols found in multiple library kexts;
+ * keys are the symbols, values are the kexts defining the key symbol.
+ * Ownership follows the Create Rule.
+ * Pass NULL to not retrieve.
+ * @param multipleDefinitionLibraries
+ * A array of all library kexts in which multiply defined symbols
+ * were found; sorted by CFBundleIdentifier.
+
+ * Ownership follows the Create Rule.
+ * Pass NULL to not retrieve.
+ * @result
+ * An array of kexts that export symbols referenced by aKext,
+ * sorted by CFBundleIdentifier.
+ *
+ * @discussion
+ * This function searches in all open kexts for symbols referenced by
+ * aKext, ignoring the OSBundleLibraries property.
+ * You can use this function to find out what you should list
+ * in a kext's OSBundleLibraries property.
+ *
+ * If undefinedSymbolsOut has a nonzero count,
+ * the symbols named by its keys could not be found in any open kext.
+ *
+ * If multiplyDefinedSymbolsOut has a nonzero count,
+ * some of the result kexts define the same symbol,
+ * and if those duplicates are listed
+ * in OSBundleLibraries a link failure will occur.
+ * You can inspect the contents of multiplyDefinedSymbolsOut
+ * and multipleDefinitionLibraries
+ * by hand to sort out which libraries you should actually declare.
+ *
+ * This function is fairly expensive, as it has to search through all open
+ * kexts' information dictionaries, and all library kexts' executables.
+ */
+CFArrayRef OSKextFindLinkDependencies(
+ OSKextRef aKext,
+ Boolean nonKPIFlag,
+ Boolean allowUnsupportedFlag,
+ CFDictionaryRef * undefinedSymbolsOut,
+ CFDictionaryRef * onedefSymbolsOut,
+ CFDictionaryRef * multiplyDefinedSymbolsOut,
+ CFArrayRef * multipleDefinitionLibrariesOut)
+ ;
+
+#pragma mark Linking and Loading; Other Kernel Operations
+/*********************************************************************
+* Linking and Loading; Other Kernel Operations
+*********************************************************************/
+
+/*!
+ * @function OSKextLoad
+ * @abstract Loads a kext and its dependencies into the kernel.
+ *
+ * @param aKext The kext to load.
+ * @result
+ * kOSReturnSuccess if aKext is successfully loaded
+ * into the kernel, or was already loaded, or an error result if not.
+ *
+ * @discussion
+ * The calling process must have an effective user ID of 0 (root)
+ * to load kexts into the kernel.
+ *
+ * A kext and all its dependencies must pass all validation and authentication
+ * tests to be loadable. See @link OSKextIsLoadable@/link for more information.
+ *
+ * All kexts loaded into the kernel are started, but IOKit personalities
+ * are not sent to the IOCatalogue.
+ * See @link OSKextSendPersonalitiesToKernel@/link.
+ *
+ * This function calls @link OSKextFlushLoadInfo@/link and clears dependencies
+ * for all open kexts. It then calls @link OSKextCopyLoadList@/link
+ * to find dependencies and @link OSKextReadLoadedKextInfo@/link on the
+ * resulting load list.
+ */
+// xxx - need to list errors that may be returned
+CF_EXPORT OSReturn
+OSKextLoad(OSKextRef aKext)
+ ;
+
+/*!
+ * @function OSKextLoadWithOptions
+ * @abstract Loads a kext and its dependencies into the kernel.
+ *
+ * @param aKext The kext to load.
+ * @param startExclusion
+ * kOSKextExcludeAll to omit starting aKext
+ * and any of its dependencies not already started,
+ * kOSKextExcludeKext to start the dependencies of
+ * aKext but not aKext itself,
+ * or kOSKextExcludeNone to start all loaded kexts.
+ * @param addPersonalitiesExclusion
+ * kOSKextExcludeAll to omit sending
+ * IOKitPersonalities to the IOCatalogue for aKext
+ * and any of its dependencies
+ * (though they may already be in the IOCatalogue),
+ * kOSKextExcludeKext to send personalities for the
+ * dependencies of aKext but not aKext itself,
+ * or kOSKextExcludeNone to send all personalities.
+ * @param personalityNames
+ * The names of IOKitPersonalities in aKext to send,
+ * addPersonalitiesExclusion allowing.
+ * If NULL all personalities are sent.
+ * This parameter only affects aKext; if dependency
+ * personalities are sent, they are all sent.
+ * @param delayAutounloadFlag
+ * true to cause the kernel's automatic kext unloader
+ * to skip aKext for one cycle, giving extra time
+ * to set up a debug session. false for normal behavior.
+ *
+ * @result
+ * Returns kOSReturnSuccess on success, other values on failure.
+ *
+ * @discussion
+ * This function allows a kext to be loaded but not started or matched
+ * (for IOKit kexts), which is useful in some debug scenarios.
+ * After calling this function, you may need to call @link OSKextStart@/link
+ * to start aKext (along with its dependencies).
+ * You may also need to call @link OSKextSendPersonalitiesToKernel@/link
+ * for any kexts excluded from matching via
+ * addPersonalitiesExclusion.
+ *
+ * The calling process must have an effective user ID of 0 (root)
+ * to load kexts into the kernel.
+ *
+ * A kext and all its dependencies must pass all validation and authentication
+ * tests to be loadable. See @link OSKextIsLoadable@/link for more information.
+ *
+ * This function calls @link OSKextFlushLoadInfo@/link and clears dependencies
+ * for all open kexts. It then calls @link OSKextCopyLoadList@/link
+ * to find dependencies and @link OSKextReadLoadedKextInfo@/link on the
+ * resulting load list.
+ */
+// xxx - need to list errors that may be returned
+CF_EXPORT OSReturn
+OSKextLoadWithOptions(
+ OSKextRef aKext,
+ OSKextExcludeLevel startExclusion,
+ OSKextExcludeLevel addPersonalitiesExclusion,
+ CFArrayRef personalityNames,
+ Boolean delayAutounloadFlag)
+ ;
+
+/*!
+ * @function OSKextGenerateDebugSymbols
+ * @abstract Generate debug symbols for a kext and its dependencies.
+ *
+ * @param aKext
+ * The kext to generate debug symbols for.
+ * @param kernelImage
+ * The kernel Mach-O or symbol file to use for linking.
+ * If NULL, the running kernel is used.
+ *
+ * @result
+ * A dictionary whose keys are the bundle IDs of the kexts for which symbols
+ * have been generated with ".sym" appended, and whose values are CFData
+ * objects containing the symbol files. Returns NULL on error.
+ *
+ * @discussion
+ * The result includes only non-interface kexts that have an executable
+ * and a load address set.
+ * Load addresses are set by @link OSKextReadLoadedKextInfo@/link or by
+ * @link OSKextSetLoadAddress@/link.
+ *
+ * If using the running kernel for load addresses, the current architecture
+ * set with @link OSKextSetArchitecture@/link must match that of the running
+ * kernel or this function returns NULL.
+ *
+ * This function calls @link OSKextResolveDependencies@/link to find
+ * dependencies.
+ */
+CF_EXPORT CFDictionaryRef
+OSKextGenerateDebugSymbols(
+ OSKextRef aKext,
+ CFDataRef kernelImage)
+ ;
+
+/*!
+ * @function OSKextNeedsLoadAddressForDebugSymbols
+ * @abstract
+ * Returns whether a kext needs a load address set to generate debug symbols.
+ *
+ * @param aKext The kext to examine.
+ * @result
+ * true if aKext needs a load address set
+ * in order to generate debug symbols with
+ * @link OSKextGenerateDebugSymbols@/link, false otherwise.
+ */
+CF_EXPORT Boolean
+OSKextNeedsLoadAddressForDebugSymbols(OSKextRef aKext)
+ ;
+
+/*!
+ * @function OSKextUnload
+ * @abstract Unloads a kext from the kernel if possible.
+ *
+ * @param aKext The kext to unload.
+ * @param terminateServiceAndRemovePersonalities
+ * If true, and the kext to unload has no kexts loaded
+ * against it, all IOService objects defined by that kext will be
+ * asked to terminate so that the unload can proceed, and the personalities
+ * for the kext will be removed from the IOCatalogue.
+ *
+ * @result
+ * kOSReturnSuccess on success, an error code
+ * (typically kOSKextReturnInUse) on failure.
+ *
+ * @discussion
+ * The calling process must have an effective user ID of 0 (root)
+ * to unload kexts from the kernel.
+ * A kext cannot be unloaded if it has any loaed dependents.
+ *
+ * See also the @link IOCatalogueTerminate@/link function.
+ */
+// xxx - need to list errors that may be returned
+CF_EXPORT OSReturn
+OSKextUnload(OSKextRef aKext,
+ Boolean terminateServiceAndRemovePersonalities)
+ ;
+
+/*!
+ * OSKextUnload
+ * @abstract Unloads a kext from the kernel if possible, based on its
+ * CFBundleIdentifier.
+ *
+ * @param kextIdentifier The CFBundleIDentifier of the kext to unload.
+ * @param terminateServiceAndRemovePersonalities
+ * If true, and the kext to unload has no kexts loaded
+ * against it, all IOService objects defined by that kext will be
+ * asked to terminate so that the unload can proceed, and the personalities
+ * for the kext will be removed from the IOCatalogue.
+ *
+ * @result
+ * kOSReturnSuccess on success, an error code
+ * (typically kOSKextReturnInUse) on failure.
+ *
+ * @discussion
+ * The calling process must have an effective user ID of 0 (root)
+ * to unload kexts from the kernel.
+ * A kext cannot be unloaded if it has any loaed dependents.
+ *
+ * See also the @link IOCatalogueTerminate@/link function.
+ */
+// xxx - need to list errors that may be returned
+CF_EXPORT OSReturn
+OSKextUnloadKextWithIdentifier(CFStringRef kextIdentifier,
+ Boolean terminateServiceAndRemovePersonalities)
+ ;
+
+/*!
+ * @function OSKextIsStarted
+ * @abstract Returns whether a kext loaded in the kernel is started.
+ *
+ * @param aKext The kext to examine.
+ * @result
+ * true if aKext is active and running in the kernel,
+ * false if not loaded or loaded and not started.
+ *
+ * @discussion
+ * This function returns the state recorded the last time
+ * @link OSKextReadLoadedKextInfo@/link was called.
+ */
+CF_EXPORT Boolean
+OSKextIsStarted(OSKextRef aKext)
+ ;
+
+/*!
+ * @function OSKextStart
+ * @abstract Starts a kext loaded in the kernel if possible.
+ *
+ * @param aKext The kext to start.
+ * @result
+ * kOSReturnSuccess on success, an error code on failure.
+ *
+ * @discussion
+ * This function allows an application to start a kext that is loaded
+ * in the kernel (typically via @link OSKextLoadWithOptions@/link),
+ * and any of its dependencies that aren't also started.
+ * If the kext is already started, this does nothing.
+ *
+ * To start a kext means to call its start function, which is distinct from
+ * the start method of an IOService object.
+ *
+ * The calling process must have an effective user ID of 0 (root)
+ * to start kexts in the kernel.
+// xxx - need to list errors that may be returned
+ */
+CF_EXPORT OSReturn
+OSKextStart(OSKextRef aKext)
+ ;
+
+/*!
+ * @function OSKextStop
+ * @abstract Stops a kext loaded in the kernel if possible.
+ *
+ * @param aKext The kext to stop.
+ * @result
+ * kOSReturnSuccess on success, an error code on failure.
+ *
+ * @discussion
+ * This function allows an application to stop a kext that is loaded
+ * in the kernel without unloading it. This may be useful in certain
+ * debugging scenarios.
+ *
+ * A kext cannot be stopped via this function if it has any dependents
+ * that reference it, any client references within the kernel,
+ * or any instances of libkern/IOKit C++ classes.
+ *
+ * To stop a kext means to call its stop function, which is distinct from
+ * the stop method of an IOService object.
+ *
+ * The calling process must have an effective user ID of 0 (root)
+ * to stop kexts in the kernel.
+ */
+// xxx - should it be allowed to stop a kext with dependents that are
+// xxx - themselves not started?
+// xxx - need to list errors that may be returned
+CF_EXPORT OSReturn
+OSKextStop(OSKextRef aKext)
+ ;
+
+/*!
+ * @function OSKextSendPersonalitiesToKernel
+ * @abstract Sends an array of IOKit personalities to the kernel.
+ *
+ * @param personalities The personalities to send.
+ * @result
+ * kOSReturnSuccess on success, an error code on failure.
+ *
+ * @discussion
+ * This function simply sends an anonymous array of personalities to the
+ * I/O Kit's IOCatalogue object in the kernel.
+ * You can get personalities from kexts using
+ * @link OSKextCopyPersonalitiesArray@/link or
+ * @link OSKextCopyPersonalitiesOfKexts@/link.
+ *
+ * The calling process must have an effective user ID of 0 (root)
+ * to send personalities to the kernel.
+ */
+// xxx - need to list errors that may be returned
+CF_EXPORT OSReturn
+OSKextSendPersonalitiesToKernel(CFArrayRef personalities)
+ ;
+
+/*!
+ * @function OSKextSendKextPersonalitiesToKernel
+ * @abstract
+ * Sends the personalities of a single kext to the kernel, optionally
+ * filtered by name.
+ *
+ * @param aKext The kext whose personalities to send.
+ * @param personalityNames
+ * An array of names. Only personalities from aKext
+ * with these names are sent to the kernel.
+ * @result
+ * kOSReturnSuccess on success, an error code on failure.
+ *
+ * @discussion
+ * If any names in personalityNames are not found,
+ * they are simply skipped rather than causing an error.
+ *
+ * This function may be useful in certain debugging scenarios,
+ * where a particular personality is causing problems.
+ *
+ * The calling process must have an effective user ID of 0 (root)
+ * to send personalities to the kernel.
+ */
+// xxx - should names not found cause an error?
+// xxx - need to list errors that may be returned
+CF_EXPORT OSReturn
+OSKextSendKextPersonalitiesToKernel(
+ OSKextRef aKext,
+ CFArrayRef personalityNames)
+ ;
+
+/*!
+ * @function OSKextSendPersonalitiesOfKextsToKernel
+ * Sends the personalities of multiple kext to the kernel in a single
+ * operation.
+ *
+ * @param kextArray The kexts whose personalities to send.
+ * @result
+ * kOSReturnSuccess on success, an error code on failure.
+ *
+ * @discussion
+ * This function performs one data transfer to the kernel, collecting
+ * all the personalities of the kexts in kextArray.
+ *
+ * The calling process must have an effective user ID of 0 (root)
+ * to send personalities to the kernel.
+ */
+// xxx - need to list errors that may be returned
+CF_EXPORT OSReturn
+OSKextSendPersonalitiesOfKextsToKernel(CFArrayRef kextArray)
+ ;
+
+/*!
+ * @function OSKextRemoveKextPersonalitiesFromKernel
+ * Removes all personalities for a kext's bundle identifier from the kernel.
+ *
+ * @param aKext The kext whose personalities to remove.
+ * @result
+ * kOSReturnSuccess on success, an error code on failure.
+ *
+ * @discussion
+ * This function removes from the kernel's IOCatalogue all personalities
+ * whose CFBundleIdentifiers match that of aKext so that no
+ * further load requests for aKext will be made. This is
+ * typically done when it is discovered that aKext cannot
+ * be loaded from user space (if it fails to load in the kernel, matching
+ * personalities are automatically removed).
+ *
+ * Note that kexts other than aKext might have published
+ * personalities in the IOCatalogue under aKext's identifier.
+ * Such personalities will also be removed, since they trigger load requests
+ * for a kext that cannot be loaded. The OSKext library adds an
+ * IOPersonalityPublisher property to such personalities, that gives the
+ * bundle identifier of the originating kext.
+ *
+ * This function differs from
+ * @link OSKextRemovePersonalitiesForIdentifierFromKernel@/link
+ * by having a kext object to check for logging or other purposes.
+ *
+ * The calling process must have an effective user ID of 0 (root)
+ * to remove personalities from the kernel.
+ */
+// xxx - need to list errors that may be returned
+// xxx - this is a not-so-thin shim over IOCatalogueSendData (kIOCatalogueRemoveDrivers)
+// xxx - might we just want the function to take a bundle ID?
+// xxx - does IOCatalogueSendData really require root access?
+CF_EXPORT OSReturn
+OSKextRemoveKextPersonalitiesFromKernel(OSKextRef aKext)
+ ;
+
+/*!
+ * @function OSKextRemovePersonalitiesForIdentifierFromKernel
+ * Removes all personalities for a given bundle identifier from the kernel.
+ *
+ * @param aBundleID The bundle identifier for which to remove personalities.
+ * @result
+ * kOSReturnSuccess on success, an error code on failure.
+ *
+ * @discussion
+ * This function removes from the kernel's IOCatalogue all personalities
+ * whose CFBundleIdentifiers are aBundleID so that no
+ * further load requests for the kext with that identifier will be made.
+ * This is typically done when it is discovered no kext can be found for
+ * aBundleID.
+ *
+ * This function differs from
+ * @link OSKextRemoveKextPersonalitiesFromKernel@/link
+ * by not having a kext object to check for logging or other purposes.
+ *
+ * The calling process must have an effective user ID of 0 (root)
+ * to remove personalities from the kernel.
+ */
+// xxx - need to list errors that may be returned
+// xxx - this is a not-so-thin shim over IOCatalogueSendData (kIOCatalogueRemoveDrivers)
+// xxx - I want 2 separate functions for logging; a kext can have flags in it
+// xxx - does IOCatalogueSendData really require root access?
+CF_EXPORT OSReturn
+OSKextRemovePersonalitiesForIdentifierFromKernel(CFStringRef aBundleID)
+ ;
+
+/*!
+ * @function OSKextCreateLoadedKextInfo
+ * @abstract Returns information about loaded kexts in a dictionary.
+ *
+ * @param kextIdentifiers An array of kext identifiers to read from the kernel.
+ * Pass NULL to read info for all loaded kexts.
+ * @result
+ * An array of dictionaries containing information about loaded kexts.
+ *
+ * @discussion
+ * This function gets information from the kernel without affecting any
+ * kext objects. If you want to update open kext objects to reflect
+ * whether they are loaded in the kernel, use @link OSKextReadLoadedKextInfo@/link.
+ */
+// xxx - need to document the keys from OSKextLib.h.
+CF_EXPORT CFArrayRef
+OSKextCreateLoadedKextInfo(
+ CFArrayRef kextIdentifiers)
+ ;
+
+/*!
+ * @function OSKextReadLoadedKextInfo
+ * @abstract Updates kext objects with load info from the kernel.
+ *
+ * @param kextIdentifiers An array of kext identifiers to read
+ * from the kernel;
+ * all matching kexts have their load info updated.
+ * Pass NULL to update load info for all kexts.
+ * @param flushDependenciesFlag
+ * true to clear dependency information from kexts,
+ * false to leave it in place.
+ *
+ * @result
+ * kOSReturnSuccess if all information is successfully updated,
+ * an error code otherwise. Specifically, if the current architecture set
+ * by @link OSKextSetArchitecture@/link is not that of the running kernel,
+ * this function returns kOSKextReturnExecutableArchNotFound.
+ *
+ * @discussion
+ * The load status of kexts primarily affects dependency resolution in the
+ * kext library, in that kexts marked as loaded are given priority over
+ * all other kexts of the same identifier.
+ * See @link OSKextResolveDependencies@/link for more.
+ *
+ * This function calls @link OSKextFlushLoadInfo@/link on the kexts,
+ * which clears any previous load info for them
+ * (or for all kexts if kextIdentifiers is NULL).
+ * If flushDependenciesFlag is true,
+ * resolved dependencies (which may not match the loaded kexts
+ * in the kernel) are also flushed.
+ * Load addresses are then set from the kernel,
+ * but dependencies are resolved as needed.
+ *
+ * If flushDependenciesFlag is false,
+ * existing dependency graphs are maintained, allowing you to
+ * check whether the dependencies, as resolved before reading
+ * load information, reflect loaded kexts (by getting the load list
+ * via @link OSKextCopyLoadList@/link and checking the kexts in it
+ * with @link OSKextIsLoaded@/link).
+ */
+// xxx - need to list errors that may be returned
+CF_EXPORT OSReturn
+OSKextReadLoadedKextInfo(
+ CFArrayRef kexts,
+ Boolean flushDependenciesFlag)
+ ;
+
+/*!
+ * @function OSKextIsLoaded
+ * @abstract Returns whether a kext is loaded in the kernel.
+ *
+ * @param aKext The kext to examine.
+ * @result
+ * true if a kext with the same identifier, version, and UUID
+ * as aKext is loaded in the kernel, false otherwise.
+ *
+ * @discussion
+ * You must call @link OSKextReadLoadedKextInfo@/link for this flag to be meaningful,
+ * which in turn requires the current library architecture to match that
+ * of the running kernel.
+ * Use @link OSKextOtherVersionIsLoaded@/link to check whether
+ * a different version of aKext is loaded.
+ */
+CF_EXPORT Boolean
+OSKextIsLoaded(OSKextRef aKext)
+ ;
+
+/*!
+ * @function OSKextGetLoadAddress
+ * @abstract Returns the actual or simulated kernel load address of a kext.
+ *
+ * @param aKext The kext to examine.
+ * @result
+ * The load address of aKext, whether read from the kernel using
+ * @link OSKextReadLoadedKextInfo@/link or set for symbol generation using
+ * @link OSKextSetLoadAddress@/link.
+ *
+ * @discussion
+ * Load addresses are accessed as 64-bit numbers even for 32-bit architectures;
+ * cast or truncate the value as necessary.
+ *
+ * You must call @link OSKextReadLoadedKextInfo@/link or
+ * @link OSKextSetLoadAddress@/link for the load address to be nonzero.
+ */
+CF_EXPORT uint64_t
+OSKextGetLoadAddress(OSKextRef aKext)
+ ;
+
+/*!
+ * @function OSKextSetLoadAddress
+ * @abstract
+ * Sets the simulated kernel load address of a kext for symbol generation.
+ *
+ * @param aKext The kext to set a load address for.
+ * @result
+ * true if the address was set, false if not
+ * (because it's too large for the current architecture).
+ *
+ * @discussion
+ * Load addresses are accessed as 64-bit numbers even for 32-bit architectures.
+ * If you attempt to set a load address that is too large for a 32-bit link,
+ * this function returns false.
+ * See @link OSKextSetArchitecture@/link.
+ *
+ * Setting a load address manually is useful for generating debug symbols
+ * with @link OSKextGenerateDebugSymbols@/link.
+ */
+CF_EXPORT Boolean
+OSKextSetLoadAddress(OSKextRef aKext, uint64_t anAddress)
+ ;
+
+/*!
+ * @function OSKextGetLoadTag
+ * @abstract
+ * Returns the load tag of a kext if it's loaded in the kernel.
+ *
+ * @param aKext The kext to examine.
+ * @result
+ * The load tag (also known as the index or kmod id) of aKext,
+ * if it's loaded in the kernel (use @link OSKextIsLoaded@/link to check that).
+ * Returns 0 if aKext is not loaded or if it can't be determined
+ * whether it is loaded.
+ *
+ * @discussion
+ * You must call @link OSKextReadLoadedKextInfo@/link for the load tag
+ * to be meaningful, which in turn requires the current library architecture
+ * to match that of the running kernel.
+ * Use @link OSKextIsLoaded@/link to check whether aKext
+ * is loaded.
+ */
+CF_EXPORT uint32_t
+OSKextGetLoadTag(OSKextRef aKext)
+ ;
+
+/*!
+ * @function OSKextFlushLoadInfo
+ * @abstract Clears all load and dependency information from a kext.
+ *
+ * @param aKext
+ * The kext to clear. If NULL, all open
+ * kexts have their load info flushed.
+ * @param flushDependenciesFlag
+ * true to clear dependency information from kexts,
+ * false to leave it in place.
+ *
+ * @discussion
+ * Flushing load information releases the internal load information
+ * structs of a kext, including load flags, the bundle executable,
+ * link/load diagnostics, and if flushDependenciesFlag is true,
+ * the dependencies.
+ *
+ * OSKexts accumulate a fair amount of information as they are created
+ * and used; when many kext objects are created the total memory
+ * consumption can be significant. If an application won't be using
+ * kexts for long periods of time, it can flush this information
+ * to save memory; the information will later be re-read from disk
+ * or recreated as necessary.
+ *
+ * Flushing load info is also useful after readling loaded kext
+ * information from the kernel with @link OSKextReadLoadedKextInfo@/link
+ * or after working with executables. Executables in particular
+ * consume a lot of application memory, often unnecessarily, since
+ * the code is loaded and running in the kernel.
+ *
+ * See also @link OSKextFlushInfoDictionaries@/link,
+ * @link OSKextFlushDependencies@/link,
+ * and @link OSKextFlushDiagnostics@/link.
+ */
+CF_EXPORT void
+OSKextFlushLoadInfo(
+ OSKextRef aKext,
+ Boolean flushDependenciesFlag)
+ ;
+
+/*!
+ * @function OSKextCopyAllRequestedIdentifiers
+ * @abstract
+ * Copies the list of all unique bundle identifiers of kext load requests
+ * that the kernel has received since power-on.
+ *
+ * @result
+ * A CFArray object, or NULL if the copy failed.
+ * Ownership follows the
+ * @link //apple_ref/doc/uid/20001148-103029 Create Rule@/link.
+ *
+ */
+CF_EXPORT CFArrayRef
+OSKextCopyAllRequestedIdentifiers(void)
+ ;
+
+#pragma mark Sanity Checking and Diagnostics
+/*********************************************************************
+* Sanity Checking and Diagnostics
+*********************************************************************/
+
+/*!
+ * @function OSKextParseVersionCFString
+ * @abstract
+ * Parses a kext version from a CFString.
+ *
+ * @param versionString The kext version string to parse.
+ * @result
+ * The numeric rendering of versionString, which can
+ * compared arithmetically with other valid version numbers.
+ * Returns -1 if the version couldn't be parsed.
+ */
+CF_EXPORT OSKextVersion
+OSKextParseVersionCFString(CFStringRef versionString)
+ ;
+
+/*! @function OSKextParseVersionString */
+CF_EXPORT OSKextVersion OSKextParseVersionString(const char* versionString);
+CF_EXPORT void OSKextVersionGetString(OSKextVersion version, char* buffer, size_t bufferLength);
+
+
+/*!
+ * @function OSKextValidate
+ * @abstract
+ * Sanity checks a kext's info dictionary and executable for the currently
+ * set architecture.
+ *
+ * @param aKext The kext to validate.
+ * @result
+ * true if aKext passes all validation tests,
+ * false otherwise.
+ *
+ * @discussion
+ * This function forces full validation of a kext, collecting all
+ * errors found in the validation diagnostics if recording is turned on
+ * (with @link OSKextSetRecordsDiagnostics@/link). You can get the diagnostics
+ * using @link OSKextCopyDiagnostics@/link.
+ *
+ * If safe boot is currently simulated (see
+ * @link OSKextSetSimulatedSafeBoot@/link),
+ * any kext not loadable during safe boot will fail validation.
+ */
+// compare with CFBundlePreflightExecutable()
+CF_EXPORT Boolean
+OSKextValidate(OSKextRef aKext)
+ ;
+
+/*!
+ * @function OSKextIsValid
+ * @abstract
+ * Returns whether a kext is valid or not.
+ *
+ * @param aKext The kext to examine.
+ * @result
+ * true if aKext passes all validation tests,
+ * false otherwise.
+ *
+ * @discussion
+ * This function avoids doing full validation if any problems have been
+ * discovered with the kext during other operations. To perform a full
+ * validation of all possible problems, use @link OSKextValidate@/link.
+ */
+CF_EXPORT Boolean
+OSKextIsValid(OSKextRef aKext)
+ ;
+
+/*!
+ * @function OSKextValidateDependencies
+ * @abstract Validates all dependencies of a kext.
+ *
+ * @param aKext The kexts whose dependencies to validate.
+ * @result
+ * true if all dependencies of aKext are valid,
+ * false if any of them are not.
+ *
+ * @discussion
+ * This function calls @link OSKextValidate@/link on aKext and
+ * all the current dependencies of aKext.
+ * Use @link OSKextCopyDiagnostics@/link
+ * with a flag of @link kOSKextDiagnosticsFlagDependencies@/link
+ * to get the dependency-resolution failures caused by invalid dependencies.
+ *
+ * If safe boot is currently simulated (see
+ * @link OSKextSetSimulatedSafeBoot@/link),
+ * any kext not loadable during safe boot will fail validation.
+ *
+ * This function calls @link OSKextResolveDependencies@/link to find
+ * dependencies.
+ */
+CF_EXPORT Boolean
+OSKextValidateDependencies(OSKextRef aKext)
+ ;
+
+/*!
+ * @function OSKextAuthenticate
+ * @abstract Authenticates file ownership and permissions of a kext.
+ *
+ * @param aKext The kext to examine.
+ * @result
+ * true if all directories and files in aKext's
+ * bundle or mkext source have secure ownership and permissions,
+ * false if they do not, or if authentication could not be done.
+ *
+ * @discussion
+ * This function forces full authentication of a kext, collecting all
+ * errors found in the authentication diagnostics, collecting all
+ * errors found in the validation diagnostics if recording is turned on
+ * (with @link OSKextSetRecordsDiagnostics@/link). You can get the diagnostics
+ * using @link OSKextCopyDiagnostics@/link.
+ *
+ * For a kext to be loadable into the kernel, it must be owned by
+ * user root, group wheel, and its constituent files and directories
+ * must be nonwritable by group and other.
+ * A kext created from an mkext file uses that mkext file for authentication
+ * (see @link OSKextCreateKextsFromMkextFile@/link.
+ */
+CF_EXPORT Boolean
+OSKextAuthenticate(OSKextRef aKext)
+ ;
+
+/*!
+ * @function OSKextIsAuthentic
+ * @abstract
+ * Returns whether a kext is authentic or not.
+ *
+ * @param aKext The kext to examine.
+ * @result
+ * true if aKext passes all authentication tests,
+ * false otherwise.
+ *
+ * @discussion
+ * This function avoids doing full authentication if any problems have been
+ * discovered with the kext during other operations. To perform a full
+ * validation of all possible problems, use @link OSKextValidate@/link.
+ */
+CF_EXPORT Boolean
+OSKextIsAuthentic(OSKextRef aKext)
+ ;
+
+/*!
+ * @function OSKextAuthenticateDependencies
+ * @abstract Authenticates all dependencies of a kext.
+ *
+ * @param aKext The kexts whose dependencies to authenticate.
+ * @result
+ * true if all dependencies of aKext are authentic,
+ * false if any of them are not.
+ *
+ * @discussion
+ * This function calls @link OSKextAuthenticate@/link on aKext
+ * and all the current dependencies of aKext.
+ * Use @link OSKextCopyDiagnostics@/link
+ * with a flag of @link kOSKextDiagnosticsFlagDependencies@/link
+ * to get the dependency-resolution failures caused by inauthentic dependencies.
+ *
+ * This function calls @link OSKextResolveDependencies@/link to find
+ * dependencies.
+ */
+CF_EXPORT Boolean
+OSKextAuthenticateDependencies(OSKextRef aKext)
+ ;
+
+/*!
+ * @function OSKextIsLoadable
+ * @abstract
+ * Returns whether a kext appears loadable for the current architecture.
+ *
+ * @param aKext The kext to examine.
+ * @result
+ * true if aKext has no problems with validation,
+ * authentication, or dependency resolution for the current architecture,
+ * and if it's eligible for the current safe boot mode.
+ * Returns false otherwise.
+ *
+ * @discussion
+ * This function resolves dependencies for aKext,
+ * validates and authenticsates aKext and its dependencies,
+ * and if safe boot is simulated also checks the OSBundleRequired property
+ * of aKext and its dependencies. If all these tests pass,
+ * the kext is considered loadable for the current architecture
+ * (which need not match that of the running kernel).
+ *
+ * See @link OSKextSetArchitecture@/link and
+ * @link OSKextSetSimulatedSafeBoot@/link.
+ *
+ * This function calls @link OSKextResolveDependencies@/link to find
+ * dependencies.
+ */
+CF_EXPORT Boolean
+OSKextIsLoadable(OSKextRef aKext)
+ ;
+
+/*!
+ * @function OSKextCopyDiagnostics
+ * @abstract Returns diagnostics information for a kext.
+ *
+ * @param aKext The kext to get diagnostics for.
+ * @param typeFlags Flags indicating which diagnostics to retrieve.
+ * @result
+ * A dictionary containing diagnostics for aKext, suitable
+ * for display in an outline view or printout.
+ *
+ * @discussion
+ * You can use this function after validating, authenticating, resolving
+ * dependencies, or generating debug symbols to get all the problems encountered
+ * with those operations.
+ *
+ * The exact keys and values used for diagnostics are for informational purposes
+ * only, are not formally defined, and may change without warning.
+ *
+ * You can use @link OSKextLogDiagnostics@/link to print nicely-formatted
+ * reports of any problems found with kexts.
+ */
+// xxx - need to tie in with the kernel & linker to get link failures
+CFDictionaryRef OSKextCopyDiagnostics(OSKextRef aKext,
+ OSKextDiagnosticsFlags typeFlags)
+;
+
+/*!
+ * @function OSKextLogDiagnostics
+ * @abstract Logs specified diagnostics for a kext.
+ *
+ * @param aKext The kext to log diagnostics for.
+ * @param typeFlags Flags indicating which diagnostics to log.
+ *
+ * @discussion
+ * You can use this function after validating, authenticating, resolving
+ * dependencies, or generating debug symbols to display all the problems
+ * encountered with those operations.
+ */
+CF_EXPORT void
+OSKextLogDiagnostics(
+ OSKextRef aKext,
+ OSKextDiagnosticsFlags typeFlags)
+ ;
+
+/*!
+ * @function OSKextFlushDiagnostics
+ * @abstract Clears all diagnostics information from a kext.
+ *
+ * @param aKext
+ * The kext to clear diagnostics from.
+ * Pass NULL to flush diagnostics from all open kexts.
+ * @param typeFlags Flags indicating which diagnostics to flush.
+ *
+ * @discussion
+ * OSKexts accumulate a fair amount of information as they are created
+ * and used; when many kext objects are created the total memory
+ * consumption can be significant. If an application won't be using
+ * kexts for long periods of time, it can flush this information
+ * to save memory; the information will later be re-read from disk
+ * or recreated as necessary.
+ *
+ * See also @link OSKextFlushInfoDictionaries@/link,
+ * @link OSKextFlushDependencies@/link,
+ * and @link OSKextFlushLoadInfo@/link.
+ */
+CF_EXPORT void
+OSKextFlushDiagnostics(OSKextRef aKext, OSKextDiagnosticsFlags typeFlags)
+ ;
+
+#pragma mark Mkext and Prelinked Kernel Files
+/*********************************************************************
+* Mkext and Prelinked Kernel Files
+*********************************************************************/
+// xxx - Use "Flag" or "Mask"?
+typedef uint32_t OSKextRequiredFlags
+;
+#define kOSKextOSBundleRequiredNone 0x0
+#define kOSKextOSBundleRequiredRootFlag 0x1ULL
+#define kOSKextOSBundleRequiredLocalRootFlag 0x1ULL << 1
+#define kOSKextOSBundleRequiredNetworkRootFlag 0x1ULL << 2
+#define kOSKextOSBundleRequiredSafeBootFlag 0x1ULL << 3
+#define kOSKextOSBundleRequiredConsoleFlag 0x1ULL << 4
+
+/*!
+ * @function OSKextIsFromMkext
+ * @abstract Returns whether a kext was created from an mkext archive.
+ *
+ * @param aKext The kext to examine.
+ * @result
+ * true if aKext was created from an mkext archive,
+ * false if it was created from an on-disk bundle.
+ *
+ * @discussion
+ * A kext created from an mkext will have only its info dictionary, executable,
+ * and any resources listed in its the OSBundleStartupResources property.
+ */
+CF_EXPORT Boolean
+OSKextIsFromMkext(OSKextRef aKext)
+ ;
+
+/*!
+ * @function OSKextMatchesRequiredFlags
+ * @abstract
+ * Returns whether a kext matches a given set of flags for inclusion in an
+ * mkext archive.
+ *
+ * @param aKext The kext to examine.
+ * @param requiredFlags
+ * Flags indicating which values of OSBundleRequired
+ * are needed.
+ * @result
+ * true if aKext's OSBundleRequired property
+ * matches one of the specified flags, false otherwise.
+ *
+ * @discussion
+ * This function is used to select kexts for inclusion in an mkext archive.
+ * See @link OSKextFilterRequiredKexts@/link and
+ * @link OSKextCreateMkext@/link.
+ */
+CF_EXPORT Boolean
+OSKextMatchesRequiredFlags(OSKextRef aKext,
+ OSKextRequiredFlags requiredFlags)
+ ;
+
+/*!
+ * @function OSKextFilterRequiredKexts
+ * @abstract
+ * Filters an array of kexts based on a set of flags
+ * for inclusion in an mkext archive.
+ *
+ * @param kextArray
+ * The kexts to filter.
+ * Pass NULL to filter all open kexts.
+ * @param requiredFlags
+ * Flags indicating which values of OSBundleRequired
+ * are needed.
+ * @result
+ * An array of kexts matching requiredFlags.
+ *
+ * @discussion
+ * This function is used to select kexts for inclusion in an mkext archive.
+ * See @link OSKextCreateMkext@/link.
+ *
+ */
+CF_EXPORT CFArrayRef
+OSKextFilterRequiredKexts(CFArrayRef kextArray,
+ OSKextRequiredFlags requiredFlags)
+ ;
+
+/*!
+ * @function OSKextCreateMkext
+ * @abstract Create an mkext file from an array of kexts and set of flags.
+ *
+ * @param allocator
+ * The allocator to use to allocate memory for the new object.
+ * Pass NULL or kCFAllocatorDefault
+ * to use the current default allocator.
+ * @param kextArray
+ * The kexts to include in the mkext.
+ * Pass NULL to use all open kexts.
+ * @param volumeRootURL
+ * If non-NULL, kexts with this URL as a prefix
+ * strip it when saving their paths in the mkext.
+ * This allows creation of mkexts for volumes
+ * other than the current startup volume.
+ * @param requiredFlags
+ * A set of flags that filters kextArray to a subset
+ * of kexts required for specific startup scenarios
+ * (typically local disk vs. network).
+ * @param compressFlag
+ * true to compress data in the mkext,
+ * false to include them at full size.
+ * COMPRESSED MKEXTS ARE NOT SUPPORTED IN THE KERNEL YET.
+ * @result
+ * A CFData object containing the mkext file data on success,
+ * NULL on failure.
+ *
+ * @discussion
+ * This function creates a single-architecture mkext file for the currently
+ * set library architecture (see @link OSKextSetArchitecture@/link). Kexts
+ * with executables lacking code for that architecture are not included.
+ *
+ * If you want to create a multi-architecture mkext, create a set of single
+ * architecture mkext files and use lipo(1) or combine them programmatically.
+ *
+ * This function generates mkext files in a new format that only works on
+ * Mac OS X 10.6 or later.
+ */
+// xxx - add a version param and generate old-format mkexts?
+// xxx - add flag to take only most recent version of a given bundle ID?
+CF_EXPORT CFDataRef
+OSKextCreateMkext(
+ CFAllocatorRef allocator,
+ CFArrayRef kextArray,
+ CFURLRef volumeRootURL,
+ OSKextRequiredFlags requiredFlags,
+ Boolean compressFlag)
+ ;
+
+/*!
+ * @function OSKextCreateKextsFromMkextFile
+ * @abstract Reads all kexts from an mkext file on disk.
+ *
+ * @param alocator
+ * The allocator to use to allocate memory for the new objects.
+ * Pass NULL or kCFAllocatorDefault
+ * to use the current default allocator.
+ * @param mkextURL
+ * The mkext file URL from which to create kexts.
+ * @result
+ * Returns an array containing the kext objects created,
+ * or NULL on failure.
+ *
+ * @discussion
+ * This function creates kext objects from an mkext file rather than from
+ * bundles on disk. Kexts created with this function are authenticated using
+ * the mkext file at mkextURL.
+ *
+ * A kext created from an mkext has only its info dictionary, executable,
+ * and any resources listed in its the OSBundleStartupResources property.
+ *
+ * Kexts created from an mkext are not uniqued using filesystem URLs,
+ * which belong to bundles actually in the filesystem;
+ * @link OSKextCreate@/link will never return a kext extracted from an mkext
+ * that originally had the URL given (even though the new mkext format
+ * stores that original URL).
+ * This also means that if you open the same mkext file multiple times,
+ * you will create distinct, identical copies of the kexts in that mkext file.
+ */
+CF_EXPORT CFArrayRef
+OSKextCreateKextsFromMkextFile(CFAllocatorRef allocator,
+ CFURLRef mkextURL)
+ ;
+
+/*!
+ * @function OSKextCreateKextsFromMkextData
+ * @abstract Reads all kexts from an mkext file in memory.
+ *
+ * @param alocator
+ * The allocator to use to allocate memory for the new objects.
+ * Pass NULL or kCFAllocatorDefault
+ * to use the current default allocator.
+ * @param mkextData
+ * The mkext file data from which to create kexts.
+ * @result
+ * Returns an array containing the kext objects created,
+ * or NULL on failure.
+ *
+ * @discussion
+ * This function creates kext objects from an mkext file in memory
+ * rather than from bundles on disk. Lacking any file in the filesystem,
+ * kexts created with this function can not be authenticated.
+ *
+ * A kext created from an mkext has only its info dictionary, executable,
+ * and any resources listed in its the OSBundleStartupResources property.
+ *
+ * Kexts created from an mkext are not uniqued using filesystem URLs,
+ * which belong to bundles actually in the filesystem;
+ * @link OSKextCreate@/link will never return a kext extracted from an mkext
+ * that originally had the URL given (even though the new mkext format
+ * stores that original URL).
+ * This also means that if you open the same mkext file multiple times,
+ * you will create distinct, identical copies of the kexts in that mkext file.
+ */
+CF_EXPORT CFArrayRef
+OSKextCreateKextsFromMkextData(CFAllocatorRef allocator,
+ CFDataRef mkextData)
+ ;
+
+/*!
+ * @function OSKextCreatePrelinkedKernel
+ * @abstract Creates a prelinked kernel from a kernel file and all open kexts.
+ *
+ * @param kernelImage The kernel image to use.
+ * @param kextArray
+ * The kexts to include in the prelinked kernel.
+ * Pass NULL to consult the running kernel
+ * for kexts to include from those open;
+ * the current architecture must match the runninng kernel's.
+ * @param volumeRootURL
+ * If non-NULL, kexts with this URL as a prefix
+ * strip it when saving their paths in the prelinked kernel.
+ * This allows creation of prelinked kernels from folders
+ * other than /System/Library/Extensions.
+ * @param needAllFlag
+ * If true and any kext fails to link,
+ * the skipAuthenticationFlag returns NULL.
+ * @param skipAuthenticationFlag
+ * If true, kexts are not authenticated for inclusion
+ * in the prelinked kernel.
+ * @param printDiagnosticsFlag
+ * If true, problems with the kexts that prevent
+ * inclusion of a kext in the prelinked kernel are logged via
+ * @link OSKextLogDiagnostics OSKextLogDiagnostics@/link.
+ * @param symbolsOut
+ * If non-NULL debug symbols for kernelImage
+ * and all kexts included in the result are returned by reference.
+ *
+ * @result
+ * A CFData object containing the prelinked kernel image based
+ * on the running kernel.
+ * Returns NULL if needAllFlag is true
+ * and any kext fails to link.
+ */
+CF_EXPORT CFDataRef
+OSKextCreatePrelinkedKernel(
+ CFDataRef kernelImage,
+ CFArrayRef kextArray,
+ CFURLRef volumeRootURL,
+ Boolean needAllFlag,
+ Boolean skipAuthenticationFlag,
+ Boolean printDiagnosticsFlag,
+ CFDictionaryRef * symbolsOut)
+ ;
+
+/*!
+ * @function OSKextotherCFBundleVersionIsLoaded
+ * @abstract
+ * Returns whether another version of a given kext is loaded in the kernel.
+ *
+ * @param aKext The kext to examine.
+ * @result
+ * true if a kext with the same identifier,
+ * but a different version or UUID
+ * from aKext, is loaded in the kernel.
+ * Returns false if aKext is loaded or if
+ * no kext with the same identifier is loaded.
+ *
+ * @discussion
+ * You must call @link OSKextReadLoadedKextInfo@/link for this flag to be meaningful,
+ * which in turn requires the current library architecture to match that
+ * of the running kernel.
+ * Use @link OSKextIsLoaded@/link to check whether aKext
+ * itself is loaded.
+ */
+CF_EXPORT Boolean OSKextotherCFBundleVersionIsLoaded(OSKextRef kext, Boolean* uuidFlag);
+
+__END_DECLS
+
+#endif /* __OSKEXT_H__ */
diff --git a/include/IOKit/OSMessageNotification.h b/include/IOKit/OSMessageNotification.h
new file mode 100644
index 0000000..e044c2a
--- /dev/null
+++ b/include/IOKit/OSMessageNotification.h
@@ -0,0 +1,158 @@
+/*
+ * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ *
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ *
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
+ *
+ * HISTORY
+ *
+ */
+
+#ifndef __OS_OSMESSAGENOTIFICATION_H
+#define __OS_OSMESSAGENOTIFICATION_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include
+#include
+#include "IOReturn.h"
+
+enum {
+ kFirstIOKitNotificationType = 100,
+ kIOServicePublishNotificationType = 100,
+ kIOServiceMatchedNotificationType = 101,
+ kIOServiceTerminatedNotificationType = 102,
+ kIOAsyncCompletionNotificationType = 150,
+ kIOServiceMessageNotificationType = 160,
+ kLastIOKitNotificationType = 199
+};
+
+enum {
+ kOSNotificationMessageID = 53,
+ kOSAsyncCompleteMessageID = 57,
+ kMaxAsyncArgs = 16
+};
+
+enum {
+ kIOAsyncReservedIndex = 0,
+ kIOAsyncReservedCount,
+
+ kIOAsyncCalloutFuncIndex = kIOAsyncReservedCount,
+ kIOAsyncCalloutRefconIndex,
+ kIOAsyncCalloutCount,
+
+ kIOMatchingCalloutFuncIndex = kIOAsyncReservedCount,
+ kIOMatchingCalloutRefconIndex,
+ kIOMatchingCalloutCount,
+
+ kIOInterestCalloutFuncIndex = kIOAsyncReservedCount,
+ kIOInterestCalloutRefconIndex,
+ kIOInterestCalloutServiceIndex,
+ kIOInterestCalloutCount
+};
+
+
+
+// --------------
+enum {
+ kOSAsyncRef64Count = 8,
+ kOSAsyncRef64Size = kOSAsyncRef64Count * ((int) sizeof(io_user_reference_t))
+};
+typedef io_user_reference_t OSAsyncReference64[kOSAsyncRef64Count];
+
+struct OSNotificationHeader64 {
+ mach_msg_size_t size; /* content size */
+ natural_t type;
+ OSAsyncReference64 reference;
+
+#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
+ unsigned char content[];
+#else
+ unsigned char content[0];
+#endif
+};
+
+#pragma pack(4)
+struct IOServiceInterestContent64 {
+ natural_t messageType;
+ io_user_reference_t messageArgument[1];
+};
+#pragma pack()
+// --------------
+
+#if !KERNEL_USER32
+
+enum {
+ kOSAsyncRefCount = 8,
+ kOSAsyncRefSize = 32
+};
+typedef natural_t OSAsyncReference[kOSAsyncRefCount];
+
+struct OSNotificationHeader {
+ mach_msg_size_t size; /* content size */
+ natural_t type;
+ OSAsyncReference reference;
+
+#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
+ unsigned char content[];
+#else
+ unsigned char content[0];
+#endif
+};
+
+#pragma pack(4)
+struct IOServiceInterestContent {
+ natural_t messageType;
+ void * messageArgument[1];
+};
+#pragma pack()
+
+#endif /* KERNEL_USER32 */
+
+struct IOAsyncCompletionContent {
+ IOReturn result;
+#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
+ void * args[] __attribute__ ((packed));
+#else
+ void * args[0] __attribute__ ((packed));
+#endif
+};
+
+#ifndef __cplusplus
+typedef struct OSNotificationHeader OSNotificationHeader;
+typedef struct IOServiceInterestContent IOServiceInterestContent;
+typedef struct IOAsyncCompletionContent IOAsyncCompletionContent;
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __OS_OSMESSAGENOTIFICATION_H */
+
diff --git a/include/IOKit/hid/IOHIDDisplay.h b/include/IOKit/hid/IOHIDDisplay.h
new file mode 100644
index 0000000..e71efed
--- /dev/null
+++ b/include/IOKit/hid/IOHIDDisplay.h
@@ -0,0 +1,131 @@
+/*
+
+IOHIDDisplay.h ... I/O Kit HID Display
+
+Copyright (c) 2009 KennyTM~
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+* Neither the name of the KennyTM~ nor the names of its contributors may be
+ used to endorse or promote products derived from this software without
+ specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+#ifndef IOHID_DISPLAY_H
+#define IOHID_DISPLAY_H
+
+#include
+#include
+#include "IOHIDNotification.h"
+
+#if __cplusplus
+extern "C" {
+#endif
+
+ typedef struct __IOHIDDisplay
+#if 0
+ {
+ CFRuntimeBase _base; // 0, 4
+ void* client; // 8
+ io_service_t service; // c
+ CFRunLoopRef runloop; // 10
+ CFStringRef mode; // 14, *not retained*
+ IONotificationPortRef port; // 18
+ io_object_t notification; // 1c
+ CFMutableSetRef removalNotifications; // 20, set of IOHIDNotification's
+ CFMutableDictionaryRef properties; // 24
+ int logLevel; // 28
+ float brightness; // 34
+ float brightnessMin; // 38
+ float brightnessMax; // 3c
+ float brightnessFactor; // 40;
+ float x44; // 44
+ float ambient; // 4c
+ float brightnessAutoWeightMin; // 54
+ float brightnessAutoWeightMax; // 58
+ float x60; // 60
+ float x64; // 64
+ float x68; // 68
+ float x70; // 70
+ float x74; // 74
+ int x78; // 78
+ int x80; // 80
+ CFTimeInterval fadePeriod; // 84
+ }
+#endif
+ * IOHIDDisplayRef;
+
+#pragma mark -
+#pragma mark Creators
+
+ CFTypeID IOHIDDisplayGetTypeID(void);
+ IOHIDDisplayRef _IOHIDDisplayCreate(CFAllocatorRef allocator, io_service_t service);
+
+#pragma mark -
+#pragma mark Accessors
+
+ float _IOHIDDisplayGetAmbient(IOHIDDisplayRef display);
+ void _IOHIDDisplaySetAmbient(IOHIDDisplayRef display, float ambient);
+
+ float _IOHIDDisplayGetBrightness(IOHIDDisplayRef display);
+ void _IOHIDDisplaySetBrightness(IOHIDDisplayRef display, float brightness);
+ void _IOHIDDisplaySetBrightnessMax(IOHIDDisplayRef display, float brightnessMax);
+
+ void _IOHIDDisplaySetBrightnessFactor(IOHIDDisplayRef display, float factor);
+ float _IOHIDDisplayGetBrightnessFactor(IOHIDDisplayRef display);
+
+ void IOHIDDisplaySetProperty(IOHIDDisplayRef display, CFStringRef property, CFTypeRef value);
+ CFTypeRef IOHIDDisplayGetProperty(IOHIDDisplayRef display, CFStringRef property);
+
+ CFTypeRef _IOHIDDisplayGetClient(IOHIDDisplayRef display);
+
+#pragma mark -
+#pragma mark Actions
+
+ void _IOHIDDisplayUnscheduleWithRunLoop(IOHIDDisplayRef display, CFRunLoopRef runloop, CFStringRef mode);
+ void _IOHIDDisplayScheduleWithRunLoop(IOHIDDisplayRef display, CFRunLoopRef runloop, CFStringRef mode);
+
+ IOHIDNotificationRef IOHIDDisplayCreateRemovalNotification(IOHIDDisplayRef display, IOHIDNotificationCallback callback, void* target, void* refcon);
+
+ Boolean _IOHIDDisplayOpen(IOHIDDisplayRef display, CFTypeRef client);
+ void _IOHIDDisplayClose(IOHIDDisplayRef display, CFTypeRef client);
+
+#pragma mark -
+#pragma mark Constants
+
+ static const CFStringRef kIOHIDDisplayPropertyBrightness = CFSTR("DisplayBrightness"); // float
+ static const CFStringRef kIOHIDDisplayPropertyBrightnessAuto = CFSTR("DisplayBrightnessAuto"); // boolean
+ static const CFStringRef kIOHIDDisplayPropertyBrightnessMin = CFSTR("DisplayBrightnessMin"); // float
+ static const CFStringRef kIOHIDDisplayPropertyBrightnessMax = CFSTR("DisplayBrightnessMax"); // float
+ static const CFStringRef kIOHIDDisplayPropertyBrightnessAutoWeightMax = CFSTR("DisplayBrightnessAutoWeightMax"); // float
+ static const CFStringRef kIOHIDDisplayPropertyBrightnessAutoWeightMin = CFSTR("DisplayBrightnessAutoWeightMin"); // float
+ static const CFStringRef kIOHIDDisplayPropertyBrightnessFactor = CFSTR("DisplayBrightnessFactor"); // float
+ static const CFStringRef kIOHIDDisplayPropertyBrightnessFactorWithFade = CFSTR("DisplayBrightnessFactorWithFade"); // float
+ static const CFStringRef kIOHIDDisplayPropertyBrightnessFadePeriod = CFSTR("DisplayBrightnessFadePeriod"); // float
+ static const CFStringRef kIOHIDDisplayPropertyLogLevel = CFSTR("LogLevel"); // int
+
+#if __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/include/IOKit/hid/IOHIDEvent.h b/include/IOKit/hid/IOHIDEvent.h
new file mode 100644
index 0000000..a5ff641
--- /dev/null
+++ b/include/IOKit/hid/IOHIDEvent.h
@@ -0,0 +1,220 @@
+/*
+
+IOHIDEvent.h ... Header for IOHIDEvent*** functions.
+
+Copyright (c) 2009 KennyTM~
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+* Neither the name of the KennyTM~ nor the names of its contributors may be
+ used to endorse or promote products derived from this software without
+ specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+// With reference to http://www.opensource.apple.com/source/IOHIDFamily/IOHIDFamily-308/IOHIDFamily/IOHIDEvent.h .
+
+#ifndef IOKIT_HID_IOHIDEVENT_H
+#define IOKIT_HID_IOHIDEVENT_H 1
+
+//#include
+#include
+#include
+#include
+#include
+
+#if __cplusplus
+extern "C" {
+#endif
+
+ typedef struct __IOHIDEvent
+#if 0
+ {
+ CFRuntimeBase base; // 0, 4
+ AbsoluteTime _timeStamp; // 8, c
+ int x10; // 10
+ int x14; // 14
+ IOOptionBits _options; // 18
+ unsigned _typeMask; // 1c
+ CFMutableArrayRef _children; // 20
+ struct __IOHIDEvent* _parent; // 24
+
+ size_t recordSize; // 28
+ void record[];
+ }
+#endif
+ * IOHIDEventRef;
+
+#pragma mark -
+#pragma mark GetTypeID
+
+ /*! @function IOHIDEventGetTypeID */
+ CFTypeID IOHIDEventGetTypeID(void);
+
+#pragma mark -
+#pragma mark Generic creation functions
+
+ IOHIDEventRef IOHIDEventCreateCopy(CFAllocatorRef allocator, IOHIDEventRef event);
+ /*! @function IOHIDEventCreate
+ @abstract Create an IOHIDEvent.
+ @discussion All event-specific parameters are zeroed. */
+ IOHIDEventRef IOHIDEventCreate(CFAllocatorRef allocator, IOHIDEventType type, AbsoluteTime timeStamp, IOOptionBits options);
+
+ CFMutableDataRef IOHIDEventCreateData(CFAllocatorRef allocator, IOHIDEventRef event);
+ IOHIDEventRef IOHIDEventCreateWithData(CFAllocatorRef allocator, CFDataRef data);
+
+#pragma mark -
+#pragma mark Predefined creation functions
+
+ IOHIDEventRef IOHIDEventCreateProgressEvent(CFAllocatorRef allocator, AbsoluteTime timeStamp,
+ uint32_t eventType, IOHIDFloat level, IOOptionBits options);
+ IOHIDEventRef IOHIDEventCreateVendorDefinedEvent(CFAllocatorRef allocator, AbsoluteTime timeStamp,
+ uint16_t usagePage, uint16_t usage, uint32_t version, const uint8_t* data, uint32_t length, IOOptionBits options);
+ IOHIDEventRef IOHIDEventCreateSwipeEvent(CFAllocatorRef allocator, AbsoluteTime timeStamp, IOHIDSwipeMask swipeMask, IOOptionBits options);
+
+ /*! @function IOHIDEventCreateDigitizerEvent
+ @abstract Create a digitizer event. You should use the more specialized methods instead. */
+ IOHIDEventRef IOHIDEventCreateDigitizerEvent(CFAllocatorRef allocator, uint64_t timeStamp, IOHIDDigitizerTransducerType type,
+ uint32_t index, uint32_t identity, uint32_t eventMask, uint32_t buttonMask,
+ IOHIDFloat x, IOHIDFloat y, IOHIDFloat z, IOHIDFloat tipPressure, IOHIDFloat barrelPressure,
+ Boolean range, Boolean touch, IOOptionBits options);
+ IOHIDEventRef IOHIDEventCreateDigitizerFingerEventWithQuality(CFAllocatorRef allocator, AbsoluteTime timeStamp,
+ uint32_t index, uint32_t identity, uint32_t eventMask,
+ IOHIDFloat x, IOHIDFloat y, IOHIDFloat z, IOHIDFloat tipPressure, IOHIDFloat twist,
+ IOHIDFloat minorRadius, IOHIDFloat majorRadius, IOHIDFloat quality, IOHIDFloat density, IOHIDFloat irregularity,
+ Boolean range, Boolean touch, IOOptionBits options);
+ /*! @function IOHIDEventCreateDigitizerFingerEvent
+ @abstract Create a finger digitizer event with default qualities.
+ @discussion The default qualities are:
+ - minorRadius = 5 mm,
+ - majorRadius = 5 mm,
+ - quality = 1,
+ - density = 1,
+ - irregularity = 1. */
+ IOHIDEventRef IOHIDEventCreateDigitizerFingerEvent(CFAllocatorRef allocator, uint64_t timeStamp,
+ uint32_t index, uint32_t identity, uint32_t eventMask,
+ IOHIDFloat x, IOHIDFloat y, IOHIDFloat z, IOHIDFloat tipPressure, IOHIDFloat twist,
+ Boolean range, Boolean touch, IOOptionBits options);
+ IOHIDEventRef IOHIDEventCreateDigitizerStylusEventWithPolarOrientation(CFAllocatorRef allocator, AbsoluteTime timeStamp,
+ uint32_t index, uint32_t identity, uint32_t eventMask, uint32_t buttonMask,
+ IOHIDFloat x, IOHIDFloat y, IOHIDFloat z, IOHIDFloat tipPressure, IOHIDFloat barrelPressure,
+ IOHIDFloat twist, IOHIDFloat altitude, IOHIDFloat azimuth,
+ Boolean range, Boolean invert, IOOptionBits options);
+ /*! @function IOHIDEventCreateDigitizerStylusEvent
+ @discussion Same as IOHIDEventCreateDigitizerStylusEventWithPolarOrientation? */
+ IOHIDEventRef IOHIDEventCreateDigitizerStylusEvent(CFAllocatorRef allocator, AbsoluteTime timeStamp,
+ uint32_t index, uint32_t identity, uint32_t eventMask, uint32_t buttonMask,
+ IOHIDFloat x, IOHIDFloat y, IOHIDFloat z, IOHIDFloat tipPressure, IOHIDFloat barrelPressure,
+ IOHIDFloat twist, IOHIDFloat altitude, IOHIDFloat azimuth,
+ Boolean range, Boolean invert, IOOptionBits options);
+
+ IOHIDEventRef IOHIDEventCreateProximtyEvent(CFAllocatorRef allocator, AbsoluteTime timeStamp, IOHIDProximityDetectionMask detectionMask, IOOptionBits options);
+#define IOHIDEventCreateProximityEvent IOHIDEventCreateProximtyEvent
+ IOHIDEventRef IOHIDEventCreateAmbientLightSensorEvent(CFAllocatorRef allocator, AbsoluteTime timeStamp, IOHIDFloat level, IOOptionBits options);
+
+ /*! @function IOHIDEventCreateMouseEvent
+ @abstract Create an mouse event, with pressure of 1.0. */
+ IOHIDEventRef IOHIDEventCreateMouseEvent(CFAllocatorRef allocator, AbsoluteTime timeStamp,
+ IOHIDFloat x, IOHIDFloat y, IOHIDFloat z, uint32_t buttonMask, IOOptionBits options);
+ /*! @function IOHIDEventCreateMouseEventWithPressure
+ @abstract Create an mouse event with pressure.
+ @discussion The mouse is considered clicked when the pressure is > 0.15. */
+ IOHIDEventRef IOHIDEventCreateMouseEventWithPressure(CFAllocatorRef allocator, AbsoluteTime timeStamp,
+ IOHIDFloat x, IOHIDFloat y, IOHIDFloat z, uint32_t buttonMask, IOHIDFloat pressure, IOOptionBits options);
+ /*! @function IOHIDEventCreateButtonEvent
+ @abstract Create an button event, with pressure of 1.0. */
+ IOHIDEventRef IOHIDEventCreateButtonEvent(CFAllocatorRef allocator, AbsoluteTime timeStamp, uint32_t buttonMask, IOOptionBits options);
+ /*! @function IOHIDEventCreateButtonEventWithPressure
+ @abstract Create an button event with pressure.
+ @discussion The button is considered pressed when the pressure is > 0.15. */
+ IOHIDEventRef IOHIDEventCreateButtonEventWithPressure(CFAllocatorRef allocator, AbsoluteTime timeStamp, uint32_t buttonMask, IOHIDFloat pressure, IOOptionBits options);
+
+ IOHIDEventRef IOHIDEventCreateKeyboardEvent(CFAllocatorRef allocator, uint64_t timeStamp, uint16_t usagePage, uint16_t usage, Boolean down, IOHIDEventOptionBits flags);
+
+ IOHIDEventRef IOHIDEventCreateAccelerometerEvent(CFAllocatorRef allocator, AbsoluteTime timeStamp, IOHIDFloat x, IOHIDFloat y, IOHIDFloat z, IOOptionBits options);
+ IOHIDEventRef IOHIDEventCreatePolarOrientationEvent(CFAllocatorRef allocator, AbsoluteTime timeStamp, IOHIDFloat x, IOHIDFloat y, IOHIDFloat z, IOOptionBits options);
+ IOHIDEventRef IOHIDEventCreateOrientationEvent(CFAllocatorRef allocator, AbsoluteTime timeStamp, IOHIDFloat x, IOHIDFloat y, IOHIDFloat z, IOOptionBits options);
+ IOHIDEventRef IOHIDEventCreateVelocityEvent(CFAllocatorRef allocator, AbsoluteTime timeStamp, IOHIDFloat x, IOHIDFloat y, IOHIDFloat z, IOOptionBits options);
+ IOHIDEventRef IOHIDEventCreateScaleEvent(CFAllocatorRef allocator, AbsoluteTime timeStamp, IOHIDFloat x, IOHIDFloat y, IOHIDFloat z, IOOptionBits options);
+ IOHIDEventRef IOHIDEventCreateScrollEvent(CFAllocatorRef allocator, AbsoluteTime timeStamp, IOHIDFloat x, IOHIDFloat y, IOHIDFloat z, IOOptionBits options);
+ IOHIDEventRef IOHIDEventCreateRotationEvent(CFAllocatorRef allocator, AbsoluteTime timeStamp, IOHIDFloat x, IOHIDFloat y, IOHIDFloat z, IOOptionBits options);
+ IOHIDEventRef IOHIDEventCreateTranslationEvent(CFAllocatorRef allocator, AbsoluteTime timeStamp, IOHIDFloat x, IOHIDFloat y, IOHIDFloat z, IOOptionBits options);
+
+#pragma mark -
+#pragma mark Accessors
+
+ IOHIDEventType IOHIDEventGetType(IOHIDEventRef event);
+
+ AbsoluteTime IOHIDEventGetTimeStamp(IOHIDEventRef event);
+ void IOHIDEventSetTimeStamp(IOHIDEventRef event, AbsoluteTime timeStamp);
+
+ uint32_t IOHIDEventGetEventFlags(IOHIDEventRef event);
+ void IOHIDEventSetEventFlags(IOHIDEventRef event, uint32_t eventFlags);
+ Boolean IOHIDEventIsAbsolute(IOHIDEventRef event);
+
+ IOHIDEventRef IOHIDEventGetParent(IOHIDEventRef event);
+ CFArrayRef IOHIDEventGetChildren(IOHIDEventRef event);
+
+ void IOHIDEventGetVendorDefinedData(IOHIDEventRef event, uint32_t* length, uint8_t** data);
+
+#pragma mark -
+#pragma mark Subevents
+
+ /*! @function IOHIDEventGetEventWithOptions
+ @abstract Get the deepest event that bears the specified type and matches the options.
+ @discussion If any of the top 4 bits of options is set (i.e. (options & 0xF0000000) != 0), the children of this event will not be checked. */
+ IOHIDEventRef IOHIDEventGetEventWithOptions(IOHIDEventRef event, IOHIDEventType type, IOOptionBits options);
+ /*! @function IOHIDEventGetEvent
+ @abstract Get the event that bears the specified type.
+ @discussion Equivalent to IOHIDEventGetEventWithOptions(event, type, 0xF0000000); */
+ IOHIDEventRef IOHIDEventGetEvent(IOHIDEventRef event, IOHIDEventType type);
+
+ void IOHIDEventSetFloatValueWithOptions(IOHIDEventRef event, IOHIDEventField field, IOHIDFloat value, IOOptionBits options);
+ void IOHIDEventSetFloatValue(IOHIDEventRef event, IOHIDEventField field, IOHIDFloat value);
+ void IOHIDEventSetIntegerValueWithOptions(IOHIDEventRef event, IOHIDEventField field, int value, IOOptionBits options);
+ void IOHIDEventSetIntegerValue(IOHIDEventRef event, IOHIDEventField field, int value);
+ void IOHIDEventSetPositionWithOptions(IOHIDEventRef event, IOHIDEventField field, IOHID3DPoint position, IOOptionBits options);
+ void IOHIDEventSetPosition(IOHIDEventRef event, IOHIDEventField field, IOHID3DPoint position);
+
+ IOHIDFloat IOHIDEventGetFloatValueWithOptions(IOHIDEventRef event, IOHIDEventField field, IOOptionBits options);
+ IOHIDFloat IOHIDEventGetFloatValue(IOHIDEventRef event, IOHIDEventField field);
+ int IOHIDEventGetIntegerValueWithOptions(IOHIDEventRef event, IOHIDEventField field, IOOptionBits options);
+ int IOHIDEventGetIntegerValue(IOHIDEventRef event, IOHIDEventField field);
+ IOHID3DPoint IOHIDEventGetPositionWithOptions(IOHIDEventRef event, IOHIDEventField field, IOOptionBits options);
+ IOHID3DPoint IOHIDEventGetPosition(IOHIDEventRef event, IOHIDEventField field);
+
+ /*! @function IOHIDEventConformsToWithOptions
+ @abstract Returns if the event or any of its children bears the specified type and options.
+ @discussion If any of the top 4 bits of options is set (i.e. (options & 0xF0000000) != 0), the children of this event will not be checked. */
+ Boolean IOHIDEventConformsToWithOptions(IOHIDEventRef event, IOHIDEventType type, IOOptionBits options);
+ /*! @function IOHIDEventConformsTo
+ @abstract Returns if the event bears the specified type.
+ @discussion Equivalent to IOHIDEventConformsToWithOptions(event, type, 0xF0000000); */
+ Boolean IOHIDEventConformsTo(IOHIDEventRef event, IOHIDEventType type);
+
+ void IOHIDEventRemoveEvent(IOHIDEventRef event, IOHIDEventRef childEvent);
+ void IOHIDEventAppendEvent(IOHIDEventRef event, IOHIDEventRef childEvent);
+
+#if __cplusplus
+}
+#endif
+
+#endif
diff --git a/include/IOKit/hid/IOHIDEventData.h b/include/IOKit/hid/IOHIDEventData.h
new file mode 100644
index 0000000..3eea4ab
--- /dev/null
+++ b/include/IOKit/hid/IOHIDEventData.h
@@ -0,0 +1,1019 @@
+/*
+ *
+ * @APPLE_LICENSE_HEADER_START@
+ *
+ * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
+ *
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * @APPLE_LICENSE_HEADER_END@
+ */
+
+#ifndef _IOKIT_HID_IOHIDEVENTDATA_H
+#define _IOKIT_HID_IOHIDEVENTDATA_H
+
+#include
+#include
+
+#ifdef KERNEL
+ #include
+
+ #define IOHIDEventRef IOHIDEvent *
+#else
+ #include
+
+ typedef struct IOHIDEventData IOHIDEventData;
+#endif
+
+//==============================================================================
+// IOHIDEventData Declarations
+//==============================================================================
+
+#define IOHIDEVENT_BASE \
+ uint32_t size; \
+ IOHIDEventType type; \
+ uint64_t timestamp; \
+ uint32_t options;
+
+/*!
+ @typedef IOHIDEventData
+ @discussion
+ @field size Size, in bytes, of the memory detailing this
+ particular event
+ @field type Type of this particular event
+ @field options Event specific options
+*/
+
+struct IOHIDEventData{
+ IOHIDEVENT_BASE;
+};
+
+typedef struct _IOHIDVendorDefinedEventData {
+ IOHIDEVENT_BASE;
+ uint16_t usagePage;
+ uint16_t usage;
+ uint32_t version;
+ uint32_t length;
+ uint8_t data[0];
+} IOHIDVendorDefinedEventData;
+
+enum {
+ kIOHIDKeyboardIsRepeat = 0x00010000
+};
+
+typedef struct _IOHIDKeyboardEventData {
+ IOHIDEVENT_BASE; // options = kHIDKeyboardRepeat
+ uint16_t usagePage;
+ uint16_t usage;
+ boolean_t down;
+} IOHIDKeyboardEventData;
+
+enum {
+ kIOHIDEventOptionIgnore = 0xf0000000
+};
+
+enum {
+ kIOHIDTransducerRange = 0x00010000,
+ kIOHIDTransducerTouch = 0x00020000,
+ kIOHIDTransducerInvert = 0x00040000,
+};
+
+enum {
+ kIOHIDDigitizerOrientationTypeTilt = 0,
+ kIOHIDDigitizerOrientationTypePolar,
+ kIOHIDDigitizerOrientationTypeQuality
+};
+typedef uint8_t IOHIDDigitizerOrientationType;
+
+#define IOHIDAXISEVENT_BASE \
+ struct { \
+ IOFixed x; \
+ IOFixed y; \
+ IOFixed z; \
+ } position;
+
+typedef struct _IOHIDAxisEventData {
+ IOHIDEVENT_BASE; // options = kHIDAxisRelative
+ IOHIDAXISEVENT_BASE;
+} IOHIDAxisEventData, IOHIDTranslationData, IOHIDRotationEventData, IOHIDScrollEventData, IOHIDScaleEventData, IOHIDVelocityData, IOHIDOrientationEventData;
+
+typedef struct _IOHIDAccelerometerEventData {
+ IOHIDEVENT_BASE; // options = kHIDAxisRelative
+ IOHIDAXISEVENT_BASE;
+ uint32_t acclType;
+} IOHIDAccelerometerEventData;
+
+typedef struct _IOHIDAmbientLightSensorEventData {
+ IOHIDEVENT_BASE; // options = kHIDAxisRelative
+ uint32_t level;
+ uint32_t ch0;
+ uint32_t ch1;
+ Boolean brightnessChanged;
+} IOHIDAmbientLightSensorEventData;
+
+typedef struct _IOHIDTemperatureEventData {
+ IOHIDEVENT_BASE;
+ IOFixed level;
+} IOHIDTemperatureEventData;
+
+typedef struct _IOHIDProximityEventData {
+ IOHIDEVENT_BASE;
+ uint32_t detectionMask;
+} IOHIDProximityEventData;
+
+typedef struct _IOHIDProgressEventData {
+ IOHIDEVENT_BASE;
+ uint32_t eventType;
+ IOFixed level;
+} IOHIDProgressEventData;
+
+
+#define IOHIDBUTTONEVENT_BASE \
+ struct { \
+ uint32_t buttonMask; \
+ IOFixed pressure; \
+ uint8_t buttonNumber; \
+ uint8_t clickState; \
+ } button;
+
+typedef struct _IOHIDButtonEventData {
+ IOHIDEVENT_BASE;
+ IOHIDBUTTONEVENT_BASE;
+} IOHIDButtonEventData;
+
+typedef struct _IOHIDMouseEventData {
+ IOHIDEVENT_BASE;
+ IOHIDAXISEVENT_BASE;
+ IOHIDBUTTONEVENT_BASE;
+} IOHIDMouseEventData;
+
+
+typedef struct _IOHIDDigitizerEventData {
+ IOHIDEVENT_BASE; // options = kIOHIDTransducerRange, kHIDTransducerTouch, kHIDTransducerInvert
+ IOHIDAXISEVENT_BASE; // 3c, 40, 44
+
+ uint32_t transducerIndex;
+ uint32_t transducerType; // could overload this to include that both the hand and finger id.
+ uint32_t identity; // Specifies a unique ID of the current transducer action.
+ uint32_t eventMask; // the type of event that has occurred: range, touch, position
+ uint32_t childEventMask; // CHILD: the type of event that has occurred: range, touch, position
+
+ uint32_t buttonMask; // Bit field representing the current button state
+ // Pressure field are assumed to be scaled from 0.0 to 1.0
+ IOFixed tipPressure; // Force exerted against the digitizer surface by the transducer.
+ IOFixed barrelPressure; // Force exerted directly by the user on a transducer sensor.
+
+ IOFixed twist; // Specifies the clockwise rotation of the cursor around its own major axis. Unsure it the device should declare units via properties or event. My first inclination is force degrees as the is the unit already expected by AppKit, Carbon and OpenGL.
+ uint32_t orientationType; // Specifies the orientation type used by the transducer.
+ union {
+ struct { // X Tilt and Y Tilt are used together to specify the tilt away from normal of a digitizer transducer. In its normal position, the values of X Tilt and Y Tilt for a transducer are both zero.
+ IOFixed x; // This quantity is used in conjunction with Y Tilt to represent the tilt away from normal of a transducer, such as a stylus. The X Tilt value represents the plane angle between the Y-Z plane and the plane containing the transducer axis and the Y axis. A positive X Tilt is to the right.
+ IOFixed y; // This value represents the angle between the X-Z and transducer-X planes. A positive Y Tilt is toward the user.
+ } tilt;
+ struct { // X Tilt and Y Tilt are used together to specify the tilt away from normal of a digitizer transducer. In its normal position, the values of X Tilt and Y Tilt for a transducer are both zero.
+ IOFixed altitude; //The angle with the X-Y plane though a signed, semicicular range. Positive values specify an angle downward and toward the positive Z axis.
+ IOFixed azimuth; // Specifies the counter clockwise rotation of the cursor around the Z axis though a full circular range.
+ } polar;
+ struct {
+ IOFixed quality; // If set, indicates that the transducer is sensed to be in a relatively noise-free region of digitizing.
+ IOFixed density;
+ IOFixed irregularity;
+ IOFixed majorRadius; // units in mm
+ IOFixed minorRadius; // units in mm
+ } quality;
+ }orientation;
+} IOHIDDigitizerEventData;
+
+typedef struct _IOHIDSwipeEventData {
+ IOHIDEVENT_BASE;
+ IOHIDSwipeMask swipeMask;
+} IOHIDSwipeEventData;
+
+
+/*!
+ @typedef IOHIDSystemQueueElement
+ @abstract Memory structure defining the layout of each event queue element
+ @discussion The IOHIDEventQueueElement represents a portion of mememory in the
+ new IOHIDEventQueue. It is possible that a event queue element
+ can contain multiple interpretations of a given event. The first
+ event is always considered the primary event.
+ @field version Version of the event queue element
+ @field size Size, in bytes, of this particular event queue element
+ @field timeStamp Time at which event was dispatched
+ @field deviceID ID of the sending device
+ @field options Options for further developement
+ @field eventCount The number of events contained in this transaction
+ @field events Begining offset of contiguous mememory that contains the
+ pertinent event data
+*/
+typedef struct _IOHIDSystemQueueElement {
+ uint64_t timeStamp;
+ uint64_t deviceID;
+ uint32_t options;
+ uint32_t eventCount;
+ IOHIDEventData events[];
+} IOHIDSystemQueueElement;
+
+//******************************************************************************
+// MACROS
+//******************************************************************************
+
+#define IOHIDEventFieldEventType(field) ((field >> 16) & 0xffff)
+#define IOHIDEventFieldOffset(field) (field & 0xffff)
+#define IOHIDEventGetSize(type,size) \
+{ \
+ switch ( type ) { \
+ case kIOHIDEventTypeNULL: \
+ size = sizeof(IOHIDEventData);\
+ break; \
+ case kIOHIDEventTypeVendorDefined:\
+ size = sizeof(IOHIDVendorDefinedEventData);\
+ break; \
+ case kIOHIDEventTypeKeyboard: \
+ size = sizeof(IOHIDKeyboardEventData);\
+ break; \
+ case kIOHIDEventTypeTranslation:\
+ case kIOHIDEventTypeRotation: \
+ case kIOHIDEventTypeScroll: \
+ case kIOHIDEventTypeScale: \
+ case kIOHIDEventTypeVelocity: \
+ case kIOHIDEventTypeOrientation:\
+ size = sizeof(IOHIDAxisEventData);\
+ break; \
+ case kIOHIDEventTypeAccelerometer:\
+ size = sizeof(IOHIDAccelerometerEventData);\
+ break;\
+ case kIOHIDEventTypeAmbientLightSensor:\
+ size = sizeof(IOHIDAmbientLightSensorEventData);\
+ break; \
+ case kIOHIDEventTypeProximity: \
+ size = sizeof(IOHIDProximityEventData);\
+ break; \
+ case kIOHIDEventTypeButton: \
+ size = sizeof(IOHIDButtonEventData);\
+ break; \
+ case kIOHIDEventTypeDigitizer: \
+ size = sizeof(IOHIDDigitizerEventData);\
+ break; \
+ case kIOHIDEventTypeTemperature:\
+ size = sizeof(IOHIDTemperatureEventData);\
+ break; \
+ case kIOHIDEventTypeSwipe:\
+ size = sizeof(IOHIDSwipeEventData);\
+ break; \
+ case kIOHIDEventTypeMouse:\
+ size = sizeof(IOHIDMouseEventData);\
+ break; \
+ case kIOHIDEventTypeProgress:\
+ size = sizeof(IOHIDProgressEventData);\
+ break; \
+ default: \
+ size = 0; \
+ break; \
+ } \
+}
+#define IOHIDEventGetQueueElementSize(type,size)\
+{ \
+ IOHIDEventGetSize(type,size); \
+ size += sizeof(IOHIDSystemQueueElement); \
+}
+
+#ifdef KERNEL
+ #ifdef HIDEVENTFIXED
+ #define IOHIDEventValueFloat(value) (value)
+ #define IOHIDEventValueFixed(value) (value)
+ #else
+ #define IOHIDEventValueFloat(value) (value >> 16)
+ #define IOHIDEventValueFixed(value) (value << 16)
+ #endif
+ #define IOHIDEventGetEventWithOptions(event, type, options) event->getEvent(type, options)
+ #define GET_EVENTDATA(event) event->_data
+#else
+ #define IOHIDEventValueFloat(value) (value / 65536.0)
+ #define IOHIDEventValueFixed(value) (value * 65536)
+ #define GET_EVENTDATA(event) event->eventData
+#endif
+
+//==============================================================================
+// IOHIDEventGetValue MACRO
+//==============================================================================
+#define GET_EVENTDATA_VALUE(eventData, fieldEvType, fieldOffset, value)\
+{ \
+ switch ( fieldEvType ) { \
+ case kIOHIDEventTypeNULL: \
+ switch ( fieldOffset ) { \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldIsRelative): \
+ value = (eventData->options & kIOHIDEventOptionIsAbsolute) == 0; \
+ break; \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldIsCollection): \
+ value = (eventData->options & kIOHIDEventOptionIsCollection) != 0; \
+ break; \
+ }; break; \
+ case kIOHIDEventTypeVendorDefined: \
+ { \
+ IOHIDVendorDefinedEventData * sysDef = (IOHIDVendorDefinedEventData*)eventData; \
+ switch ( fieldOffset ) { \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldVendorDefinedUsagePage): \
+ value = sysDef->usagePage; \
+ break; \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldVendorDefinedUsage): \
+ value = sysDef->usage; \
+ break; \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldVendorDefinedVersion): \
+ value = sysDef->version; \
+ break; \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldVendorDefinedDataLength): \
+ value = sysDef->length; \
+ break; \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldVendorDefinedData): \
+ if (sysDef->data) \
+ value = *((typeof(value)*) sysDef->data); \
+ break; \
+ }; \
+ } \
+ break; \
+ case kIOHIDEventTypeProgress: \
+ { \
+ IOHIDProgressEventData * progress = (IOHIDProgressEventData*)eventData; \
+ switch ( fieldOffset ) { \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldProgressEventType): \
+ value = progress->eventType; \
+ break; \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldProgressLevel): \
+ value = IOHIDEventValueFloat(progress->level); \
+ break; \
+ }; \
+ } \
+ break; \
+ case kIOHIDEventTypeButton: \
+ { \
+ IOHIDButtonEventData * button = (IOHIDButtonEventData*)eventData; \
+ switch ( fieldOffset ) { \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldButtonMask): \
+ value = button->button.buttonMask; \
+ break; \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldButtonNumber): \
+ value = button->button.buttonNumber; \
+ break; \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldButtonClickCount): \
+ value = button->button.clickState; \
+ break; \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldButtonPressure): \
+ value = IOHIDEventValueFloat(button->button.pressure); \
+ break; \
+ }; \
+ } \
+ break; \
+ case kIOHIDEventTypeAccelerometer: \
+ { \
+ IOHIDAccelerometerEventData * accl = (IOHIDAccelerometerEventData*)eventData; \
+ switch ( fieldOffset ) { \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldAccelerometerX): \
+ value = IOHIDEventValueFloat(accl->position.x); \
+ break; \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldAccelerometerY): \
+ value = IOHIDEventValueFloat(accl->position.y); \
+ break; \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldAccelerometerZ): \
+ value = IOHIDEventValueFloat(accl->position.z); \
+ break; \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldAccelerometerType): \
+ value = accl->acclType; \
+ break; \
+ }; \
+ } \
+ break; \
+ case kIOHIDEventTypeMouse: \
+ { \
+ IOHIDMouseEventData * mouse = (IOHIDMouseEventData*)eventData; \
+ switch ( fieldOffset ) { \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldMouseX): \
+ value = IOHIDEventValueFloat(mouse->position.x); \
+ break; \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldMouseY): \
+ value = IOHIDEventValueFloat(mouse->position.y); \
+ break; \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldMouseZ): \
+ value = IOHIDEventValueFloat(mouse->position.z); \
+ break; \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldMouseButtonMask): \
+ value = mouse->button.buttonMask; \
+ break; \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldMouseNumber): \
+ value = mouse->button.buttonNumber; \
+ break; \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldMouseClickCount): \
+ value = mouse->button.clickState; \
+ break; \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldMousePressure): \
+ value = IOHIDEventValueFloat(mouse->button.pressure); \
+ break; \
+ }; \
+ } \
+ break; \
+ case kIOHIDEventTypeSwipe: \
+ { \
+ IOHIDSwipeEventData * swipe = (IOHIDSwipeEventData *)eventData; \
+ switch ( fieldOffset ) { \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldSwipeMask): \
+ value = swipe->swipeMask; \
+ break; \
+ }; \
+ } \
+ break; \
+ case kIOHIDEventTypeTemperature: \
+ { \
+ IOHIDTemperatureEventData * temp = (IOHIDTemperatureEventData *)eventData; \
+ switch ( fieldOffset ) { \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldTemperatureLevel): \
+ value = IOHIDEventValueFloat(temp->level);\
+ break; \
+ }; \
+ } \
+ break; \
+ case kIOHIDEventTypeTranslation: \
+ case kIOHIDEventTypeRotation: \
+ case kIOHIDEventTypeScroll: \
+ case kIOHIDEventTypeScale: \
+ case kIOHIDEventTypeVelocity: \
+ case kIOHIDEventTypeOrientation: \
+ { \
+ IOHIDAxisEventData * axis = (IOHIDAxisEventData *)eventData; \
+ switch ( fieldOffset ) { \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldTranslationX): \
+ /* \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldRotationX): \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldScrollX): \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldScaleX): \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldVelocityX): \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldDigitizerX); \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldOrientationRadius): \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldAccelerometerX): \
+ */ \
+ value = IOHIDEventValueFloat(axis->position.x); \
+ break; \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldTranslationY): \
+ /* \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldRotationY): \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldScrollY): \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldScaleY): \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldVelocityY): \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldDigitizerY); \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldOrientationAzimuth): \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldAccelerometerY): \
+ */ \
+ value = IOHIDEventValueFloat(axis->position.y); \
+ break; \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldTranslationZ): \
+ /* \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldRotationZ): \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldScrollZ): \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldScaleZ): \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldVelocityZ): \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldDigitizerZ); \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldOrientationAltitude):\
+ case IOHIDEventFieldOffset(kIOHIDEventFieldAccelerometerZ): \
+ */ \
+ value = IOHIDEventValueFloat(axis->position.z); \
+ break; \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldScrollIsPixels): \
+ value = ((axis->options & kIOHIDEventOptionPixelUnits) != 0);\
+ break; \
+ }; \
+ } \
+ break; \
+ case kIOHIDEventTypeAmbientLightSensor: \
+ { \
+ IOHIDAmbientLightSensorEventData * alsEvent = (IOHIDAmbientLightSensorEventData *)eventData;\
+ switch ( fieldOffset ) { \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldAmbientLightSensorLevel): \
+ value = alsEvent->level; \
+ break; \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldAmbientLightSensorRawChannel0): \
+ value = alsEvent->ch0; \
+ break; \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldAmbientLightSensorRawChannel1): \
+ value = alsEvent->ch1; \
+ break; \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldAmbientLightDisplayBrightnessChanged): \
+ value = alsEvent->brightnessChanged; \
+ break; \
+ }; \
+ } \
+ break; \
+ case kIOHIDEventTypeProximity: \
+ { \
+ IOHIDProximityEventData * proxEvent = (IOHIDProximityEventData *)eventData;\
+ switch ( fieldOffset ) { \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldProximityDetectionMask): \
+ value = proxEvent->detectionMask; \
+ break; \
+ }; \
+ } \
+ break; \
+ case kIOHIDEventTypeKeyboard: \
+ { \
+ IOHIDKeyboardEventData * keyEvent = (IOHIDKeyboardEventData *)eventData;\
+ switch ( fieldOffset ) { \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldKeyboardUsagePage): \
+ value = keyEvent->usagePage; \
+ break; \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldKeyboardUsage): \
+ value = keyEvent->usage; \
+ break; \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldKeyboardDown): \
+ value = keyEvent->down; \
+ break; \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldKeyboardRepeat): \
+ value = (keyEvent->options & kIOHIDKeyboardIsRepeat);\
+ break; \
+ }; \
+ } \
+ break; \
+ case kIOHIDEventTypeDigitizer: \
+ { \
+ IOHIDDigitizerEventData * digEvent = (IOHIDDigitizerEventData *)eventData; \
+ switch ( fieldOffset ) { \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldDigitizerX): \
+ value = IOHIDEventValueFloat(digEvent->position.x); \
+ break; \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldDigitizerY): \
+ value = IOHIDEventValueFloat(digEvent->position.y); \
+ break; \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldDigitizerZ): \
+ value = IOHIDEventValueFloat(digEvent->position.z); \
+ break; \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldDigitizerButtonMask): \
+ value = digEvent->buttonMask; \
+ break; \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldDigitizerIndex): \
+ value = digEvent->transducerIndex; \
+ break; \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldDigitizerIdentity): \
+ value = digEvent->identity; \
+ break; \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldDigitizerEventMask): \
+ value = digEvent->eventMask; \
+ break; \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldDigitizerChildEventMask): \
+ value = digEvent->childEventMask; \
+ break; \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldDigitizerRange): \
+ value = (digEvent->options & kIOHIDTransducerRange) != 0;\
+ break; \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldDigitizerTouch): \
+ value = (digEvent->options & kIOHIDTransducerTouch) != 0;\
+ break; \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldDigitizerCollection): \
+ value = (digEvent->options & kIOHIDEventOptionIsCollection) != 0;\
+ break; \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldDigitizerPressure): \
+ value = IOHIDEventValueFloat(digEvent->tipPressure); \
+ break; \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldDigitizerBarrelPressure): \
+ value = IOHIDEventValueFloat(digEvent->barrelPressure); \
+ break; \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldDigitizerTwist): \
+ value = IOHIDEventValueFloat(digEvent->twist); \
+ break; \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldDigitizerTiltX): \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldDigitizerTiltY): \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldDigitizerQuality): \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldDigitizerDensity): \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldDigitizerIrregularity): \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldDigitizerMajorRadius): \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldDigitizerMinorRadius): \
+ switch ( digEvent->orientationType ) {\
+ case kIOHIDDigitizerOrientationTypeTilt:\
+ switch ( fieldOffset ) {\
+ case IOHIDEventFieldOffset(kIOHIDEventFieldDigitizerTiltX): \
+ value = IOHIDEventValueFloat(digEvent->orientation.tilt.x); \
+ break; \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldDigitizerTiltY): \
+ value = IOHIDEventValueFloat(digEvent->orientation.tilt.y); \
+ break; \
+ }; \
+ break; \
+ case kIOHIDDigitizerOrientationTypePolar:\
+ switch ( fieldOffset ) {\
+ case IOHIDEventFieldOffset(kIOHIDEventFieldDigitizerAltitude): \
+ value = IOHIDEventValueFloat(digEvent->orientation.polar.altitude); \
+ break; \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldDigitizerAzimuth): \
+ value = IOHIDEventValueFloat(digEvent->orientation.polar.azimuth); \
+ break; \
+ }; \
+ break; \
+ case kIOHIDDigitizerOrientationTypeQuality:\
+ switch ( fieldOffset ) {\
+ case IOHIDEventFieldOffset(kIOHIDEventFieldDigitizerQuality): \
+ value = IOHIDEventValueFloat(digEvent->orientation.quality.quality); \
+ break; \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldDigitizerDensity): \
+ value = IOHIDEventValueFloat(digEvent->orientation.quality.density); \
+ break; \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldDigitizerIrregularity): \
+ value = IOHIDEventValueFloat(digEvent->orientation.quality.irregularity); \
+ break; \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldDigitizerMajorRadius): \
+ value = IOHIDEventValueFloat(digEvent->orientation.quality.majorRadius); \
+ break; \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldDigitizerMinorRadius): \
+ value = IOHIDEventValueFloat(digEvent->orientation.quality.minorRadius); \
+ break; \
+ }; \
+ break; \
+ }; \
+ break; \
+ }; \
+ } \
+ break; \
+ }; \
+}
+
+#define GET_EVENT_VALUE(event, field, value, options) \
+{ IOHIDEventType fieldEvType = IOHIDEventFieldEventType(field); \
+ uint32_t fieldOffset = IOHIDEventFieldOffset(field); \
+ IOHIDEventRef ev = NULL; \
+ if ( (ev = IOHIDEventGetEventWithOptions(event, fieldEvType, options)) ) {\
+ GET_EVENTDATA_VALUE(GET_EVENTDATA(ev),fieldEvType,fieldOffset,value);\
+ } \
+}
+
+//==============================================================================
+// IOHIDEventSetValue MACRO
+//==============================================================================
+#define SET_EVENTDATA_VALUE(eventData, fieldEvType, fieldOffset, value) \
+{ switch ( fieldEvType ) { \
+ case kIOHIDEventTypeNULL: \
+ switch ( fieldOffset ) { \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldIsRelative): \
+ if ( value ) \
+ eventData->options &= ~kIOHIDEventOptionIsAbsolute; \
+ else \
+ eventData->options |= kIOHIDEventOptionIsAbsolute; \
+ break; \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldIsCollection): \
+ if ( value ) \
+ eventData->options |= kIOHIDEventOptionIsCollection; \
+ else \
+ eventData->options &= ~kIOHIDEventOptionIsCollection; \
+ break; \
+ }; break; \
+ case kIOHIDEventTypeVendorDefined: \
+ { \
+ IOHIDVendorDefinedEventData * sysDef = (IOHIDVendorDefinedEventData*)eventData; \
+ switch ( fieldOffset ) { \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldVendorDefinedUsagePage): \
+ sysDef->usagePage = value; \
+ break; \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldVendorDefinedUsage): \
+ sysDef->usage = value; \
+ break; \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldVendorDefinedVersion): \
+ sysDef->version = value; \
+ break; \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldVendorDefinedData): \
+ if (sysDef->data) \
+ *((typeof(value)*) sysDef->data) = value; \
+ break; \
+ }; \
+ } \
+ break; \
+ case kIOHIDEventTypeProgress: \
+ { \
+ IOHIDProgressEventData * progress = (IOHIDProgressEventData*)eventData; \
+ switch ( fieldOffset ) { \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldProgressEventType): \
+ progress->eventType = value; \
+ break; \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldProgressLevel): \
+ progress->level = IOHIDEventValueFixed(value); \
+ break; \
+ }; \
+ } \
+ break; \
+ case kIOHIDEventTypeButton: \
+ { \
+ IOHIDButtonEventData * button = (IOHIDButtonEventData*)eventData; \
+ switch ( fieldOffset ) { \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldButtonMask): \
+ button->button.buttonMask = value; \
+ break; \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldButtonNumber): \
+ button->button.buttonNumber = value; \
+ break; \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldButtonClickCount): \
+ button->button.clickState = value; \
+ break; \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldButtonPressure): \
+ button->button.pressure = IOHIDEventValueFixed(value); \
+ break; \
+ }; \
+ } \
+ break; \
+ case kIOHIDEventTypeAccelerometer: \
+ { \
+ IOHIDAccelerometerEventData * accl = (IOHIDAccelerometerEventData*)eventData; \
+ switch ( fieldOffset ) { \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldAccelerometerX): \
+ accl->position.x = IOHIDEventValueFixed(value); \
+ break; \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldAccelerometerY): \
+ accl->position.y = IOHIDEventValueFixed(value); \
+ break; \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldAccelerometerZ): \
+ accl->position.z = IOHIDEventValueFixed(value); \
+ break; \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldAccelerometerType): \
+ accl->acclType = value; \
+ break; \
+ }; \
+ } \
+ break; \
+ case kIOHIDEventTypeMouse: \
+ { \
+ IOHIDMouseEventData * mouse = (IOHIDMouseEventData*)eventData; \
+ switch ( fieldOffset ) { \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldMouseX): \
+ mouse->position.x = IOHIDEventValueFixed(value); \
+ break; \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldMouseY): \
+ mouse->position.y = IOHIDEventValueFixed(value); \
+ break; \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldMouseZ): \
+ mouse->position.z = IOHIDEventValueFixed(value); \
+ break; \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldMouseButtonMask): \
+ mouse->button.buttonMask = value; \
+ break; \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldMouseNumber): \
+ mouse->button.buttonNumber = value; \
+ break; \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldMouseClickCount): \
+ mouse->button.clickState = value; \
+ break; \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldMousePressure): \
+ mouse->button.pressure = IOHIDEventValueFixed(value); \
+ break; \
+ }; \
+ } \
+ break; \
+ case kIOHIDEventTypeSwipe: \
+ { \
+ IOHIDSwipeEventData * swipe = (IOHIDSwipeEventData *)eventData; \
+ switch ( fieldOffset ) { \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldSwipeMask): \
+ swipe->swipeMask = value;\
+ break; \
+ }; \
+ } \
+ break; \
+ case kIOHIDEventTypeTemperature: \
+ { \
+ IOHIDTemperatureEventData * temp = (IOHIDTemperatureEventData *)eventData; \
+ switch ( fieldOffset ) { \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldTemperatureLevel): \
+ temp->level = IOHIDEventValueFixed(value);\
+ break; \
+ }; \
+ } \
+ break; \
+ case kIOHIDEventTypeTranslation: \
+ case kIOHIDEventTypeRotation: \
+ case kIOHIDEventTypeScroll: \
+ case kIOHIDEventTypeScale: \
+ case kIOHIDEventTypeVelocity: \
+ case kIOHIDEventTypeOrientation: \
+ { \
+ IOHIDAxisEventData * axis = (IOHIDAxisEventData *)eventData; \
+ switch ( fieldOffset ) { \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldTranslationX): \
+ /* \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldRotationX): \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldScrollX): \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldScaleX): \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldVelocityX): \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldDigitizerX); \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldOrientationRadius): \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldAccelerometerX): \
+ */ \
+ axis->position.x = IOHIDEventValueFixed(value); \
+ break; \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldTranslationY): \
+ /* \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldRotationY): \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldScrollY): \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldScaleY): \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldVelocityY): \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldDigitizerY); \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldOrientationAzimuth): \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldAccelerometerY): \
+ */ \
+ axis->position.y = IOHIDEventValueFixed(value); \
+ break; \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldTranslationZ): \
+ /* \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldRotationZ): \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldScrollZ): \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldScaleZ): \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldVelocityZ): \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldDigitizerZ); \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldOrientationAltitude):\
+ case IOHIDEventFieldOffset(kIOHIDEventFieldAccelerometerZ): \
+ */ \
+ axis->position.z = IOHIDEventValueFixed(value); \
+ break; \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldScrollIsPixels): \
+ if ( value ) \
+ axis->options |= kIOHIDEventOptionPixelUnits; \
+ else \
+ axis->options &= ~kIOHIDEventOptionPixelUnits; \
+ break; \
+ }; \
+ } \
+ break; \
+ case kIOHIDEventTypeAmbientLightSensor: \
+ { \
+ IOHIDAmbientLightSensorEventData * alsEvent = (IOHIDAmbientLightSensorEventData *)eventData;\
+ switch ( fieldOffset ) { \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldAmbientLightSensorLevel): \
+ alsEvent->level = value; \
+ break; \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldAmbientLightSensorRawChannel0): \
+ alsEvent->ch0 = value; \
+ break; \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldAmbientLightSensorRawChannel1): \
+ alsEvent->ch1 = value; \
+ break; \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldAmbientLightDisplayBrightnessChanged): \
+ alsEvent->brightnessChanged = value; \
+ break; \
+ }; \
+ } \
+ break; \
+ case kIOHIDEventTypeProximity: \
+ { \
+ IOHIDProximityEventData * proxEvent = (IOHIDProximityEventData *)eventData;\
+ switch ( fieldOffset ) { \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldProximityDetectionMask): \
+ proxEvent->detectionMask = value; \
+ break; \
+ }; \
+ } \
+ break; \
+ case kIOHIDEventTypeKeyboard: \
+ { \
+ IOHIDKeyboardEventData * keyEvent = (IOHIDKeyboardEventData *)eventData;\
+ switch ( fieldOffset ) { \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldKeyboardUsagePage): \
+ keyEvent->usagePage = value; \
+ break; \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldKeyboardUsage): \
+ keyEvent->usage = value; \
+ break; \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldKeyboardDown): \
+ keyEvent->down = value; \
+ break; \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldKeyboardRepeat): \
+ if ( value ) \
+ keyEvent->options |= kIOHIDKeyboardIsRepeat; \
+ else \
+ keyEvent->options &= ~kIOHIDKeyboardIsRepeat; \
+ break; \
+ }; \
+ } \
+ break; \
+ case kIOHIDEventTypeDigitizer: \
+ { \
+ IOHIDDigitizerEventData * digEvent = (IOHIDDigitizerEventData *)eventData; \
+ switch ( fieldOffset ) { \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldDigitizerX): \
+ digEvent->position.x = IOHIDEventValueFixed(value); \
+ break; \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldDigitizerY): \
+ digEvent->position.y = IOHIDEventValueFixed(value); \
+ break; \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldDigitizerZ): \
+ digEvent->position.z = IOHIDEventValueFixed(value); \
+ break; \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldDigitizerButtonMask): \
+ digEvent->buttonMask = value; \
+ break; \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldDigitizerIndex): \
+ digEvent->transducerIndex = value; \
+ break; \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldDigitizerIdentity): \
+ digEvent->identity = value; \
+ break; \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldDigitizerEventMask): \
+ digEvent->eventMask = value; \
+ break; \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldDigitizerChildEventMask): \
+ digEvent->childEventMask = value; \
+ break; \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldDigitizerRange): \
+ if ( value ) \
+ digEvent->options |= kIOHIDTransducerRange; \
+ else \
+ digEvent->options &= ~kIOHIDTransducerRange; \
+ break; \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldDigitizerTouch): \
+ if ( value ) \
+ digEvent->options |= kIOHIDTransducerTouch; \
+ else \
+ digEvent->options &= ~kIOHIDTransducerTouch; \
+ break; \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldDigitizerCollection): \
+ if ( value ) \
+ digEvent->options |= kIOHIDEventOptionIsCollection; \
+ else \
+ digEvent->options &= ~kIOHIDEventOptionIsCollection; \
+ break; \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldDigitizerPressure): \
+ digEvent->tipPressure = IOHIDEventValueFixed(value); \
+ break; \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldDigitizerBarrelPressure): \
+ digEvent->barrelPressure = IOHIDEventValueFixed(value); \
+ break; \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldDigitizerTwist): \
+ digEvent->twist = IOHIDEventValueFixed(value); \
+ break; \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldDigitizerTiltX): \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldDigitizerTiltY): \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldDigitizerQuality): \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldDigitizerDensity): \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldDigitizerIrregularity): \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldDigitizerMajorRadius): \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldDigitizerMinorRadius): \
+ switch ( digEvent->orientationType ) {\
+ case kIOHIDDigitizerOrientationTypeTilt:\
+ switch ( fieldOffset ) {\
+ case IOHIDEventFieldOffset(kIOHIDEventFieldDigitizerTiltX): \
+ digEvent->orientation.tilt.x = IOHIDEventValueFixed(value); \
+ break; \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldDigitizerTiltY): \
+ digEvent->orientation.tilt.y = IOHIDEventValueFixed(value); \
+ break; \
+ }; \
+ break; \
+ case kIOHIDDigitizerOrientationTypePolar:\
+ switch ( fieldOffset ) {\
+ case IOHIDEventFieldOffset(kIOHIDEventFieldDigitizerAltitude): \
+ digEvent->orientation.polar.altitude = IOHIDEventValueFixed(value); \
+ break; \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldDigitizerAzimuth): \
+ digEvent->orientation.polar.azimuth = IOHIDEventValueFixed(value); \
+ break; \
+ }; \
+ break; \
+ case kIOHIDDigitizerOrientationTypeQuality:\
+ switch ( fieldOffset ) {\
+ case IOHIDEventFieldOffset(kIOHIDEventFieldDigitizerQuality): \
+ digEvent->orientation.quality.quality = IOHIDEventValueFixed(value); \
+ break; \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldDigitizerDensity): \
+ digEvent->orientation.quality.density = IOHIDEventValueFixed(value); \
+ break; \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldDigitizerIrregularity): \
+ digEvent->orientation.quality.irregularity = IOHIDEventValueFixed(value); \
+ break; \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldDigitizerMajorRadius): \
+ digEvent->orientation.quality.majorRadius = IOHIDEventValueFixed(value); \
+ break; \
+ case IOHIDEventFieldOffset(kIOHIDEventFieldDigitizerMinorRadius): \
+ digEvent->orientation.quality.minorRadius = IOHIDEventValueFixed(value); \
+ break; \
+ }; \
+ break; \
+ }; \
+ break; \
+ }; \
+ } \
+ break; \
+ }; \
+}
+
+#define SET_EVENT_VALUE(event, field, value, options) \
+{ IOHIDEventType fieldEvType = IOHIDEventFieldEventType(field); \
+ uint32_t fieldOffset = IOHIDEventFieldOffset(field); \
+ IOHIDEventRef ev = NULL; \
+ if ( (ev = IOHIDEventGetEventWithOptions(event, fieldEvType, options)) ) {\
+ SET_EVENTDATA_VALUE(GET_EVENTDATA(ev),fieldEvType,fieldOffset,value);\
+ } \
+}
+
+#endif /* _IOKIT_HID_IOHIDEVENTDATA_H */
diff --git a/include/IOKit/hid/IOHIDEventQueue.h b/include/IOKit/hid/IOHIDEventQueue.h
new file mode 100644
index 0000000..84c9c63
--- /dev/null
+++ b/include/IOKit/hid/IOHIDEventQueue.h
@@ -0,0 +1,82 @@
+/*
+
+IOHIDEventQueue.h ... Header for IOHIDEventQueue*** functions.
+
+Copyright (c) 2009 KennyTM~
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+* Neither the name of the KennyTM~ nor the names of its contributors may be
+ used to endorse or promote products derived from this software without
+ specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+#ifndef IOKIT_HID_IOHIDEVENTQUEUE_H
+#define IOKIT_HID_IOHIDEVENTQUEUE_H 1
+
+#include
+#include "IOHIDEvent.h"
+
+#if __cplusplus
+extern "C" {
+#endif
+
+ typedef struct __IOHIDEventQueue
+#if 0
+ {
+ CFRuntimeBase base; // 0, 4
+ IODataQueueMemory* queue; // 8
+ size_t queueSize; // c
+ int notificationPortType; // 10, 0 -> associate to hidSystem, 1 -> associate to data queue.
+ uint32_t token; // 14
+ int topBitOfToken; // 18, = token >> 31
+ }
+#endif
+ * IOHIDEventQueueRef;
+
+#pragma mark -
+#pragma mark Creators
+
+ CFTypeID IOHIDEventQueueGetTypeID(void);
+
+ // Token must be nonzero.
+ IOHIDEventQueueRef IOHIDEventQueueCreateWithToken(CFAllocatorRef allocator, uint32_t token);
+ IOHIDEventQueueRef IOHIDEventQueueCreate(CFAllocatorRef allocator, int notificationPortType, uint32_t token);
+
+#pragma mark -
+#pragma mark Accessors
+
+ uint32_t IOHIDEventQueueGetToken(IOHIDEventQueueRef queue);
+
+ void IOHIDEventQueueSetNotificationPort(IOHIDEventQueueRef queue, mach_port_t port);
+
+#pragma mark -
+#pragma mark Actions
+
+ IOHIDEventRef IOHIDEventQueueDequeueCopy(IOHIDEventQueueRef queue);
+ void IOHIDEventQueueEnqueue(IOHIDEventQueueRef queue, IOHIDEventRef event); // will send a message to the "tickle port" as well.
+
+#if __cplusplus
+}
+#endif
+
+#endif
diff --git a/include/IOKit/hid/IOHIDEventSystem.h b/include/IOKit/hid/IOHIDEventSystem.h
new file mode 100644
index 0000000..5b90e24
--- /dev/null
+++ b/include/IOKit/hid/IOHIDEventSystem.h
@@ -0,0 +1,104 @@
+/*
+
+IOHIDEventSystem.h ... I/O Kit HID Event System
+
+Copyright (c) 2010 KennyTM~
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+* Neither the name of the KennyTM~ nor the names of its contributors may be
+ used to endorse or promote products derived from this software without
+ specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+// With reference to http://www.opensource.apple.com/source/IOHIDFamily/IOHIDFamily-258.1/IOHIDLib/IOHIDEventServiceClass.h
+
+#ifndef IOHID_EVENT_SYSTEM_H
+#define IOHID_EVENT_SYSTEM_H
+
+#include
+#include "IOHIDNotification.h"
+#include "IOHIDService.h"
+#include "IOHIDEvent.h"
+#include "IOHIDEventQueue.h"
+
+#if __cplusplus
+extern "C" {
+#endif
+
+ typedef struct ___IOHIDEventSystem
+#if 0
+ {
+ CFRuntimeBase _base; // 0, 4
+ CFMutableSetRef services; // 8
+ CFMutableSetRef x0c; // c
+ CFMutableSetRef x10; // 10
+ CFMutableSetRef matchNotifications; // 14
+ IONotificationPortRef serviceMatchPort; // 18
+ IONotificationPortRef x1c; // 1c
+ void* x20; // 20
+ IOHIDEventSystemCallback callback; // 24
+ IOHIDSessionRef session; // 28
+ pthread_mutex_t mutex; // 2c
+ CFRunLoopSourceRef migMachSource; // 58
+ CFMutableSetRef queues; // 5c
+ }
+#endif
+ * IOHIDEventSystemRef;
+
+ typedef void(*IOHIDEventSystemCallback)(void* target, void* refcon, IOHIDServiceRef service, IOHIDEventRef event);
+
+ CFTypeID IOHIDEventSystemGetTypeID(void);
+ IOHIDEventSystemRef IOHIDEventSystemCreate(CFAllocatorRef allocator);
+
+ CFArrayRef IOHIDEventSystemCopyMatchingServices(IOHIDEventSystemRef system, CFDictionaryRef propertyTable,
+ IOHIDNotificationCallback matchCallback, void* matchTarget, void* matchRefcon, IOHIDNotificationRef* matchNotif);
+ void IOHIDEventSystemRegisterQueue(IOHIDEventSystemRef system, IOHIDEventQueueRef queue);
+ void IOHIDEventSystemUnregisterQueue(IOHIDEventSystemRef system, IOHIDEventQueueRef queue);
+
+ IOHIDEventRef IOHIDEventSystemCopyEvent(IOHIDEventSystemRef system, IOHIDEventType type, IOHIDEventRef event, IOOptionBits options);
+
+ CFTypeRef IOHIDEventSystemGetProperty(IOHIDEventSystemRef system, CFStringRef property);
+ Boolean IOHIDEventSystemSetProperty(IOHIDEventSystemRef system, CFStringRef property, CFTypeRef value);
+
+ Boolean IOHIDEventSystemOpen(IOHIDEventSystemRef system, IOHIDEventSystemCallback callback, void* target, void* refcon, void* unused);
+ void IOHIDEventSystemClose(IOHIDEventSystemRef system, void* unused);
+
+#if 0
+ dlfun("IOHIDEventSystemGetTypeID", "I");
+ dlfun("IOHIDEventSystemCreate", "@@");
+ dlfun("IOHIDEventSystemCopyMatchingServices", "@@^v^v^v^@");
+ dlfun("IOHIDEventSystemRegisterQueue", "v@@");
+ dlfun("IOHIDEventSystemUnregisterQueue", "v@@");
+ dlfun("IOHIDEventSystemCopyEvent", "@@I@I");
+ dlfun("IOHIDEventSystemGetProperty", "@@@");
+ dlfun("IOHIDEventSystemSetProperty", "c@@@");
+ dlfun("IOHIDEventSystemOpen", "c@^v^v^v^v");
+ dlfun("IOHIDEventSystemClose", "v@^v");
+#endif
+
+#if __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/include/IOKit/hid/IOHIDEventSystemClient.h b/include/IOKit/hid/IOHIDEventSystemClient.h
new file mode 100644
index 0000000..76a0bac
--- /dev/null
+++ b/include/IOKit/hid/IOHIDEventSystemClient.h
@@ -0,0 +1,84 @@
+/*
+
+IOHIDEventSystemClient.h ... I/O Kit HID Event System Client
+
+Copyright (c) 2010 KennyTM~
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+* Neither the name of the KennyTM~ nor the names of its contributors may be
+ used to endorse or promote products derived from this software without
+ specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+// With reference to http://www.opensource.apple.com/source/IOHIDFamily/IOHIDFamily-258.1/IOHIDLib/IOHIDEventServiceClass.h
+
+#ifndef IOHID_EVENT_SYSTEM_CLIENT_H
+#define IOHID_EVENT_SYSTEM_CLIENT_H
+
+#include
+#include "IOHIDEventQueue.h"
+#include "IOHIDEvent.h"
+
+#if __cplusplus
+extern "C" {
+#endif
+
+ typedef struct __IOHIDEventSystemClient
+#if 0
+ {
+ void* x00;
+ CFMachPortRef serverPort; // 4
+ CFRunLoopSourceRef serverSource; // 8
+ IOHIDEventSystemClientEventCallback callback; // c
+ void* target; // 10
+ void* refcon; // 14
+ CFMachPortRef queuePort; // 18
+ CFRunLoopSourceRef queueSource; // 1c
+ CFRunLoopSourceRef source2; // 24
+ CFRunLoopTimerRef timer; // 28
+ IOHIDEventQueueRef queue; // 2c
+ CFRunLoopRef runloop; // 34
+ CFStringRef mode; // 38
+ }
+#endif
+ * IOHIDEventSystemClientRef;
+
+ typedef void(*IOHIDEventSystemClientEventCallback)(void* target, void* refcon, IOHIDEventQueueRef queue, IOHIDEventRef event);
+
+ void IOHIDEventSystemClientRegisterEventCallback(IOHIDEventSystemClientRef client, IOHIDEventSystemClientEventCallback callback, void* target, void* refcon);
+ void IOHIDEventSystemClientUnregisterEventCallback(IOHIDEventSystemClientRef client);
+
+ void IOHIDEventSystemClientUnscheduleWithRunLoop(IOHIDEventSystemClientRef client, CFRunLoopRef runloop, CFStringRef mode);
+ void IOHIDEventSystemClientScheduleWithRunLoop(IOHIDEventSystemClientRef client, CFRunLoopRef runloop, CFStringRef mode);
+
+ CFPropertyListRef IOHIDEventSystemClientCopyProperty(IOHIDEventSystemClientRef client, CFStringRef property);
+ Boolean IOHIDEventSystemClientSetProperty(IOHIDEventSystemClientRef client, CFStringRef property, CFPropertyListRef value);
+
+ IOHIDEventSystemClientRef IOHIDEventSystemClient(void);
+
+#if __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/include/IOKit/hid/IOHIDEventTypes.h b/include/IOKit/hid/IOHIDEventTypes.h
new file mode 100644
index 0000000..1795b0c
--- /dev/null
+++ b/include/IOKit/hid/IOHIDEventTypes.h
@@ -0,0 +1,894 @@
+/*
+ *
+ * @APPLE_LICENSE_HEADER_START@
+ *
+ * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
+ *
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * @APPLE_LICENSE_HEADER_END@
+ */
+
+#ifndef _IOKIT_HID_IOHIDEVENTTYPES_H
+#define _IOKIT_HID_IOHIDEVENTTYPES_H /* { */
+
+#include
+#include
+
+#if TARGET_OS_IPHONE
+ #ifndef IRONSIDE_AVAILABLE
+ #define IRONSIDE_AVAILABLE 1
+ #endif
+#else
+ #include
+#endif
+
+#define IOHIDEventTypeMask(type) (1LL<
+ Please Note:
+ If you append a child digitizer event to a parent digitizer event, appropriate state will be transfered on to the parent.
+ @constant kIOHIDDigitizerEventRange Issued when the range state has changed.
+ @constant kIOHIDDigitizerEventTouch Issued when the touch state has changed.
+ @constant kIOHIDDigitizerEventPosition Issued when the position has changed.
+ @constant kIOHIDDigitizerEventStop Issued when motion has achieved a state of calculated non-movement.
+ @constant kIOHIDDigitizerEventPeak Issues when new maximum values have been detected.
+ @constant kIOHIDDigitizerEventIdentity Issued when the identity has changed.
+ @constant kIOHIDDigitizerEventAttribute Issued when an attribute has changed.
+ @constant kIOHIDDigitizerEventCancel
+ @constant kIOHIDDigitizerEventResting
+ @constant kIOHIDDigitizerEventFromEdgeFlat Issued when a digitizer approaches from the edge with flattened presentation
+ @constant kIOHIDDigitizerEventFromEdgeTip Issued when a digitizer approaches from the edge with standard (i.e. un-flattened) presentation.
+ @constant kIOHIDDigitizerEventFromCorner Issued when a digitizer approaches from a corner
+ @constant kIOHIDDigitizerEventSwipePending Issued to indicate that an edge swipe is pending
+ @constant kIOHIDDigitizerEventFromEdgeForcePending Issued to indicate that edge press is pending
+ @constant kIOHIDDigitizerEventFromEdgeForceActive Issued to indicate that edge press is active
+ @constant kIOHIDDigitizerEventForcePopped Issued to indicate that a force pop was detected
+ @constant kIOHIDDigitizerEventUpSwipe Issued when an up swipe has been detected.
+ @constant kIOHIDDigitizerEventDownSwipe Issued when an down swipe has been detected.
+ @constant kIOHIDDigitizerEventLeftSwipe Issued when an left swipe has been detected.
+ @constant kIOHIDDigitizerEventRightSwipe Issued when an right swipe has been detected.
+ @constant kIOHIDDigitizerEventSwipeMask Mask used to gather swipe events.
+*/
+enum {
+ kIOHIDDigitizerEventRange = 1<<0,
+ kIOHIDDigitizerEventTouch = 1<<1,
+ kIOHIDDigitizerEventPosition = 1<<2,
+ kIOHIDDigitizerEventStop = 1<<3,
+ kIOHIDDigitizerEventPeak = 1<<4,
+ kIOHIDDigitizerEventIdentity = 1<<5,
+ kIOHIDDigitizerEventAttribute = 1<<6,
+ kIOHIDDigitizerEventCancel = 1<<7,
+ kIOHIDDigitizerEventStart = 1<<8,
+ kIOHIDDigitizerEventResting = 1<<9,
+ kIOHIDDigitizerEventFromEdgeFlat = 1<<10,
+ kIOHIDDigitizerEventFromEdgeTip = 1<<11,
+ kIOHIDDigitizerEventFromCorner = 1<<12,
+ kIOHIDDigitizerEventSwipePending = 1<<13,
+ kIOHIDDigitizerEventFromEdgeForcePending = 1<<14,
+ kIOHIDDigitizerEventFromEdgeForceActive = 1<<15,
+ kIOHIDDigitizerEventForcePopped = 1<<16,
+ kIOHIDDigitizerEventSwipeUp = 1<<24,
+ kIOHIDDigitizerEventSwipeDown = 1<<25,
+ kIOHIDDigitizerEventSwipeLeft = 1<<26,
+ kIOHIDDigitizerEventSwipeRight = 1<<27,
+ kIOHIDDigitizerEventSwipeMask = 0xFF<<24,
+};
+typedef uint32_t IOHIDDigitizerEventMask;
+
+/*!
+ @typedef IOHIDDigitizerEventUpdateMask
+ @abstract Bit mask detailing the fields that have or will change in a digitizer event
+*/
+enum {
+ kIOHIDDigitizerEventUpdateXMask = 1<
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+* Neither the name of the KennyTM~ nor the names of its contributors may be
+ used to endorse or promote products derived from this software without
+ specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+#ifndef IOHID_NOTIFICATION_H
+#define IOHID_NOTIFICATION_H
+
+#include
+
+#if __cplusplus
+extern "C" {
+#endif
+
+ typedef void(*IOHIDNotificationCallback)(void* target, void* refcon);
+
+ typedef struct __IOHIDNotification
+#if 0
+ {
+ CFRuntimeBase _base; // 0, 4
+ IOHIDNotificationCallback clientCallback; // 8
+ void* clientTarget; // c
+ void* clientRefcon; // 10
+ IOHIDNotificationCallback ownerCallback; // 14
+ void* ownerTarget; // 18
+ void* ownerRefcon; // 1c
+ }
+#endif
+ * IOHIDNotificationRef;
+
+#pragma mark -
+#pragma mark Creators
+
+ CFTypeID IOHIDNotificationGetTypeID();
+
+ IOHIDNotificationRef IOHIDNotificationCreate(CFAllocatorRef allocator,
+ IOHIDNotificationCallback ownerCallback, void* ownerTarget, void* ownerRefcon,
+ IOHIDNotificationCallback clientCallback, void* clientTarget, void* clientRefcon);
+
+#pragma mark -
+#pragma mark Accessors
+
+ IOHIDNotificationCallback IOHIDNotificationGetClientCallback(IOHIDNotificationRef notification);
+ void* IOHIDNotificationGetClientTarget(IOHIDNotificationRef notification);
+ void* IOHIDNotificationGetClientRefcon(IOHIDNotificationRef notification);
+ IOHIDNotificationCallback IOHIDNotificationGetOwnerCallback(IOHIDNotificationRef notification);
+ void* IOHIDNotificationGetOwnerTarget(IOHIDNotificationRef notification);
+ void* IOHIDNotificationGetOwnerRefcon(IOHIDNotificationRef notification);
+
+#if __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/include/IOKit/hid/IOHIDService.h b/include/IOKit/hid/IOHIDService.h
new file mode 100644
index 0000000..218943a
--- /dev/null
+++ b/include/IOKit/hid/IOHIDService.h
@@ -0,0 +1,122 @@
+/*
+
+IOHIDService.h ... I/O Kit HID Service
+
+Copyright (c) 2009 KennyTM~
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+* Neither the name of the KennyTM~ nor the names of its contributors may be
+ used to endorse or promote products derived from this software without
+ specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+// With reference to http://www.opensource.apple.com/source/IOHIDFamily/IOHIDFamily-258.1/IOHIDLib/IOHIDEventServiceClass.h
+
+#ifndef IOHID_SERVICE_H
+#define IOHID_SERVICE_H
+
+#include
+#include "IOKitLib.h"
+#include "IOHIDEvent.h"
+#include "IOHIDNotification.h"
+
+#if __cplusplus
+extern "C" {
+#endif
+
+ typedef struct __IOHIDService
+#if 0
+ {
+ CFRuntimeBase _base; // 0, 4
+ CFTypeRef client; // 8
+ io_service_t service; // c
+ void** pluginInterface1; // 10; GUID = D12C833F-B15B-11DA-902D-0014519758EF
+ void** pluginInterface2; // 14;
+ IOCFPlugInInterface** interface; // 18
+ CFRunLoopRef runloop; // 1c
+ CFStringRef mode; // 20
+ IONotificationPortRef notify; // 24
+ CFMutableSetRef removalNotifications; // 2c
+ void* eventTarget; // 30
+ void* eventRefcon; // 34
+ IOHIDServiceEventCallback eventCallback; // 38
+ uint32_t previousButtonMask; // 3c
+ }
+#endif
+ * IOHIDServiceRef;
+
+ typedef void(*IOHIDServiceEventCallback)(void* target, void* refcon, IOHIDServiceRef service, IOHIDEventRef event);
+
+ /*
+ metaObject->
+ [0] = NULL
+ [4] = IOHIDIUnknown::genericQueryInterface(void*, CFUUIDBytes, void**)
+ [8] = IOHIDIUnknown::genericAddRef(void*)
+ [0x0c] = IOHIDIUnknown::genericRelease(void*)
+ [0x10] = IOHIDEventServiceClass::_open(void*, unsigned long)
+ [0x14] = IOHIDEventServiceClass::_close(void*, unsigned long)
+ [0x18] = IOHIDEventServiceClass::_getProperty(void*, __CFString const*)
+ [0x1c] = IOHIDEventServiceClass::_setProperty(void*, __CFString const*, void const*)
+ [0x20] = IOHIDEventServiceClass::_setEventCallback(void*, void (*)(void*, void*, void*, __IOHIDEvent*, unsigned long), void*, void*)
+ [0x24] = IOHIDEventServiceClass::_scheduleWithRunLoop(void*, __CFRunLoop*, __CFString const*)
+ [0x28] = IOHIDEventServiceClass::_unscheduleFromRunLoop(void*, __CFRunLoop*, __CFString const*)
+ [0x2c] = IOHIDEventServiceClass::_copyEvent(void*, unsigned int, __IOHIDEvent*, unsigned long)
+ */
+
+#pragma mark -
+#pragma mark Creators
+
+ CFTypeID IOHIDServiceGetTypeID(void);
+ IOHIDServiceRef _IOHIDServiceCreate(CFAllocatorRef allocator, io_service_t service);
+
+#pragma mark -
+#pragma mark Accessors
+
+ CFTypeRef IOHIDServiceGetProperty(IOHIDServiceRef service, CFStringRef property);
+ Boolean IOHIDServiceSetProperty(IOHIDServiceRef service, CFStringRef property, CFTypeRef value);
+
+ CFTypeRef _IOHIDServiceGetClient(IOHIDServiceRef service);
+ Boolean _IOHIDServiceMatchPropertyTable(IOHIDServiceRef service, CFDictionaryRef propertyTable);
+
+ IOHIDEventRef IOHIDServiceCopyEvent(IOHIDServiceRef service, IOHIDEventType type, IOHIDEventRef event, IOOptionBits options);
+
+ void _IOHIDServiceSetEventCallback(IOHIDServiceRef service, IOHIDServiceEventCallback eventCallback, void* target, void* refcon);
+
+#pragma mark -
+#pragma mark Actions
+
+ void _IOHIDServiceScheduleWithRunLoop(IOHIDServiceRef service, CFRunLoopRef runloop, CFStringRef mode);
+ void _IOHIDServiceUnscheduleWithRunLoop(IOHIDServiceRef service);
+
+ IOHIDNotificationRef IOHIDServiceCreateRemovalNotification(IOHIDServiceRef display, IOHIDNotificationCallback callback, void* target, void* refcon);
+
+ Boolean _IOHIDServiceOpen(IOHIDServiceRef service, CFTypeRef client, IOOptionBits options);
+ Boolean _IOHIDServiceClose(IOHIDServiceRef service, CFTypeRef client, IOOptionBits options);
+
+
+#if __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/include/IOKit/hid/IOHIDSession.h b/include/IOKit/hid/IOHIDSession.h
new file mode 100644
index 0000000..441cf16
--- /dev/null
+++ b/include/IOKit/hid/IOHIDSession.h
@@ -0,0 +1,152 @@
+/*
+
+IOHIDSession.h ... I/O Kit HID Session
+
+Copyright (c) 2010 KennyTM~
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+* Neither the name of the KennyTM~ nor the names of its contributors may be
+ used to endorse or promote products derived from this software without
+ specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+#ifndef IOHID_NOTIFICATION_H
+#define IOHID_NOTIFICATION_H
+
+#include
+#include "IOHIDDisplay.h"
+#include "IOHIDService.h"
+#include "IOHIDEvent.h"
+
+#if __cplusplus
+extern "C" {
+#endif
+
+ typedef struct IOHIDSessionWorkSpace {
+ uint64_t value;
+ } IOHIDSessionWorkSpace;
+
+ typedef struct __IOHIDSession
+#if 0
+ {
+ CFRuntimeBase _base; // 0, 4
+ int isOpen; // 8
+ CFTypeRef client; // c
+ IOHIDSessionCallback callback; // 10
+ void* refcon; // 14
+ IOHIDSessionWorkSpace workSpace; // 18, 1c
+ CFRunLoopRef runloop; // 20
+ pthread_mutex_t lock; // 24
+ pthread_cond_t cond; // 50
+ pthread_mutexattr_t attr; // 6c
+ CFMutableSetRef services; // 78
+ CFMutableSetRef displays; // 7c
+ CFMutableSetRef ALSStates; // 80
+ CFMutableDictionaryRef properties; // 84
+ Boolean displayStatus; // 88, initially = true
+ float factor; // brightnessFactor. 8c, initially = 1
+ float deviceAmbient; // 94, initially = 0.5
+ float interval; // displayInternval. 98, initially = 0.402
+ float ALSIntPeriod; // 9c, initially = 5.5
+ float xa4; // a4, initially = 0
+ float xa8; // a8, initially = 5.5
+ float xac; // ac, initially = -1
+ float xb0; // b0, initially = 1
+ float backlight; // b4, initially = 1
+ CFTypeRef xe0; // e0
+ int displayOrientation; // e8, initially = 1
+ Boolean orientationEnabled; // ec, initially = false
+ Boolean ALSIntPeriodOrientationEnabled; // ed, initially = false
+ float ALSIntPeriodOrientationPortrait; // f0, initially = 5.5
+ float ALSIntPeriodOrientationPortraitInv; // f4, initially = 0
+ float ALSIntPeriodOrientationLandscape; // f8, initially = 0
+ int lockStateToken; // fc. (for the "com.apple.springboard.lockstate" Darwin notification)
+ uint64_t lockState; // 100, 104
+ mach_port_t lockStateNotifyPort; // 108 (leads to __IOHIDSessionLockCallback)
+ int bootedCleanlyToken; // 10c (for the "com.apple.springboard.bootedcleanly" Darwin notification)
+ mach_port_t bootedCleanlyNotifyPort; // 118 (leads to __IOHIDSessionBootCallback)
+ int displayStatusToken; // 11c (for the "com.apple.iokit.hid.displayStatus" Darwin notification)
+ int substantialTransitionToken; // 12c (for the "com.apple.mobile.SubstantialTransition" Darwin notification)
+ mach_port_t substantialTransitionNotifyPort; // 130 (leads to __IOHIDSessionTransitionCallback)
+ int thermalNotificationToken; // 134 (for the kOSThermalNotificationName Darwin notification)
+ mach_port_t thermalNotificationNotifyPort; // 138 (leads to __IOHIDSessionThermalCallback)
+ int thermalLevel; // 13c, initially = OSThermalNotificationCurrentLevel()
+ int logLevel; // 144, initially = 6
+ }
+#endif
+ * IOHIDSessionRef;
+
+ typedef void(*IOHIDSessionCallback)(CFTypeRef client, void* refcon, IOHIDServiceRef service, IOHIDEventRef event);
+
+#pragma mark -
+#pragma mark Creators
+
+ CFTypeID IOHIDSessionGetTypeID(void);
+ IOHIDSessionRef IOHIDSessionCreate(CFAllocatorRef allocator);
+
+#pragma mark -
+#pragma mark Accessors
+
+ CFTypeRef IOHIDSessionGetProperty(IOHIDSessionRef session, CFStringRef key);
+ Boolean IOHIDSessionSetProperty(IOHIDSessionRef session, CFStringRef key, CFTypeRef value);
+
+ IOHIDSessionWorkSpace IOHIDSessionGetWorkSpace(IOHIDSessionRef session);
+ void IOHIDSessionSetWorkSpace(IOHIDSessionRef session, IOHIDSessionWorkSpace workSpace);
+
+ Boolean IOHIDSessionGetLockState(IOHIDSessionRef session);
+ void IOHIDSessionSetLockState(IOHIDSessionRef session, Boolean lockState);
+
+#pragma mark -
+#pragma mark Actions
+
+ Boolean IOHIDSessionOpen(IOHIDSessionRef session, CFTypeRef client, IOHIDSessionCallback callback, void* refcon)
+ void IOHIDSessionClose(IOHIDSessionRef session, CFTypeRef client);
+
+ void IOHIDSessionAddService(IOHIDSessionRef, IOHIDServiceRef service);
+ void IOHIDSessionRemoveService(IOHIDSessionRef, IOHIDServiceRef service);
+
+ void IOHIDSessionAddDisplay(IOHIDSessionRef, IOHIDDisplayRef display);
+ void IOHIDSessionRemoveDisplay(IOHIDSessionRef session, IOHIDDisplayRef display);
+
+ IOHIDEventRef IOHIDSessionCopyEvent(IOHIDSessionRef session, IOHIDEventType type, IOHIDEventRef event, IOOptionBits options);
+
+#pragma mark -
+#pragma mark Constants
+
+ static const CFStringRef kIOHIDSessionPropertyDisplayOrientation = CFSTR("DisplayOrientation");
+ static const CFStringRef kIOHIDSessionPropertyDisplayBrightnessFactor = CFSTR("DisplayBrightnessFactor");
+ static const CFStringRef kIOHIDSessionPropertyDisplayBrightnessFactorWithFade = CFSTR("DisplayBrightnessFactorWithFade");
+ static const CFStringRef kIOHIDSessionPropertyDisplayBrightnessFactorPending = CFSTR("DisplayBrightnessFactorPending");
+ static const CFStringRef kIOHIDSessionPropertyLogLevel = CFSTR("LogLevel");
+ static const CFStringRef kIOHIDSessionPropertyALSIntPeriodOrientationEnabled = CFSTR("ALSIntPeriodOrientationEnabled");
+ static const CFStringRef kIOHIDSessionPropertyALSIntPeriod = CFSTR("ALSIntPeriod");
+ static const CFStringRef kIOHIDSessionPropertyALSIntPeriodOrientationPortrait = CFSTR("ALSIntPeriodOrientationPortrait");
+ static const CFStringRef kIOHIDSessionPropertyALSIntPeriodOrientationPortraitInv = CFSTR("ALSIntPeriodOrientationPortraitInv");
+ static const CFStringRef kIOHIDSessionPropertyALSIntPeriodOrientationLandscape = CFSTR("ALSIntPeriodOrientationLandscape");
+
+#if __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/include/IOKit/hid/IOHIDUsageTables.h b/include/IOKit/hid/IOHIDUsageTables.h
new file mode 100644
index 0000000..77db996
--- /dev/null
+++ b/include/IOKit/hid/IOHIDUsageTables.h
@@ -0,0 +1,2591 @@
+/*
+ * @APPLE_LICENSE_HEADER_START@
+ *
+ * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
+ *
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * @APPLE_LICENSE_HEADER_END@
+ */
+#ifndef _IOHIDUSAGETABLES_H
+#define _IOHIDUSAGETABLES_H
+
+/* ******************************************************************************************
+ * HID Usage Tables
+ *
+ * The following constants are from the USB 'HID Usage Tables' specification, revision 1.1rc3
+ * ****************************************************************************************** */
+
+
+/* Usage Pages */
+enum
+{
+ kHIDPage_Undefined = 0x00,
+ kHIDPage_GenericDesktop = 0x01,
+ kHIDPage_Simulation = 0x02,
+ kHIDPage_VR = 0x03,
+ kHIDPage_Sport = 0x04,
+ kHIDPage_Game = 0x05,
+ kHIDPage_GenericDeviceControls = 0x06,
+ kHIDPage_KeyboardOrKeypad = 0x07, /* USB Device Class Definition for Human Interface Devices (HID). Note: the usage type for all key codes is Selector (Sel). */
+ kHIDPage_LEDs = 0x08,
+ kHIDPage_Button = 0x09,
+ kHIDPage_Ordinal = 0x0A,
+ kHIDPage_Telephony = 0x0B,
+ kHIDPage_Consumer = 0x0C,
+ kHIDPage_Digitizer = 0x0D,
+ /* Reserved 0x0E */
+ kHIDPage_PID = 0x0F, /* USB Physical Interface Device definitions for force feedback and related devices. */
+ kHIDPage_Unicode = 0x10,
+ /* Reserved 0x11 - 0x13 */
+ kHIDPage_AlphanumericDisplay = 0x14,
+ /* Reserved 0x15 - 0x1F */
+ kHIDPage_Sensor = 0x20,
+ /* Reserved 0x21 - 0x7f */
+ kHIDPage_Monitor = 0x80,
+ kHIDPage_MonitorEnumerated = 0x81,
+ kHIDPage_MonitorVirtual = 0x82,
+ kHIDPage_MonitorReserved = 0x83,
+ /* Power 0x84 - 0x87 USB Device Class Definition for Power Devices */
+ kHIDPage_PowerDevice = 0x84, /* Power Device Page */
+ kHIDPage_BatterySystem = 0x85, /* Battery System Page */
+ kHIDPage_PowerReserved = 0x86,
+ kHIDPage_PowerReserved2 = 0x87,
+ /* Reserved 0x88 - 0x8B */
+ kHIDPage_BarCodeScanner = 0x8C, /* (Point of Sale) USB Device Class Definition for Bar Code Scanner Devices */
+ kHIDPage_WeighingDevice = 0x8D, /* (Point of Sale) USB Device Class Definition for Weighing Devices */
+ kHIDPage_Scale = 0x8D, /* (Point of Sale) USB Device Class Definition for Scale Devices */
+ kHIDPage_MagneticStripeReader = 0x8E,
+ /* ReservedPointofSalepages 0x8F */
+ kHIDPage_CameraControl = 0x90, /* USB Device Class Definition for Image Class Devices */
+ kHIDPage_Arcade = 0x91, /* OAAF Definitions for arcade and coinop related Devices */
+ /* Reserved 0x92 - 0xFEFF */
+ /* VendorDefined 0xFF00 - 0xFFFF */
+ kHIDPage_VendorDefinedStart = 0xFF00
+};
+
+/* Undefined Usage for all usage pages */
+enum
+{
+ kHIDUsage_Undefined = 0x00
+};
+
+/* GenericDesktop Page (0x01) */
+enum
+{
+ kHIDUsage_GD_Pointer = 0x01, /* Physical Collection */
+ kHIDUsage_GD_Mouse = 0x02, /* Application Collection */
+ /* 0x03 Reserved */
+ kHIDUsage_GD_Joystick = 0x04, /* Application Collection */
+ kHIDUsage_GD_GamePad = 0x05, /* Application Collection */
+ kHIDUsage_GD_Keyboard = 0x06, /* Application Collection */
+ kHIDUsage_GD_Keypad = 0x07, /* Application Collection */
+ kHIDUsage_GD_MultiAxisController = 0x08, /* Application Collection */
+ kHIDUsage_GD_TabletPCSystemControls = 0x09, /* Application Collection */
+ kHIDUsage_GD_AssistiveControl = 0x0A, /* Application Collection */
+ kHIDUsage_GD_SpatialController = 0x0F, /* Application Collection */
+ kHIDUsage_GD_AssistiveControlCompatible = 0x10, /* Application Collection */
+ /* 0x0B - 0x2F Reserved */
+ kHIDUsage_GD_X = 0x30, /* Dynamic Value */
+ kHIDUsage_GD_Y = 0x31, /* Dynamic Value */
+ kHIDUsage_GD_Z = 0x32, /* Dynamic Value */
+ kHIDUsage_GD_Rx = 0x33, /* Dynamic Value */
+ kHIDUsage_GD_Ry = 0x34, /* Dynamic Value */
+ kHIDUsage_GD_Rz = 0x35, /* Dynamic Value */
+ kHIDUsage_GD_Slider = 0x36, /* Dynamic Value */
+ kHIDUsage_GD_Dial = 0x37, /* Dynamic Value */
+ kHIDUsage_GD_Wheel = 0x38, /* Dynamic Value */
+ kHIDUsage_GD_Hatswitch = 0x39, /* Dynamic Value */
+ kHIDUsage_GD_CountedBuffer = 0x3A, /* Logical Collection */
+ kHIDUsage_GD_ByteCount = 0x3B, /* Dynamic Value */
+ kHIDUsage_GD_MotionWakeup = 0x3C, /* One-Shot Control */
+ kHIDUsage_GD_Start = 0x3D, /* On/Off Control */
+ kHIDUsage_GD_Select = 0x3E, /* On/Off Control */
+ /* 0x3F Reserved */
+ kHIDUsage_GD_Vx = 0x40, /* Dynamic Value */
+ kHIDUsage_GD_Vy = 0x41, /* Dynamic Value */
+ kHIDUsage_GD_Vz = 0x42, /* Dynamic Value */
+ kHIDUsage_GD_Vbrx = 0x43, /* Dynamic Value */
+ kHIDUsage_GD_Vbry = 0x44, /* Dynamic Value */
+ kHIDUsage_GD_Vbrz = 0x45, /* Dynamic Value */
+ kHIDUsage_GD_Vno = 0x46, /* Dynamic Value */
+ /* 0x47 - 0x7F Reserved */
+ kHIDUsage_GD_SystemControl = 0x80, /* Application Collection */
+ kHIDUsage_GD_SystemPowerDown = 0x81, /* One-Shot Control */
+ kHIDUsage_GD_SystemSleep = 0x82, /* One-Shot Control */
+ kHIDUsage_GD_SystemWakeUp = 0x83, /* One-Shot Control */
+ kHIDUsage_GD_SystemContextMenu = 0x84, /* One-Shot Control */
+ kHIDUsage_GD_SystemMainMenu = 0x85, /* One-Shot Control */
+ kHIDUsage_GD_SystemAppMenu = 0x86, /* One-Shot Control */
+ kHIDUsage_GD_SystemMenuHelp = 0x87, /* One-Shot Control */
+ kHIDUsage_GD_SystemMenuExit = 0x88, /* One-Shot Control */
+ kHIDUsage_GD_SystemMenuSelect = 0x89, /* Selector */
+ kHIDUsage_GD_SystemMenu = kHIDUsage_GD_SystemMenuSelect, /* Selector */
+ kHIDUsage_GD_SystemMenuRight = 0x8A, /* Re-Trigger Control */
+ kHIDUsage_GD_SystemMenuLeft = 0x8B, /* Re-Trigger Control */
+ kHIDUsage_GD_SystemMenuUp = 0x8C, /* Re-Trigger Control */
+ kHIDUsage_GD_SystemMenuDown = 0x8D, /* Re-Trigger Control */
+ /* 0x8E - 0x8F Reserved */
+ kHIDUsage_GD_DPadUp = 0x90, /* On/Off Control */
+ kHIDUsage_GD_DPadDown = 0x91, /* On/Off Control */
+ kHIDUsage_GD_DPadRight = 0x92, /* On/Off Control */
+ kHIDUsage_GD_DPadLeft = 0x93, /* On/Off Control */
+ kHIDUsage_GD_IndexTrigger = 0x94, /* On/Off Control */
+ kHIDUsage_GD_PalmTrigger = 0x95, /* On/Off Control */
+ kHIDUsage_GD_Thumbstick = 0x96, /* On/Off Control */
+ /* 0x94 - 0xFFFF Reserved */
+ kHIDUsage_GD_Reserved = 0xFFFF
+};
+
+/* Simulation Page (0x02) */
+/* This section provides detailed descriptions of the usages employed by simulation devices. */
+enum
+{
+ kHIDUsage_Sim_FlightSimulationDevice = 0x01, /* Application Collection */
+ kHIDUsage_Sim_AutomobileSimulationDevice = 0x02, /* Application Collection */
+ kHIDUsage_Sim_TankSimulationDevice = 0x03, /* Application Collection */
+ kHIDUsage_Sim_SpaceshipSimulationDevice = 0x04, /* Application Collection */
+ kHIDUsage_Sim_SubmarineSimulationDevice = 0x05, /* Application Collection */
+ kHIDUsage_Sim_SailingSimulationDevice = 0x06, /* Application Collection */
+ kHIDUsage_Sim_MotorcycleSimulationDevice = 0x07, /* Application Collection */
+ kHIDUsage_Sim_SportsSimulationDevice = 0x08, /* Application Collection */
+ kHIDUsage_Sim_AirplaneSimulationDevice = 0x09, /* Application Collection */
+ kHIDUsage_Sim_HelicopterSimulationDevice = 0x0A, /* Application Collection */
+ kHIDUsage_Sim_MagicCarpetSimulationDevice = 0x0B, /* Application Collection */
+ kHIDUsage_Sim_BicycleSimulationDevice = 0x0C, /* Application Collection */
+ /* 0x0D - 0x1F Reserved */
+ kHIDUsage_Sim_FlightControlStick = 0x20, /* Application Collection */
+ kHIDUsage_Sim_FlightStick = 0x21, /* Application Collection */
+ kHIDUsage_Sim_CyclicControl = 0x22, /* Physical Collection */
+ kHIDUsage_Sim_CyclicTrim = 0x23, /* Physical Collection */
+ kHIDUsage_Sim_FlightYoke = 0x24, /* Application Collection */
+ kHIDUsage_Sim_TrackControl = 0x25, /* Physical Collection */
+ /* 0x26 - 0xAF Reserved */
+ kHIDUsage_Sim_Aileron = 0xB0, /* Dynamic Value */
+ kHIDUsage_Sim_AileronTrim = 0xB1, /* Dynamic Value */
+ kHIDUsage_Sim_AntiTorqueControl = 0xB2, /* Dynamic Value */
+ kHIDUsage_Sim_AutopilotEnable = 0xB3, /* On/Off Control */
+ kHIDUsage_Sim_ChaffRelease = 0xB4, /* One-Shot Control */
+ kHIDUsage_Sim_CollectiveControl = 0xB5, /* Dynamic Value */
+ kHIDUsage_Sim_DiveBrake = 0xB6, /* Dynamic Value */
+ kHIDUsage_Sim_ElectronicCountermeasures = 0xB7, /* On/Off Control */
+ kHIDUsage_Sim_Elevator = 0xB8, /* Dynamic Value */
+ kHIDUsage_Sim_ElevatorTrim = 0xB9, /* Dynamic Value */
+ kHIDUsage_Sim_Rudder = 0xBA, /* Dynamic Value */
+ kHIDUsage_Sim_Throttle = 0xBB, /* Dynamic Value */
+ kHIDUsage_Sim_FlightCommunications = 0xBC, /* On/Off Control */
+ kHIDUsage_Sim_FlareRelease = 0xBD, /* One-Shot Control */
+ kHIDUsage_Sim_LandingGear = 0xBE, /* On/Off Control */
+ kHIDUsage_Sim_ToeBrake = 0xBF, /* Dynamic Value */
+ kHIDUsage_Sim_Trigger = 0xC0, /* Momentary Control */
+ kHIDUsage_Sim_WeaponsArm = 0xC1, /* On/Off Control */
+ kHIDUsage_Sim_Weapons = 0xC2, /* Selector */
+ kHIDUsage_Sim_WingFlaps = 0xC3, /* Dynamic Value */
+ kHIDUsage_Sim_Accelerator = 0xC4, /* Dynamic Value */
+ kHIDUsage_Sim_Brake = 0xC5, /* Dynamic Value */
+ kHIDUsage_Sim_Clutch = 0xC6, /* Dynamic Value */
+ kHIDUsage_Sim_Shifter = 0xC7, /* Dynamic Value */
+ kHIDUsage_Sim_Steering = 0xC8, /* Dynamic Value */
+ kHIDUsage_Sim_TurretDirection = 0xC9, /* Dynamic Value */
+ kHIDUsage_Sim_BarrelElevation = 0xCA, /* Dynamic Value */
+ kHIDUsage_Sim_DivePlane = 0xCB, /* Dynamic Value */
+ kHIDUsage_Sim_Ballast = 0xCC, /* Dynamic Value */
+ kHIDUsage_Sim_BicycleCrank = 0xCD, /* Dynamic Value */
+ kHIDUsage_Sim_HandleBars = 0xCE, /* Dynamic Value */
+ kHIDUsage_Sim_FrontBrake = 0xCF, /* Dynamic Value */
+ kHIDUsage_Sim_RearBrake = 0xD0, /* Dynamic Value */
+ /* 0xD1 - 0xFFFF Reserved */
+ kHIDUsage_Sim_Reserved = 0xFFFF
+};
+
+/* VR Page (0x03) */
+/* Virtual Reality controls depend on designators to identify the individual controls. Most of the following are */
+/* usages are applied to the collections of entities that comprise the actual device. */
+enum
+{
+ kHIDUsage_VR_Belt = 0x01, /* Application Collection */
+ kHIDUsage_VR_BodySuit = 0x02, /* Application Collection */
+ kHIDUsage_VR_Flexor = 0x03, /* Physical Collection */
+ kHIDUsage_VR_Glove = 0x04, /* Application Collection */
+ kHIDUsage_VR_HeadTracker = 0x05, /* Physical Collection */
+ kHIDUsage_VR_HeadMountedDisplay = 0x06, /* Application Collection */
+ kHIDUsage_VR_HandTracker = 0x07, /* Application Collection */
+ kHIDUsage_VR_Oculometer = 0x08, /* Application Collection */
+ kHIDUsage_VR_Vest = 0x09, /* Application Collection */
+ kHIDUsage_VR_AnimatronicDevice = 0x0A, /* Application Collection */
+ /* 0x0B - 0x1F Reserved */
+ kHIDUsage_VR_StereoEnable = 0x20, /* On/Off Control */
+ kHIDUsage_VR_DisplayEnable = 0x21, /* On/Off Control */
+ /* 0x22 - 0xFFFF Reserved */
+ kHIDUsage_VR_Reserved = 0xFFFF
+};
+
+/* Sport Page (0x04) */
+enum
+{
+ kHIDUsage_Sprt_BaseballBat = 0x01, /* Application Collection */
+ kHIDUsage_Sprt_GolfClub = 0x02, /* Application Collection */
+ kHIDUsage_Sprt_RowingMachine = 0x03, /* Application Collection */
+ kHIDUsage_Sprt_Treadmill = 0x04, /* Application Collection */
+ /* 0x05 - 0x2F Reserved */
+ kHIDUsage_Sprt_Oar = 0x30, /* Dynamic Value */
+ kHIDUsage_Sprt_Slope = 0x31, /* Dynamic Value */
+ kHIDUsage_Sprt_Rate = 0x32, /* Dynamic Value */
+ kHIDUsage_Sprt_StickSpeed = 0x33, /* Dynamic Value */
+ kHIDUsage_Sprt_StickFaceAngle = 0x34, /* Dynamic Value */
+ kHIDUsage_Sprt_StickHeelOrToe = 0x35, /* Dynamic Value */
+ kHIDUsage_Sprt_StickFollowThrough = 0x36, /* Dynamic Value */
+ kHIDUsage_Sprt_StickTempo = 0x37, /* Dynamic Value */
+ kHIDUsage_Sprt_StickType = 0x38, /* Named Array */
+ kHIDUsage_Sprt_StickHeight = 0x39, /* Dynamic Value */
+ /* 0x3A - 0x4F Reserved */
+ kHIDUsage_Sprt_Putter = 0x50, /* Selector */
+ kHIDUsage_Sprt_1Iron = 0x51, /* Selector */
+ kHIDUsage_Sprt_2Iron = 0x52, /* Selector */
+ kHIDUsage_Sprt_3Iron = 0x53, /* Selector */
+ kHIDUsage_Sprt_4Iron = 0x54, /* Selector */
+ kHIDUsage_Sprt_5Iron = 0x55, /* Selector */
+ kHIDUsage_Sprt_6Iron = 0x56, /* Selector */
+ kHIDUsage_Sprt_7Iron = 0x57, /* Selector */
+ kHIDUsage_Sprt_8Iron = 0x58, /* Selector */
+ kHIDUsage_Sprt_9Iron = 0x59, /* Selector */
+ kHIDUsage_Sprt_10Iron = 0x5A, /* Selector */
+ kHIDUsage_Sprt_11Iron = 0x5B, /* Selector */
+ kHIDUsage_Sprt_SandWedge = 0x5C, /* Selector */
+ kHIDUsage_Sprt_LoftWedge = 0x5D, /* Selector */
+ kHIDUsage_Sprt_PowerWedge = 0x5E, /* Selector */
+ kHIDUsage_Sprt_1Wood = 0x5F, /* Selector */
+ kHIDUsage_Sprt_3Wood = 0x60, /* Selector */
+ kHIDUsage_Sprt_5Wood = 0x61, /* Selector */
+ kHIDUsage_Sprt_7Wood = 0x62, /* Selector */
+ kHIDUsage_Sprt_9Wood = 0x63, /* Selector */
+ /* 0x64 - 0xFFFF Reserved */
+ kHIDUsage_Sprt_Reserved = 0xFFFF
+};
+
+/* Game Page (0x05) */
+enum
+{
+ kHIDUsage_Game_3DGameController = 0x01, /* Application Collection */
+ kHIDUsage_Game_PinballDevice = 0x02, /* Application Collection */
+ kHIDUsage_Game_GunDevice = 0x03, /* Application Collection */
+ /* 0x04 - 0x1F Reserved */
+ kHIDUsage_Game_PointofView = 0x20, /* Physical Collection */
+ kHIDUsage_Game_TurnRightOrLeft = 0x21, /* Dynamic Value */
+ kHIDUsage_Game_PitchUpOrDown = 0x22, /* Dynamic Value */
+ kHIDUsage_Game_RollRightOrLeft = 0x23, /* Dynamic Value */
+ kHIDUsage_Game_MoveRightOrLeft = 0x24, /* Dynamic Value */
+ kHIDUsage_Game_MoveForwardOrBackward = 0x25, /* Dynamic Value */
+ kHIDUsage_Game_MoveUpOrDown = 0x26, /* Dynamic Value */
+ kHIDUsage_Game_LeanRightOrLeft = 0x27, /* Dynamic Value */
+ kHIDUsage_Game_LeanForwardOrBackward = 0x28, /* Dynamic Value */
+ kHIDUsage_Game_HeightOfPOV = 0x29, /* Dynamic Value */
+ kHIDUsage_Game_Flipper = 0x2A, /* Momentary Control */
+ kHIDUsage_Game_SecondaryFlipper = 0x2B, /* Momentary Control */
+ kHIDUsage_Game_Bump = 0x2C, /* Momentary Control */
+ kHIDUsage_Game_NewGame = 0x2D, /* One-Shot Control */
+ kHIDUsage_Game_ShootBall = 0x2E, /* One-Shot Control */
+ kHIDUsage_Game_Player = 0x2F, /* One-Shot Control */
+ kHIDUsage_Game_GunBolt = 0x30, /* On/Off Control */
+ kHIDUsage_Game_GunClip = 0x31, /* On/Off Control */
+ kHIDUsage_Game_Gun = 0x32, /* Selector */
+ kHIDUsage_Game_GunSingleShot = 0x33, /* Selector */
+ kHIDUsage_Game_GunBurst = 0x34, /* Selector */
+ kHIDUsage_Game_GunAutomatic = 0x35, /* Selector */
+ kHIDUsage_Game_GunSafety = 0x36, /* On/Off Control */
+ kHIDUsage_Game_GamepadFireOrJump = 0x37, /* Logical Collection */
+ kHIDUsage_Game_GamepadTrigger = 0x39, /* Logical Collection */
+ kHIDUsage_Game_GamepadFormFitting_Compatibility = 0x39, /* Static Flag */
+ kHIDUsage_Game_GamepadFormFitting = 0x3A, /* Static Flag */
+ /* 0x3A - 0xFFFF Reserved */
+ kHIDUsage_Game_Reserved = 0xFFFF
+};
+
+/* Generic Device Controls (0x0g) */
+enum
+{
+ kHIDUsage_GenDevControls_BackgroundControls = 0x01, /* Application Collection */
+};
+
+/* KeyboardOrKeypad Page (0x07) */
+/* This section is the Usage Page for key codes to be used in implementing a USB keyboard. A Boot Keyboard (84-, 101- or 104-key) should at a minimum support all associated usage codes as indicated in the ÒBootÓ */
+/* column below. */
+/* The usage type of all key codes is Selectors (Sel), except for the modifier keys Keyboard Left Control (0x224) to Keyboard Right GUI (0x231) which are Dynamic Flags (DV). */
+/* Note: A general note on Usages and languages: Due to the variation of keyboards from language to language, it is not feasible to specify exact key mappings for every language. Where this list is not specific for a key function in a language, the closest equivalent key position should be used, so that a keyboard may be modified for a different language by simply printing different keycaps. One example is the Y key on a North American keyboard. In Germany this is typically Z. Rather than changing the keyboard firmware to put the Z Usage into that place in the descriptor list, the vendor should use the Y Usage on both the North American and German keyboards. This continues to be the existing practice in the industry, in order to minimize the number of changes to the electronics to accommodate otherlanguages. */
+enum
+{
+ kHIDUsage_KeyboardErrorRollOver = 0x01, /* ErrorRollOver */
+ kHIDUsage_KeyboardPOSTFail = 0x02, /* POSTFail */
+ kHIDUsage_KeyboardErrorUndefined = 0x03, /* ErrorUndefined */
+ kHIDUsage_KeyboardA = 0x04, /* a or A */
+ kHIDUsage_KeyboardB = 0x05, /* b or B */
+ kHIDUsage_KeyboardC = 0x06, /* c or C */
+ kHIDUsage_KeyboardD = 0x07, /* d or D */
+ kHIDUsage_KeyboardE = 0x08, /* e or E */
+ kHIDUsage_KeyboardF = 0x09, /* f or F */
+ kHIDUsage_KeyboardG = 0x0A, /* g or G */
+ kHIDUsage_KeyboardH = 0x0B, /* h or H */
+ kHIDUsage_KeyboardI = 0x0C, /* i or I */
+ kHIDUsage_KeyboardJ = 0x0D, /* j or J */
+ kHIDUsage_KeyboardK = 0x0E, /* k or K */
+ kHIDUsage_KeyboardL = 0x0F, /* l or L */
+ kHIDUsage_KeyboardM = 0x10, /* m or M */
+ kHIDUsage_KeyboardN = 0x11, /* n or N */
+ kHIDUsage_KeyboardO = 0x12, /* o or O */
+ kHIDUsage_KeyboardP = 0x13, /* p or P */
+ kHIDUsage_KeyboardQ = 0x14, /* q or Q */
+ kHIDUsage_KeyboardR = 0x15, /* r or R */
+ kHIDUsage_KeyboardS = 0x16, /* s or S */
+ kHIDUsage_KeyboardT = 0x17, /* t or T */
+ kHIDUsage_KeyboardU = 0x18, /* u or U */
+ kHIDUsage_KeyboardV = 0x19, /* v or V */
+ kHIDUsage_KeyboardW = 0x1A, /* w or W */
+ kHIDUsage_KeyboardX = 0x1B, /* x or X */
+ kHIDUsage_KeyboardY = 0x1C, /* y or Y */
+ kHIDUsage_KeyboardZ = 0x1D, /* z or Z */
+ kHIDUsage_Keyboard1 = 0x1E, /* 1 or ! */
+ kHIDUsage_Keyboard2 = 0x1F, /* 2 or @ */
+ kHIDUsage_Keyboard3 = 0x20, /* 3 or # */
+ kHIDUsage_Keyboard4 = 0x21, /* 4 or $ */
+ kHIDUsage_Keyboard5 = 0x22, /* 5 or % */
+ kHIDUsage_Keyboard6 = 0x23, /* 6 or ^ */
+ kHIDUsage_Keyboard7 = 0x24, /* 7 or & */
+ kHIDUsage_Keyboard8 = 0x25, /* 8 or * */
+ kHIDUsage_Keyboard9 = 0x26, /* 9 or ( */
+ kHIDUsage_Keyboard0 = 0x27, /* 0 or ) */
+ kHIDUsage_KeyboardReturnOrEnter = 0x28, /* Return (Enter) */
+ kHIDUsage_KeyboardEscape = 0x29, /* Escape */
+ kHIDUsage_KeyboardDeleteOrBackspace = 0x2A, /* Delete (Backspace) */
+ kHIDUsage_KeyboardTab = 0x2B, /* Tab */
+ kHIDUsage_KeyboardSpacebar = 0x2C, /* Spacebar */
+ kHIDUsage_KeyboardHyphen = 0x2D, /* - or _ */
+ kHIDUsage_KeyboardEqualSign = 0x2E, /* = or + */
+ kHIDUsage_KeyboardOpenBracket = 0x2F, /* [ or { */
+ kHIDUsage_KeyboardCloseBracket = 0x30, /* ] or } */
+ kHIDUsage_KeyboardBackslash = 0x31, /* \ or | */
+ kHIDUsage_KeyboardNonUSPound = 0x32, /* Non-US # or _ */
+ kHIDUsage_KeyboardSemicolon = 0x33, /* ; or : */
+ kHIDUsage_KeyboardQuote = 0x34, /* ' or " */
+ kHIDUsage_KeyboardGraveAccentAndTilde = 0x35, /* Grave Accent and Tilde */
+ kHIDUsage_KeyboardComma = 0x36, /* , or < */
+ kHIDUsage_KeyboardPeriod = 0x37, /* . or > */
+ kHIDUsage_KeyboardSlash = 0x38, /* / or ? */
+ kHIDUsage_KeyboardCapsLock = 0x39, /* Caps Lock */
+ kHIDUsage_KeyboardF1 = 0x3A, /* F1 */
+ kHIDUsage_KeyboardF2 = 0x3B, /* F2 */
+ kHIDUsage_KeyboardF3 = 0x3C, /* F3 */
+ kHIDUsage_KeyboardF4 = 0x3D, /* F4 */
+ kHIDUsage_KeyboardF5 = 0x3E, /* F5 */
+ kHIDUsage_KeyboardF6 = 0x3F, /* F6 */
+ kHIDUsage_KeyboardF7 = 0x40, /* F7 */
+ kHIDUsage_KeyboardF8 = 0x41, /* F8 */
+ kHIDUsage_KeyboardF9 = 0x42, /* F9 */
+ kHIDUsage_KeyboardF10 = 0x43, /* F10 */
+ kHIDUsage_KeyboardF11 = 0x44, /* F11 */
+ kHIDUsage_KeyboardF12 = 0x45, /* F12 */
+ kHIDUsage_KeyboardPrintScreen = 0x46, /* Print Screen */
+ kHIDUsage_KeyboardScrollLock = 0x47, /* Scroll Lock */
+ kHIDUsage_KeyboardPause = 0x48, /* Pause */
+ kHIDUsage_KeyboardInsert = 0x49, /* Insert */
+ kHIDUsage_KeyboardHome = 0x4A, /* Home */
+ kHIDUsage_KeyboardPageUp = 0x4B, /* Page Up */
+ kHIDUsage_KeyboardDeleteForward = 0x4C, /* Delete Forward */
+ kHIDUsage_KeyboardEnd = 0x4D, /* End */
+ kHIDUsage_KeyboardPageDown = 0x4E, /* Page Down */
+ kHIDUsage_KeyboardRightArrow = 0x4F, /* Right Arrow */
+ kHIDUsage_KeyboardLeftArrow = 0x50, /* Left Arrow */
+ kHIDUsage_KeyboardDownArrow = 0x51, /* Down Arrow */
+ kHIDUsage_KeyboardUpArrow = 0x52, /* Up Arrow */
+ kHIDUsage_KeypadNumLock = 0x53, /* Keypad NumLock or Clear */
+ kHIDUsage_KeypadSlash = 0x54, /* Keypad / */
+ kHIDUsage_KeypadAsterisk = 0x55, /* Keypad * */
+ kHIDUsage_KeypadHyphen = 0x56, /* Keypad - */
+ kHIDUsage_KeypadPlus = 0x57, /* Keypad + */
+ kHIDUsage_KeypadEnter = 0x58, /* Keypad Enter */
+ kHIDUsage_Keypad1 = 0x59, /* Keypad 1 or End */
+ kHIDUsage_Keypad2 = 0x5A, /* Keypad 2 or Down Arrow */
+ kHIDUsage_Keypad3 = 0x5B, /* Keypad 3 or Page Down */
+ kHIDUsage_Keypad4 = 0x5C, /* Keypad 4 or Left Arrow */
+ kHIDUsage_Keypad5 = 0x5D, /* Keypad 5 */
+ kHIDUsage_Keypad6 = 0x5E, /* Keypad 6 or Right Arrow */
+ kHIDUsage_Keypad7 = 0x5F, /* Keypad 7 or Home */
+ kHIDUsage_Keypad8 = 0x60, /* Keypad 8 or Up Arrow */
+ kHIDUsage_Keypad9 = 0x61, /* Keypad 9 or Page Up */
+ kHIDUsage_Keypad0 = 0x62, /* Keypad 0 or Insert */
+ kHIDUsage_KeypadPeriod = 0x63, /* Keypad . or Delete */
+ kHIDUsage_KeyboardNonUSBackslash = 0x64, /* Non-US \ or | */
+ kHIDUsage_KeyboardApplication = 0x65, /* Application */
+ kHIDUsage_KeyboardPower = 0x66, /* Power */
+ kHIDUsage_KeypadEqualSign = 0x67, /* Keypad = */
+ kHIDUsage_KeyboardF13 = 0x68, /* F13 */
+ kHIDUsage_KeyboardF14 = 0x69, /* F14 */
+ kHIDUsage_KeyboardF15 = 0x6A, /* F15 */
+ kHIDUsage_KeyboardF16 = 0x6B, /* F16 */
+ kHIDUsage_KeyboardF17 = 0x6C, /* F17 */
+ kHIDUsage_KeyboardF18 = 0x6D, /* F18 */
+ kHIDUsage_KeyboardF19 = 0x6E, /* F19 */
+ kHIDUsage_KeyboardF20 = 0x6F, /* F20 */
+ kHIDUsage_KeyboardF21 = 0x70, /* F21 */
+ kHIDUsage_KeyboardF22 = 0x71, /* F22 */
+ kHIDUsage_KeyboardF23 = 0x72, /* F23 */
+ kHIDUsage_KeyboardF24 = 0x73, /* F24 */
+ kHIDUsage_KeyboardExecute = 0x74, /* Execute */
+ kHIDUsage_KeyboardHelp = 0x75, /* Help */
+ kHIDUsage_KeyboardMenu = 0x76, /* Menu */
+ kHIDUsage_KeyboardSelect = 0x77, /* Select */
+ kHIDUsage_KeyboardStop = 0x78, /* Stop */
+ kHIDUsage_KeyboardAgain = 0x79, /* Again */
+ kHIDUsage_KeyboardUndo = 0x7A, /* Undo */
+ kHIDUsage_KeyboardCut = 0x7B, /* Cut */
+ kHIDUsage_KeyboardCopy = 0x7C, /* Copy */
+ kHIDUsage_KeyboardPaste = 0x7D, /* Paste */
+ kHIDUsage_KeyboardFind = 0x7E, /* Find */
+ kHIDUsage_KeyboardMute = 0x7F, /* Mute */
+ kHIDUsage_KeyboardVolumeUp = 0x80, /* Volume Up */
+ kHIDUsage_KeyboardVolumeDown = 0x81, /* Volume Down */
+ kHIDUsage_KeyboardLockingCapsLock = 0x82, /* Locking Caps Lock */
+ kHIDUsage_KeyboardLockingNumLock = 0x83, /* Locking Num Lock */
+ kHIDUsage_KeyboardLockingScrollLock = 0x84, /* Locking Scroll Lock */
+ kHIDUsage_KeypadComma = 0x85, /* Keypad Comma */
+ kHIDUsage_KeypadEqualSignAS400 = 0x86, /* Keypad Equal Sign for AS/400 */
+ kHIDUsage_KeyboardInternational1 = 0x87, /* International1 */
+ kHIDUsage_KeyboardInternational2 = 0x88, /* International2 */
+ kHIDUsage_KeyboardInternational3 = 0x89, /* International3 */
+ kHIDUsage_KeyboardInternational4 = 0x8A, /* International4 */
+ kHIDUsage_KeyboardInternational5 = 0x8B, /* International5 */
+ kHIDUsage_KeyboardInternational6 = 0x8C, /* International6 */
+ kHIDUsage_KeyboardInternational7 = 0x8D, /* International7 */
+ kHIDUsage_KeyboardInternational8 = 0x8E, /* International8 */
+ kHIDUsage_KeyboardInternational9 = 0x8F, /* International9 */
+ kHIDUsage_KeyboardLANG1 = 0x90, /* LANG1 */
+ kHIDUsage_KeyboardLANG2 = 0x91, /* LANG2 */
+ kHIDUsage_KeyboardLANG3 = 0x92, /* LANG3 */
+ kHIDUsage_KeyboardLANG4 = 0x93, /* LANG4 */
+ kHIDUsage_KeyboardLANG5 = 0x94, /* LANG5 */
+ kHIDUsage_KeyboardLANG6 = 0x95, /* LANG6 */
+ kHIDUsage_KeyboardLANG7 = 0x96, /* LANG7 */
+ kHIDUsage_KeyboardLANG8 = 0x97, /* LANG8 */
+ kHIDUsage_KeyboardLANG9 = 0x98, /* LANG9 */
+ kHIDUsage_KeyboardAlternateErase = 0x99, /* AlternateErase */
+ kHIDUsage_KeyboardSysReqOrAttention = 0x9A, /* SysReq/Attention */
+ kHIDUsage_KeyboardCancel = 0x9B, /* Cancel */
+ kHIDUsage_KeyboardClear = 0x9C, /* Clear */
+ kHIDUsage_KeyboardPrior = 0x9D, /* Prior */
+ kHIDUsage_KeyboardReturn = 0x9E, /* Return */
+ kHIDUsage_KeyboardSeparator = 0x9F, /* Separator */
+ kHIDUsage_KeyboardOut = 0xA0, /* Out */
+ kHIDUsage_KeyboardOper = 0xA1, /* Oper */
+ kHIDUsage_KeyboardClearOrAgain = 0xA2, /* Clear/Again */
+ kHIDUsage_KeyboardCrSelOrProps = 0xA3, /* CrSel/Props */
+ kHIDUsage_KeyboardExSel = 0xA4, /* ExSel */
+ /* 0xA5-0xDF Reserved */
+ kHIDUsage_KeyboardLeftControl = 0xE0, /* Left Control */
+ kHIDUsage_KeyboardLeftShift = 0xE1, /* Left Shift */
+ kHIDUsage_KeyboardLeftAlt = 0xE2, /* Left Alt */
+ kHIDUsage_KeyboardLeftGUI = 0xE3, /* Left GUI */
+ kHIDUsage_KeyboardRightControl = 0xE4, /* Right Control */
+ kHIDUsage_KeyboardRightShift = 0xE5, /* Right Shift */
+ kHIDUsage_KeyboardRightAlt = 0xE6, /* Right Alt */
+ kHIDUsage_KeyboardRightGUI = 0xE7, /* Right GUI */
+ /* 0xE8-0xFFFF Reserved */
+ kHIDUsage_Keyboard_Reserved = 0xFFFF
+};
+
+/* LEDs Page (0x08) */
+/* An LED or indicator is implemented as an On/Off Control (OOF) using the ÒSingle button toggleÓ mode, where a value of 1 will turn on the indicator, and a value of 0 will turn it off. The exceptions are described below. */
+enum
+{
+ kHIDUsage_LED_NumLock = 0x01, /* On/Off Control */
+ kHIDUsage_LED_CapsLock = 0x02, /* On/Off Control */
+ kHIDUsage_LED_ScrollLock = 0x03, /* On/Off Control */
+ kHIDUsage_LED_Compose = 0x04, /* On/Off Control */
+ kHIDUsage_LED_Kana = 0x05, /* On/Off Control */
+ kHIDUsage_LED_Power = 0x06, /* On/Off Control */
+ kHIDUsage_LED_Shift = 0x07, /* On/Off Control */
+ kHIDUsage_LED_DoNotDisturb = 0x08, /* On/Off Control */
+ kHIDUsage_LED_Mute = 0x09, /* On/Off Control */
+ kHIDUsage_LED_ToneEnable = 0x0A, /* On/Off Control */
+ kHIDUsage_LED_HighCutFilter = 0x0B, /* On/Off Control */
+ kHIDUsage_LED_LowCutFilter = 0x0C, /* On/Off Control */
+ kHIDUsage_LED_EqualizerEnable = 0x0D, /* On/Off Control */
+ kHIDUsage_LED_SoundFieldOn = 0x0E, /* On/Off Control */
+ kHIDUsage_LED_SurroundOn = 0x0F, /* On/Off Control */
+ kHIDUsage_LED_Repeat = 0x10, /* On/Off Control */
+ kHIDUsage_LED_Stereo = 0x11, /* On/Off Control */
+ kHIDUsage_LED_SamplingRateDetect = 0x12, /* On/Off Control */
+ kHIDUsage_LED_Spinning = 0x13, /* On/Off Control */
+ kHIDUsage_LED_CAV = 0x14, /* On/Off Control */
+ kHIDUsage_LED_CLV = 0x15, /* On/Off Control */
+ kHIDUsage_LED_RecordingFormatDetect = 0x16, /* On/Off Control */
+ kHIDUsage_LED_OffHook = 0x17, /* On/Off Control */
+ kHIDUsage_LED_Ring = 0x18, /* On/Off Control */
+ kHIDUsage_LED_MessageWaiting = 0x19, /* On/Off Control */
+ kHIDUsage_LED_DataMode = 0x1A, /* On/Off Control */
+ kHIDUsage_LED_BatteryOperation = 0x1B, /* On/Off Control */
+ kHIDUsage_LED_BatteryOK = 0x1C, /* On/Off Control */
+ kHIDUsage_LED_BatteryLow = 0x1D, /* On/Off Control */
+ kHIDUsage_LED_Speaker = 0x1E, /* On/Off Control */
+ kHIDUsage_LED_HeadSet = 0x1F, /* On/Off Control */
+ kHIDUsage_LED_Hold = 0x20, /* On/Off Control */
+ kHIDUsage_LED_Microphone = 0x21, /* On/Off Control */
+ kHIDUsage_LED_Coverage = 0x22, /* On/Off Control */
+ kHIDUsage_LED_NightMode = 0x23, /* On/Off Control */
+ kHIDUsage_LED_SendCalls = 0x24, /* On/Off Control */
+ kHIDUsage_LED_CallPickup = 0x25, /* On/Off Control */
+ kHIDUsage_LED_Conference = 0x26, /* On/Off Control */
+ kHIDUsage_LED_StandBy = 0x27, /* On/Off Control */
+ kHIDUsage_LED_CameraOn = 0x28, /* On/Off Control */
+ kHIDUsage_LED_CameraOff = 0x29, /* On/Off Control */
+ kHIDUsage_LED_OnLine = 0x2A, /* On/Off Control */
+ kHIDUsage_LED_OffLine = 0x2B, /* On/Off Control */
+ kHIDUsage_LED_Busy = 0x2C, /* On/Off Control */
+ kHIDUsage_LED_Ready = 0x2D, /* On/Off Control */
+ kHIDUsage_LED_PaperOut = 0x2E, /* On/Off Control */
+ kHIDUsage_LED_PaperJam = 0x2F, /* On/Off Control */
+ kHIDUsage_LED_Remote = 0x30, /* On/Off Control */
+ kHIDUsage_LED_Forward = 0x31, /* On/Off Control */
+ kHIDUsage_LED_Reverse = 0x32, /* On/Off Control */
+ kHIDUsage_LED_Stop = 0x33, /* On/Off Control */
+ kHIDUsage_LED_Rewind = 0x34, /* On/Off Control */
+ kHIDUsage_LED_FastForward = 0x35, /* On/Off Control */
+ kHIDUsage_LED_Play = 0x36, /* On/Off Control */
+ kHIDUsage_LED_Pause = 0x37, /* On/Off Control */
+ kHIDUsage_LED_Record = 0x38, /* On/Off Control */
+ kHIDUsage_LED_Error = 0x39, /* On/Off Control */
+ kHIDUsage_LED_Usage = 0x3A, /* Selector */
+ kHIDUsage_LED_UsageInUseIndicator = 0x3B, /* Usage Switch */
+ kHIDUsage_LED_UsageMultiModeIndicator = 0x3C, /* Usage Modifier */
+ kHIDUsage_LED_IndicatorOn = 0x3D, /* Selector */
+ kHIDUsage_LED_IndicatorFlash = 0x3E, /* Selector */
+ kHIDUsage_LED_IndicatorSlowBlink = 0x3F, /* Selector */
+ kHIDUsage_LED_IndicatorFastBlink = 0x40, /* Selector */
+ kHIDUsage_LED_IndicatorOff = 0x41, /* Selector */
+ kHIDUsage_LED_FlashOnTime = 0x42, /* Dynamic Value */
+ kHIDUsage_LED_SlowBlinkOnTime = 0x43, /* Dynamic Value */
+ kHIDUsage_LED_SlowBlinkOffTime = 0x44, /* Dynamic Value */
+ kHIDUsage_LED_FastBlinkOnTime = 0x45, /* Dynamic Value */
+ kHIDUsage_LED_FastBlinkOffTime = 0x46, /* Dynamic Value */
+ kHIDUsage_LED_UsageIndicatorColor = 0x47, /* Usage Modifier */
+ kHIDUsage_LED_IndicatorRed = 0x48, /* Selector */
+ kHIDUsage_LED_IndicatorGreen = 0x49, /* Selector */
+ kHIDUsage_LED_IndicatorAmber = 0x4A, /* Selector */
+ kHIDUsage_LED_GenericIndicator = 0x4B, /* On/Off Control */
+ kHIDUsage_LED_SystemSuspend = 0x4C, /* On/Off Control */
+ kHIDUsage_LED_ExternalPowerConnected = 0x4D, /* On/Off Control */
+ kHIDUsage_LED_PlayerIndicator = 0x4E, /* Collection Logical */
+ kHIDUsage_LED_Player1 = 0x4F, /* Selector */
+ kHIDUsage_LED_Player2 = 0x50, /* Selector */
+ kHIDUsage_LED_Player3 = 0x51, /* Selector */
+ kHIDUsage_LED_Player4 = 0x52, /* Selector */
+ kHIDUsage_LED_Player5 = 0x53, /* Selector */
+ kHIDUsage_LED_Player6 = 0x54, /* Selector */
+ kHIDUsage_LED_Player7 = 0x55, /* Selector */
+ kHIDUsage_LED_Player8 = 0x56, /* Selector */
+ /* 0x4E - 0xFFFF Reserved */
+ kHIDUsage_LED_Reserved = 0xFFFF
+};
+
+/* Button Page (0x09) */
+/* The Button page is the first place an application should look for user selection controls. System graphical user interfaces typically employ a pointer and a set of hierarchical selectors to select, move and otherwise manipulate their environment. For these purposes the following assignment of significance can be applied to the Button usages: */
+/* ¥ Button 1, Primary Button. Used for object selecting, dragging, and double click activation. On MacOS, this is the only button. Microsoft operating systems call this a logical left button, because it */
+/* is not necessarily physically located on the left of the pointing device. */
+/* ¥ Button 2, Secondary Button. Used by newer graphical user interfaces to browse object properties. Exposed by systems to applications that typically assign application-specific functionality. */
+/* ¥ Button 3, Tertiary Button. Optional control. Exposed to applications, but seldom assigned functionality due to prevalence of two- and one-button devices. */
+/* ¥ Buttons 4 -55. As the button number increases, its significance as a selector decreases. */
+/* In many ways the assignment of button numbers is similar to the assignment of Effort in Physical descriptors. Button 1 would be used to define the button a finger rests on when the hand is in the Òat restÓ position, that is, virtually no effort is required by the user to activate the button. Button values increment as the finger has to stretch to reach a control. See Section 6.2.3, ÒPhysical Descriptors,Ó in the HID Specification for methods of further qualifying buttons. */
+enum
+{
+ kHIDUsage_Button_1 = 0x01, /* (primary/trigger) */
+ kHIDUsage_Button_2 = 0x02, /* (secondary) */
+ kHIDUsage_Button_3 = 0x03, /* (tertiary) */
+ kHIDUsage_Button_4 = 0x04, /* 4th button */
+ kHIDUsage_Button_5 = 0x05, /* (5th button) */
+ kHIDUsage_Button_6 = 0x06, /* (6th button) */
+ kHIDUsage_Button_7 = 0x07, /* (7th button) */
+ kHIDUsage_Button_8 = 0x08, /* (8th button) */
+ kHIDUsage_Button_9 = 0x09, /* (9th button) */
+ kHIDUsage_Button_10 = 0x0a, /* (10th button) */
+ kHIDUsage_Button_11 = 0x0b, /* (11th button) */
+ kHIDUsage_Button_12 = 0x0c, /* (12th button) */
+ kHIDUsage_Button_13 = 0x0d, /* (13th button) */
+ kHIDUsage_Button_14 = 0x0e, /* (14th button) */
+ kHIDUsage_Button_15 = 0x0f, /* (15th button) */
+ kHIDUsage_Button_16 = 0x10, /* (16th button) */
+ kHIDUsage_Button_17 = 0x11, /* (17th button) */
+ kHIDUsage_Button_18 = 0x12, /* (18th button) */
+ kHIDUsage_Button_19 = 0x13, /* (19th button) */
+ kHIDUsage_Button_20 = 0x14, /* (20th button) */
+ kHIDUsage_Button_21 = 0x15, /* (21st button) */
+ kHIDUsage_Button_22 = 0x16, /* (22nd button) */
+ kHIDUsage_Button_23 = 0x17, /* (23rd button) */
+ kHIDUsage_Button_24 = 0x18, /* (24th button) */
+ kHIDUsage_Button_25 = 0x19, /* (25th button) */
+ kHIDUsage_Button_26 = 0x1a, /* (26th button) */
+ kHIDUsage_Button_27 = 0x1b, /* (27th button) */
+ kHIDUsage_Button_28 = 0x1c, /* (28th button) */
+ kHIDUsage_Button_29 = 0x1d, /* (29th button) */
+ kHIDUsage_Button_30 = 0x1e, /* (30th button) */
+ kHIDUsage_Button_31 = 0x1f, /* (31st button) */
+ kHIDUsage_Button_32 = 0x20, /* (32nd button) */
+ kHIDUsage_Button_33 = 0x21, /* (33rd button) */
+ kHIDUsage_Button_34 = 0x22, /* (34th button) */
+ kHIDUsage_Button_35 = 0x23, /* (35th button) */
+ kHIDUsage_Button_36 = 0x24, /* (36th button) */
+ kHIDUsage_Button_37 = 0x25, /* (37th button) */
+ kHIDUsage_Button_38 = 0x26, /* (38th button) */
+ kHIDUsage_Button_39 = 0x27, /* (39th button) */
+ kHIDUsage_Button_40 = 0x28, /* (40th button) */
+ kHIDUsage_Button_41 = 0x29, /* (41st button) */
+ kHIDUsage_Button_42 = 0x2a, /* (42nd button) */
+ kHIDUsage_Button_43 = 0x2b, /* (43rd button) */
+ kHIDUsage_Button_44 = 0x2c, /* (44th button) */
+ kHIDUsage_Button_45 = 0x2d, /* (45th button) */
+ kHIDUsage_Button_46 = 0x2e, /* (46th button) */
+ kHIDUsage_Button_47 = 0x2f, /* (47th button) */
+ kHIDUsage_Button_48 = 0x30, /* (48th button) */
+ kHIDUsage_Button_49 = 0x31, /* (49th button) */
+ kHIDUsage_Button_50 = 0x32, /* (50th button) */
+ kHIDUsage_Button_51 = 0x33, /* (51st button) */
+ kHIDUsage_Button_52 = 0x34, /* (52nd button) */
+ kHIDUsage_Button_53 = 0x35, /* (53rd button) */
+ kHIDUsage_Button_54 = 0x36, /* (54th button) */
+ kHIDUsage_Button_55 = 0x37, /* (55th button) */
+ kHIDUsage_Button_56 = 0x38, /* (56th button) */
+ kHIDUsage_Button_57 = 0x39, /* (57th button) */
+ kHIDUsage_Button_58 = 0x3a, /* (58th button) */
+ kHIDUsage_Button_59 = 0x3b, /* (59th button) */
+ kHIDUsage_Button_60 = 0x3c, /* (60th button) */
+ kHIDUsage_Button_61 = 0x3d, /* (61st button) */
+ kHIDUsage_Button_62 = 0x3e, /* (62nd button) */
+ kHIDUsage_Button_63 = 0x3f, /* (63rd button) */
+ kHIDUsage_Button_64 = 0x40, /* (64th button) */
+ kHIDUsage_Button_65 = 0x41, /* (65th button) */
+ kHIDUsage_Button_66 = 0x42, /* (66th button) */
+ kHIDUsage_Button_67 = 0x43, /* (67th button) */
+ kHIDUsage_Button_68 = 0x44, /* (68th button) */
+ kHIDUsage_Button_69 = 0x45, /* (69th button) */
+ kHIDUsage_Button_70 = 0x46, /* (70th button) */
+ kHIDUsage_Button_71 = 0x47, /* (71st button) */
+ kHIDUsage_Button_72 = 0x48, /* (72nd button) */
+ kHIDUsage_Button_73 = 0x49, /* (73rd button) */
+ kHIDUsage_Button_74 = 0x4a, /* (74th button) */
+ kHIDUsage_Button_75 = 0x4b, /* (75th button) */
+ kHIDUsage_Button_76 = 0x4c, /* (76th button) */
+ kHIDUsage_Button_77 = 0x4d, /* (77th button) */
+ kHIDUsage_Button_78 = 0x4e, /* (78th button) */
+ kHIDUsage_Button_79 = 0x4f, /* (79th button) */
+ kHIDUsage_Button_80 = 0x50, /* (80th button) */
+ kHIDUsage_Button_81 = 0x51, /* (81st button) */
+ kHIDUsage_Button_82 = 0x52, /* (82nd button) */
+ kHIDUsage_Button_83 = 0x53, /* (83rd button) */
+ kHIDUsage_Button_84 = 0x54, /* (84th button) */
+ kHIDUsage_Button_85 = 0x55, /* (85th button) */
+ kHIDUsage_Button_86 = 0x56, /* (86th button) */
+ kHIDUsage_Button_87 = 0x57, /* (87th button) */
+ kHIDUsage_Button_88 = 0x58, /* (88th button) */
+ kHIDUsage_Button_89 = 0x59, /* (89th button) */
+ kHIDUsage_Button_90 = 0x5a, /* (90th button) */
+ kHIDUsage_Button_91 = 0x5b, /* (91st button) */
+ kHIDUsage_Button_92 = 0x5c, /* (92nd button) */
+ kHIDUsage_Button_93 = 0x5d, /* (93rd button) */
+ kHIDUsage_Button_94 = 0x5e, /* (94th button) */
+ kHIDUsage_Button_95 = 0x5f, /* (95th button) */
+ kHIDUsage_Button_96 = 0x60, /* (96th button) */
+ kHIDUsage_Button_97 = 0x61, /* (97th button) */
+ kHIDUsage_Button_98 = 0x62, /* (98th button) */
+ kHIDUsage_Button_99 = 0x63, /* (99th button) */
+ kHIDUsage_Button_100 = 0x64, /* (100th button) */
+ kHIDUsage_Button_101 = 0x65, /* (101st button) */
+ kHIDUsage_Button_102 = 0x66, /* (102nd button) */
+ kHIDUsage_Button_103 = 0x67, /* (103rd button) */
+ kHIDUsage_Button_104 = 0x68, /* (104th button) */
+ kHIDUsage_Button_105 = 0x69, /* (105th button) */
+ kHIDUsage_Button_106 = 0x6a, /* (106th button) */
+ kHIDUsage_Button_107 = 0x6b, /* (107th button) */
+ kHIDUsage_Button_108 = 0x6c, /* (108th button) */
+ kHIDUsage_Button_109 = 0x6d, /* (109th button) */
+ kHIDUsage_Button_110 = 0x6e, /* (110th button) */
+ kHIDUsage_Button_111 = 0x6f, /* (111th button) */
+ kHIDUsage_Button_112 = 0x70, /* (112th button) */
+ kHIDUsage_Button_113 = 0x71, /* (113th button) */
+ kHIDUsage_Button_114 = 0x72, /* (114th button) */
+ kHIDUsage_Button_115 = 0x73, /* (115th button) */
+ kHIDUsage_Button_116 = 0x74, /* (116th button) */
+ kHIDUsage_Button_117 = 0x75, /* (117th button) */
+ kHIDUsage_Button_118 = 0x76, /* (118th button) */
+ kHIDUsage_Button_119 = 0x77, /* (119th button) */
+ kHIDUsage_Button_120 = 0x78, /* (120th button) */
+ kHIDUsage_Button_121 = 0x79, /* (121st button) */
+ kHIDUsage_Button_122 = 0x7a, /* (122nd button) */
+ kHIDUsage_Button_123 = 0x7b, /* (123rd button) */
+ kHIDUsage_Button_124 = 0x7c, /* (124th button) */
+ kHIDUsage_Button_125 = 0x7d, /* (125th button) */
+ kHIDUsage_Button_126 = 0x7e, /* (126th button) */
+ kHIDUsage_Button_127 = 0x7f, /* (127th button) */
+ kHIDUsage_Button_128 = 0x80, /* (128th button) */
+ kHIDUsage_Button_129 = 0x81, /* (129th button) */
+ kHIDUsage_Button_130 = 0x82, /* (130th button) */
+ kHIDUsage_Button_131 = 0x83, /* (131st button) */
+ kHIDUsage_Button_132 = 0x84, /* (132nd button) */
+ kHIDUsage_Button_133 = 0x85, /* (133rd button) */
+ kHIDUsage_Button_134 = 0x86, /* (134th button) */
+ kHIDUsage_Button_135 = 0x87, /* (135th button) */
+ kHIDUsage_Button_136 = 0x88, /* (136th button) */
+ kHIDUsage_Button_137 = 0x89, /* (137th button) */
+ kHIDUsage_Button_138 = 0x8a, /* (138th button) */
+ kHIDUsage_Button_139 = 0x8b, /* (139th button) */
+ kHIDUsage_Button_140 = 0x8c, /* (140th button) */
+ kHIDUsage_Button_141 = 0x8d, /* (141st button) */
+ kHIDUsage_Button_142 = 0x8e, /* (142nd button) */
+ kHIDUsage_Button_143 = 0x8f, /* (143rd button) */
+ kHIDUsage_Button_144 = 0x90, /* (144th button) */
+ kHIDUsage_Button_145 = 0x91, /* (145th button) */
+ kHIDUsage_Button_146 = 0x92, /* (146th button) */
+ kHIDUsage_Button_147 = 0x93, /* (147th button) */
+ kHIDUsage_Button_148 = 0x94, /* (148th button) */
+ kHIDUsage_Button_149 = 0x95, /* (149th button) */
+ kHIDUsage_Button_150 = 0x96, /* (150th button) */
+ kHIDUsage_Button_151 = 0x97, /* (151st button) */
+ kHIDUsage_Button_152 = 0x98, /* (152nd button) */
+ kHIDUsage_Button_153 = 0x99, /* (153rd button) */
+ kHIDUsage_Button_154 = 0x9a, /* (154th button) */
+ kHIDUsage_Button_155 = 0x9b, /* (155th button) */
+ kHIDUsage_Button_156 = 0x9c, /* (156th button) */
+ kHIDUsage_Button_157 = 0x9d, /* (157th button) */
+ kHIDUsage_Button_158 = 0x9e, /* (158th button) */
+ kHIDUsage_Button_159 = 0x9f, /* (159th button) */
+ kHIDUsage_Button_160 = 0xa0, /* (160th button) */
+ kHIDUsage_Button_161 = 0xa1, /* (161st button) */
+ kHIDUsage_Button_162 = 0xa2, /* (162nd button) */
+ kHIDUsage_Button_163 = 0xa3, /* (163rd button) */
+ kHIDUsage_Button_164 = 0xa4, /* (164th button) */
+ kHIDUsage_Button_165 = 0xa5, /* (165th button) */
+ kHIDUsage_Button_166 = 0xa6, /* (166th button) */
+ kHIDUsage_Button_167 = 0xa7, /* (167th button) */
+ kHIDUsage_Button_168 = 0xa8, /* (168th button) */
+ kHIDUsage_Button_169 = 0xa9, /* (169th button) */
+ kHIDUsage_Button_170 = 0xaa, /* (170th button) */
+ kHIDUsage_Button_171 = 0xab, /* (171st button) */
+ kHIDUsage_Button_172 = 0xac, /* (172nd button) */
+ kHIDUsage_Button_173 = 0xad, /* (173rd button) */
+ kHIDUsage_Button_174 = 0xae, /* (174th button) */
+ kHIDUsage_Button_175 = 0xaf, /* (175th button) */
+ kHIDUsage_Button_176 = 0xb0, /* (176th button) */
+ kHIDUsage_Button_177 = 0xb1, /* (177th button) */
+ kHIDUsage_Button_178 = 0xb2, /* (178th button) */
+ kHIDUsage_Button_179 = 0xb3, /* (179th button) */
+ kHIDUsage_Button_180 = 0xb4, /* (180th button) */
+ kHIDUsage_Button_181 = 0xb5, /* (181st button) */
+ kHIDUsage_Button_182 = 0xb6, /* (182nd button) */
+ kHIDUsage_Button_183 = 0xb7, /* (183rd button) */
+ kHIDUsage_Button_184 = 0xb8, /* (184th button) */
+ kHIDUsage_Button_185 = 0xb9, /* (185th button) */
+ kHIDUsage_Button_186 = 0xba, /* (186th button) */
+ kHIDUsage_Button_187 = 0xbb, /* (187th button) */
+ kHIDUsage_Button_188 = 0xbc, /* (188th button) */
+ kHIDUsage_Button_189 = 0xbd, /* (189th button) */
+ kHIDUsage_Button_190 = 0xbe, /* (190th button) */
+ kHIDUsage_Button_191 = 0xbf, /* (191st button) */
+ kHIDUsage_Button_192 = 0xc0, /* (192nd button) */
+ kHIDUsage_Button_193 = 0xc1, /* (193rd button) */
+ kHIDUsage_Button_194 = 0xc2, /* (194th button) */
+ kHIDUsage_Button_195 = 0xc3, /* (195th button) */
+ kHIDUsage_Button_196 = 0xc4, /* (196th button) */
+ kHIDUsage_Button_197 = 0xc5, /* (197th button) */
+ kHIDUsage_Button_198 = 0xc6, /* (198th button) */
+ kHIDUsage_Button_199 = 0xc7, /* (199th button) */
+ kHIDUsage_Button_200 = 0xc8, /* (200th button) */
+ kHIDUsage_Button_201 = 0xc9, /* (201st button) */
+ kHIDUsage_Button_202 = 0xca, /* (202nd button) */
+ kHIDUsage_Button_203 = 0xcb, /* (203rd button) */
+ kHIDUsage_Button_204 = 0xcc, /* (204th button) */
+ kHIDUsage_Button_205 = 0xcd, /* (205th button) */
+ kHIDUsage_Button_206 = 0xce, /* (206th button) */
+ kHIDUsage_Button_207 = 0xcf, /* (207th button) */
+ kHIDUsage_Button_208 = 0xd0, /* (208th button) */
+ kHIDUsage_Button_209 = 0xd1, /* (209th button) */
+ kHIDUsage_Button_210 = 0xd2, /* (210th button) */
+ kHIDUsage_Button_211 = 0xd3, /* (211th button) */
+ kHIDUsage_Button_212 = 0xd4, /* (212th button) */
+ kHIDUsage_Button_213 = 0xd5, /* (213th button) */
+ kHIDUsage_Button_214 = 0xd6, /* (214th button) */
+ kHIDUsage_Button_215 = 0xd7, /* (215th button) */
+ kHIDUsage_Button_216 = 0xd8, /* (216th button) */
+ kHIDUsage_Button_217 = 0xd9, /* (217th button) */
+ kHIDUsage_Button_218 = 0xda, /* (218th button) */
+ kHIDUsage_Button_219 = 0xdb, /* (219th button) */
+ kHIDUsage_Button_220 = 0xdc, /* (220th button) */
+ kHIDUsage_Button_221 = 0xdd, /* (221st button) */
+ kHIDUsage_Button_222 = 0xde, /* (222nd button) */
+ kHIDUsage_Button_223 = 0xdf, /* (223rd button) */
+ kHIDUsage_Button_224 = 0xe0, /* (224th button) */
+ kHIDUsage_Button_225 = 0xe1, /* (225th button) */
+ kHIDUsage_Button_226 = 0xe2, /* (226th button) */
+ kHIDUsage_Button_227 = 0xe3, /* (227th button) */
+ kHIDUsage_Button_228 = 0xe4, /* (228th button) */
+ kHIDUsage_Button_229 = 0xe5, /* (229th button) */
+ kHIDUsage_Button_230 = 0xe6, /* (230th button) */
+ kHIDUsage_Button_231 = 0xe7, /* (231st button) */
+ kHIDUsage_Button_232 = 0xe8, /* (232nd button) */
+ kHIDUsage_Button_233 = 0xe9, /* (233rd button) */
+ kHIDUsage_Button_234 = 0xea, /* (234th button) */
+ kHIDUsage_Button_235 = 0xeb, /* (235th button) */
+ kHIDUsage_Button_236 = 0xec, /* (236th button) */
+ kHIDUsage_Button_237 = 0xed, /* (237th button) */
+ kHIDUsage_Button_238 = 0xee, /* (238th button) */
+ kHIDUsage_Button_239 = 0xef, /* (239th button) */
+ kHIDUsage_Button_240 = 0xf0, /* (240th button) */
+ kHIDUsage_Button_241 = 0xf1, /* (241st button) */
+ kHIDUsage_Button_242 = 0xf2, /* (242nd button) */
+ kHIDUsage_Button_243 = 0xf3, /* (243rd button) */
+ kHIDUsage_Button_244 = 0xf4, /* (244th button) */
+ kHIDUsage_Button_245 = 0xf5, /* (245th button) */
+ kHIDUsage_Button_246 = 0xf6, /* (246th button) */
+ kHIDUsage_Button_247 = 0xf7, /* (247th button) */
+ kHIDUsage_Button_248 = 0xf8, /* (248th button) */
+ kHIDUsage_Button_249 = 0xf9, /* (249th button) */
+ kHIDUsage_Button_250 = 0xfa, /* (250th button) */
+ kHIDUsage_Button_251 = 0xfb, /* (251st button) */
+ kHIDUsage_Button_252 = 0xfc, /* (252nd button) */
+ kHIDUsage_Button_253 = 0xfd, /* (253rd button) */
+ kHIDUsage_Button_254 = 0xfe, /* (254th button) */
+ kHIDUsage_Button_255 = 0xff, /* (255th button) */
+ /* ... */
+ kHIDUsage_Button_65535 = 0xFFFF
+};
+
+/* Ordinal Page (0x0A) */
+/* The Ordinal page allows multiple instances of a control or sets of controls to be declared without requiring individual enumeration in the native usage page. For example, it is not necessary to declare usages of Pointer 1, Pointer 2, and so forth on the Generic Desktop page. When parsed, the ordinal instance number is, in essence, concatenated to the usages attached to the encompassing collection to create Pointer 1, Pointer 2, and so forth. */
+/* For an example, see Section A.5, ÒMultiple Instances of a Control,Ó in Appendix A, ÒUsage Examples.Ó By convention, an Ordinal collection is placed inside the collection for which it is declaring multiple instances. */
+/* Instances do not have to be identical. */
+enum
+{
+ /* 0x00 Reserved */
+ kHIDUsage_Ord_Instance1 = 0x01, /* Usage Modifier */
+ kHIDUsage_Ord_Instance2 = 0x02, /* Usage Modifier */
+ kHIDUsage_Ord_Instance3 = 0x03, /* Usage Modifier */
+ kHIDUsage_Ord_Instance4 = 0x04, /* Usage Modifier */
+ kHIDUsage_Ord_Instance65535 = 0xFFFF /* Usage Modifier */
+};
+
+/* Telephony Page (0x0B) */
+/* This usage page defines the keytop and control usages for telephony devices. */
+/* Indicators on a phone are handled by wrapping them in LED: Usage In Use Indicator and LED: Usage Selected Indicator usages. For example, a message-indicator LED would be identified by a Telephony: Message usage declared as a Feature or Output in a LED: Usage In Use Indicator collection. */
+/* See Section 14, ÒConsumer Page (0x0C),Ó for audio volume and tone controls. */
+enum
+{
+ kHIDUsage_Tfon_Phone = 0x01, /* Application Collection */
+ kHIDUsage_Tfon_AnsweringMachine = 0x02, /* Application Collection */
+ kHIDUsage_Tfon_MessageControls = 0x03, /* Logical Collection */
+ kHIDUsage_Tfon_Handset = 0x04, /* Logical Collection */
+ kHIDUsage_Tfon_Headset = 0x05, /* Logical Collection */
+ kHIDUsage_Tfon_TelephonyKeyPad = 0x06, /* Named Array */
+ kHIDUsage_Tfon_ProgrammableButton = 0x07, /* Named Array */
+ /* 0x08 - 0x1F Reserved */
+ kHIDUsage_Tfon_HookSwitch = 0x20, /* On/Off Control */
+ kHIDUsage_Tfon_Flash = 0x21, /* Momentary Control */
+ kHIDUsage_Tfon_Feature = 0x22, /* One-Shot Control */
+ kHIDUsage_Tfon_Hold = 0x23, /* On/Off Control */
+ kHIDUsage_Tfon_Redial = 0x24, /* One-Shot Control */
+ kHIDUsage_Tfon_Transfer = 0x25, /* One-Shot Control */
+ kHIDUsage_Tfon_Drop = 0x26, /* One-Shot Control */
+ kHIDUsage_Tfon_Park = 0x27, /* On/Off Control */
+ kHIDUsage_Tfon_ForwardCalls = 0x28, /* On/Off Control */
+ kHIDUsage_Tfon_AlternateFunction = 0x29, /* Momentary Control */
+ kHIDUsage_Tfon_Line = 0x2A, /* One-Shot Control */
+ kHIDUsage_Tfon_SpeakerPhone = 0x2B, /* On/Off Control */
+ kHIDUsage_Tfon_Conference = 0x2C, /* On/Off Control */
+ kHIDUsage_Tfon_RingEnable = 0x2D, /* On/Off Control */
+ kHIDUsage_Tfon_Ring = 0x2E, /* Selector */
+ kHIDUsage_Tfon_PhoneMute = 0x2F, /* On/Off Control */
+ kHIDUsage_Tfon_CallerID = 0x30, /* Momentary Control */
+ /* 0x31 - 0x4F Reserved */
+ kHIDUsage_Tfon_SpeedDial = 0x50, /* One-Shot Control */
+ kHIDUsage_Tfon_StoreNumber = 0x51, /* One-Shot Control */
+ kHIDUsage_Tfon_RecallNumber = 0x52, /* One-Shot Control */
+ kHIDUsage_Tfon_PhoneDirectory = 0x53, /* On/Off Control */
+ /* 0x54 - 0x6F Reserved */
+ kHIDUsage_Tfon_VoiceMail = 0x70, /* On/Off Control */
+ kHIDUsage_Tfon_ScreenCalls = 0x71, /* On/Off Control */
+ kHIDUsage_Tfon_DoNotDisturb = 0x72, /* On/Off Control */
+ kHIDUsage_Tfon_Message = 0x73, /* One-Shot Control */
+ kHIDUsage_Tfon_AnswerOnOrOff = 0x74, /* On/Off Control */
+ /* 0x75 - 0x8F Reserved */
+ kHIDUsage_Tfon_InsideDialTone = 0x90, /* Momentary Control */
+ kHIDUsage_Tfon_OutsideDialTone = 0x91, /* Momentary Control */
+ kHIDUsage_Tfon_InsideRingTone = 0x92, /* Momentary Control */
+ kHIDUsage_Tfon_OutsideRingTone = 0x93, /* Momentary Control */
+ kHIDUsage_Tfon_PriorityRingTone = 0x94, /* Momentary Control */
+ kHIDUsage_Tfon_InsideRingback = 0x95, /* Momentary Control */
+ kHIDUsage_Tfon_PriorityRingback = 0x96, /* Momentary Control */
+ kHIDUsage_Tfon_LineBusyTone = 0x97, /* Momentary Control */
+ kHIDUsage_Tfon_ReorderTone = 0x98, /* Momentary Control */
+ kHIDUsage_Tfon_CallWaitingTone = 0x99, /* Momentary Control */
+ kHIDUsage_Tfon_ConfirmationTone1 = 0x9A, /* Momentary Control */
+ kHIDUsage_Tfon_ConfirmationTone2 = 0x9B, /* Momentary Control */
+ kHIDUsage_Tfon_TonesOff = 0x9C, /* On/Off Control */
+ kHIDUsage_Tfon_OutsideRingback = 0x9D, /* Momentary Control */
+ /* 0x9E - 0xAF Reserved */
+ kHIDUsage_Tfon_PhoneKey0 = 0xB0, /* Selector/One-Shot Control */
+ kHIDUsage_Tfon_PhoneKey1 = 0xB1, /* Selector/One-Shot Control */
+ kHIDUsage_Tfon_PhoneKey2 = 0xB2, /* Selector/One-Shot Control */
+ kHIDUsage_Tfon_PhoneKey3 = 0xB3, /* Selector/One-Shot Control */
+ kHIDUsage_Tfon_PhoneKey4 = 0xB4, /* Selector/One-Shot Control */
+ kHIDUsage_Tfon_PhoneKey5 = 0xB5, /* Selector/One-Shot Control */
+ kHIDUsage_Tfon_PhoneKey6 = 0xB6, /* Selector/One-Shot Control */
+ kHIDUsage_Tfon_PhoneKey7 = 0xB7, /* Selector/One-Shot Control */
+ kHIDUsage_Tfon_PhoneKey8 = 0xB8, /* Selector/One-Shot Control */
+ kHIDUsage_Tfon_PhoneKey9 = 0xB9, /* Selector/One-Shot Control */
+ kHIDUsage_Tfon_PhoneKeyStar = 0xBA, /* Selector/One-Shot Control */
+ kHIDUsage_Tfon_PhoneKeyPound = 0xBB, /* Selector/One-Shot Control */
+ kHIDUsage_Tfon_PhoneKeyA = 0xBC, /* Selector/One-Shot Control */
+ kHIDUsage_Tfon_PhoneKeyB = 0xBD, /* Selector/One-Shot Control */
+ kHIDUsage_Tfon_PhoneKeyC = 0xBE, /* Selector/One-Shot Control */
+ kHIDUsage_Tfon_PhoneKeyD = 0xBF, /* Selector/One-Shot Control */
+ /* 0xC0 - 0xFFFF Reserved */
+ kHIDUsage_TFon_Reserved = 0xFFFF
+};
+
+/* Consumer Page (0x0C) */
+/* All controls on the Consumer page are application-specific. That is, they affect a specific device, not the system as a whole. */
+enum
+{
+ kHIDUsage_Csmr_ConsumerControl = 0x01, /* Application Collection */
+ kHIDUsage_Csmr_NumericKeyPad = 0x02, /* Named Array */
+ kHIDUsage_Csmr_ProgrammableButtons = 0x03, /* Named Array */
+ kHIDUsage_Csmr_Microphone = 0x04, /* Application Collection */
+ kHIDUsage_Csmr_Headphone = 0x05, /* Application Collection */
+ kHIDUsage_Csmr_GraphicEqualizer = 0x06, /* Application Collection */
+ /* 0x07 - 0x1F Reserved */
+ kHIDUsage_Csmr_Plus10 = 0x20, /* One-Shot Control */
+ kHIDUsage_Csmr_Plus100 = 0x21, /* One-Shot Control */
+ kHIDUsage_Csmr_AMOrPM = 0x22, /* One-Shot Control */
+ /* 0x23 - 0x3F Reserved */
+ kHIDUsage_Csmr_Power = 0x30, /* On/Off Control */
+ kHIDUsage_Csmr_Reset = 0x31, /* One-Shot Control */
+ kHIDUsage_Csmr_Sleep = 0x32, /* One-Shot Control */
+ kHIDUsage_Csmr_SleepAfter = 0x33, /* One-Shot Control */
+ kHIDUsage_Csmr_SleepMode = 0x34, /* Re-Trigger Control */
+ kHIDUsage_Csmr_Illumination = 0x35, /* On/Off Control */
+ kHIDUsage_Csmr_FunctionButtons = 0x36, /* Named Array */
+ /* 0x37 - 0x3F Reserved */
+ kHIDUsage_Csmr_Menu = 0x40, /* On/Off Control */
+ kHIDUsage_Csmr_MenuPick = 0x41, /* One-Shot Control */
+ kHIDUsage_Csmr_MenuUp = 0x42, /* One-Shot Control */
+ kHIDUsage_Csmr_MenuDown = 0x43, /* One-Shot Control */
+ kHIDUsage_Csmr_MenuLeft = 0x44, /* One-Shot Control */
+ kHIDUsage_Csmr_MenuRight = 0x45, /* One-Shot Control */
+ kHIDUsage_Csmr_MenuEscape = 0x46, /* One-Shot Control */
+ kHIDUsage_Csmr_MenuValueIncrease = 0x47, /* One-Shot Control */
+ kHIDUsage_Csmr_MenuValueDecrease = 0x48, /* One-Shot Control */
+ /* 0x49 - 0x5F Reserved */
+ kHIDUsage_Csmr_DataOnScreen = 0x60, /* On/Off Control */
+ kHIDUsage_Csmr_ClosedCaption = 0x61, /* On/Off Control */
+ kHIDUsage_Csmr_ClosedCaptionSelect = 0x62, /* Selector */
+ kHIDUsage_Csmr_VCROrTV = 0x63, /* On/Off Control */
+ kHIDUsage_Csmr_BroadcastMode = 0x64, /* One-Shot Control */
+ kHIDUsage_Csmr_Snapshot = 0x65, /* One-Shot Control */
+ kHIDUsage_Csmr_Still = 0x66, /* One-Shot Control */
+ kHIDUsage_Csmr_PictureInPictureToggle = 0x67, /* One-Shot Control */
+ kHIDUsage_Csmr_PictureInPictureSwap = 0x68, /* One-Shot Control */
+ kHIDUsage_Csmr_RedMenuButton = 0x69, /* Momentary Control */
+ kHIDUsage_Csmr_GreenMenuButton = 0x6A, /* Momentary Control */
+ kHIDUsage_Csmr_BlueMenuButton = 0x6B, /* Momentary Control */
+ kHIDUsage_Csmr_YellowMenuButton = 0x6C, /* Momentary Control */
+ kHIDUsage_Csmr_Aspect = 0x6D, /* One-shot Control */
+ kHIDUsage_Csmr_3DModeSelect = 0x6E, /* One-shot Control */
+ kHIDUsage_Csmr_DisplayBrightnessIncrement = 0x6F, /* Re-Trigger Control */
+ kHIDUsage_Csmr_DisplayBrightnessDecrement = 0x70, /* Re-Trigger Control */
+ kHIDUsage_Csmr_DisplayBrightness = 0x71, /* Logical Collection */
+ kHIDUsage_Csmr_DisplayBacklightToggle = 0x72, /* One Shot Control */
+ kHIDUsage_Csmr_DisplayBrightnessMinimum = 0x73, /* One Shot Control */
+ kHIDUsage_Csmr_DisplayBrightnessMaximum = 0x74, /* One Shot Control */
+ kHIDUsage_Csmr_DisplayBrightnessSetAutoBrightness = 0x75, /* On Off Control */
+ kHIDUsage_Csmr_KeyboardBrightnessIncrement = 0x79, /* Re-Trigger Control */
+ kHIDUsage_Csmr_KeyboardBrightnessDecrement = 0x7A, /* Re-Trigger Control */
+ /* 0x7B - 0x7F Reserved */
+ kHIDUsage_Csmr_Selection = 0x80, /* Named Array */
+ kHIDUsage_Csmr_Assign = 0x81, /* Selector */
+ kHIDUsage_Csmr_ModeStep = 0x82, /* One-Shot Control */
+ kHIDUsage_Csmr_RecallLast = 0x83, /* One-Shot Control */
+ kHIDUsage_Csmr_EnterChannel = 0x84, /* One-Shot Control */
+ kHIDUsage_Csmr_OrderMovie = 0x85, /* One-Shot Control */
+ kHIDUsage_Csmr_Channel = 0x86, /* Linear Control */
+ kHIDUsage_Csmr_MediaSelection = 0x87, /* Selector */
+ kHIDUsage_Csmr_MediaSelectComputer = 0x88, /* Selector */
+ kHIDUsage_Csmr_MediaSelectTV = 0x89, /* Selector */
+ kHIDUsage_Csmr_MediaSelectWWW = 0x8A, /* Selector */
+ kHIDUsage_Csmr_MediaSelectDVD = 0x8B, /* Selector */
+ kHIDUsage_Csmr_MediaSelectTelephone = 0x8C, /* Selector */
+ kHIDUsage_Csmr_MediaSelectProgramGuide = 0x8D, /* Selector */
+ kHIDUsage_Csmr_MediaSelectVideoPhone = 0x8E, /* Selector */
+ kHIDUsage_Csmr_MediaSelectGames = 0x8F, /* Selector */
+ kHIDUsage_Csmr_MediaSelectMessages = 0x90, /* Selector */
+ kHIDUsage_Csmr_MediaSelectCD = 0x91, /* Selector */
+ kHIDUsage_Csmr_MediaSelectVCR = 0x92, /* Selector */
+ kHIDUsage_Csmr_MediaSelectTuner = 0x93, /* Selector */
+ kHIDUsage_Csmr_Quit = 0x94, /* One-Shot Control */
+ kHIDUsage_Csmr_Help = 0x95, /* On/Off Control */
+ kHIDUsage_Csmr_MediaSelectTape = 0x96, /* Selector */
+ kHIDUsage_Csmr_MediaSelectCable = 0x97, /* Selector */
+ kHIDUsage_Csmr_MediaSelectSatellite = 0x98, /* Selector */
+ kHIDUsage_Csmr_MediaSelectSecurity = 0x99, /* Selector */
+ kHIDUsage_Csmr_MediaSelectHome = 0x9A, /* Selector */
+ kHIDUsage_Csmr_MediaSelectCall = 0x9B, /* Selector */
+ kHIDUsage_Csmr_ChannelIncrement = 0x9C, /* One-Shot Control */
+ kHIDUsage_Csmr_ChannelDecrement = 0x9D, /* One-Shot Control */
+ kHIDUsage_Csmr_Media = 0x9E, /* Selector */
+ /* 0x9F Reserved */
+ kHIDUsage_Csmr_VCRPlus = 0xA0, /* One-Shot Control */
+ kHIDUsage_Csmr_Once = 0xA1, /* One-Shot Control */
+ kHIDUsage_Csmr_Daily = 0xA2, /* One-Shot Control */
+ kHIDUsage_Csmr_Weekly = 0xA3, /* One-Shot Control */
+ kHIDUsage_Csmr_Monthly = 0xA4, /* One-Shot Control */
+ /* 0xA5 - 0xAF Reserved */
+ kHIDUsage_Csmr_Play = 0xB0, /* On/Off Control */
+ kHIDUsage_Csmr_Pause = 0xB1, /* On/Off Control */
+ kHIDUsage_Csmr_Record = 0xB2, /* On/Off Control */
+ kHIDUsage_Csmr_FastForward = 0xB3, /* On/Off Control */
+ kHIDUsage_Csmr_Rewind = 0xB4, /* On/Off Control */
+ kHIDUsage_Csmr_ScanNextTrack = 0xB5, /* One-Shot Control */
+ kHIDUsage_Csmr_ScanPreviousTrack = 0xB6, /* One-Shot Control */
+ kHIDUsage_Csmr_Stop = 0xB7, /* One-Shot Control */
+ kHIDUsage_Csmr_Eject = 0xB8, /* One-Shot Control */
+ kHIDUsage_Csmr_RandomPlay = 0xB9, /* On/Off Control */
+ kHIDUsage_Csmr_SelectDisc = 0xBA, /* Named Array */
+ kHIDUsage_Csmr_EnterDisc = 0xBB, /* Momentary Control */
+ kHIDUsage_Csmr_Repeat = 0xBC, /* One-Shot Control */
+ kHIDUsage_Csmr_Tracking = 0xBD, /* Linear Control */
+ kHIDUsage_Csmr_TrackNormal = 0xBE, /* One-Shot Control */
+ kHIDUsage_Csmr_SlowTracking = 0xBF, /* Linear Control */
+ kHIDUsage_Csmr_FrameForward = 0xC0, /* Re-Trigger Control */
+ kHIDUsage_Csmr_FrameBack = 0xC1, /* Re-Trigger Control */
+ kHIDUsage_Csmr_Mark = 0xC2, /* One-Shot Control */
+ kHIDUsage_Csmr_ClearMark = 0xC3, /* One-Shot Control */
+ kHIDUsage_Csmr_RepeatFromMark = 0xC4, /* On/Off Control */
+ kHIDUsage_Csmr_ReturnToMark = 0xC5, /* One-Shot Control */
+ kHIDUsage_Csmr_SearchMarkForward = 0xC6, /* One-Shot Control */
+ kHIDUsage_Csmr_SearchMarkBackwards = 0xC7, /* One-Shot Control */
+ kHIDUsage_Csmr_CounterReset = 0xC8, /* One-Shot Control */
+ kHIDUsage_Csmr_ShowCounter = 0xC9, /* One-Shot Control */
+ kHIDUsage_Csmr_TrackingIncrement = 0xCA, /* Re-Trigger Control */
+ kHIDUsage_Csmr_TrackingDecrement = 0xCB, /* Re-Trigger Control */
+ kHIDUsage_Csmr_StopOrEject = 0xCC, /* One-Shot Control */
+ kHIDUsage_Csmr_PlayOrPause = 0xCD, /* One-Shot Control */
+ kHIDUsage_Csmr_PlayOrSkip = 0xCE, /* One-Shot Control */
+ kHIDUsage_Csmr_VoiceCommand = 0xCF, /* One-Shot Control */
+ /* 0xCF - 0xDF Reserved */
+ kHIDUsage_Csmr_Volume = 0xE0, /* Linear Control */
+ kHIDUsage_Csmr_Balance = 0xE1, /* Linear Control */
+ kHIDUsage_Csmr_Mute = 0xE2, /* On/Off Control */
+ kHIDUsage_Csmr_Bass = 0xE3, /* Linear Control */
+ kHIDUsage_Csmr_Treble = 0xE4, /* Linear Control */
+ kHIDUsage_Csmr_BassBoost = 0xE5, /* On/Off Control */
+ kHIDUsage_Csmr_SurroundMode = 0xE6, /* One-Shot Control */
+ kHIDUsage_Csmr_Loudness = 0xE7, /* On/Off Control */
+ kHIDUsage_Csmr_MPX = 0xE8, /* On/Off Control */
+ kHIDUsage_Csmr_VolumeIncrement = 0xE9, /* Re-Trigger Control */
+ kHIDUsage_Csmr_VolumeDecrement = 0xEA, /* Re-Trigger Control */
+ /* 0xEB - 0xEF Reserved */
+ kHIDUsage_Csmr_Speed = 0xF0, /* Selector */
+ kHIDUsage_Csmr_PlaybackSpeed = 0xF1, /* Named Array */
+ kHIDUsage_Csmr_StandardPlay = 0xF2, /* Selector */
+ kHIDUsage_Csmr_LongPlay = 0xF3, /* Selector */
+ kHIDUsage_Csmr_ExtendedPlay = 0xF4, /* Selector */
+ kHIDUsage_Csmr_Slow = 0xF5, /* One-Shot Control */
+ /* 0xF6 - 0xFF Reserved */
+ kHIDUsage_Csmr_FanEnable = 0x100, /* On/Off Control */
+ kHIDUsage_Csmr_FanSpeed = 0x101, /* Linear Control */
+ kHIDUsage_Csmr_LightEnable = 0x102, /* On/Off Control */
+ kHIDUsage_Csmr_LightIlluminationLevel = 0x103, /* Linear Control */
+ kHIDUsage_Csmr_ClimateControlEnable = 0x104, /* On/Off Control */
+ kHIDUsage_Csmr_RoomTemperature = 0x105, /* Linear Control */
+ kHIDUsage_Csmr_SecurityEnable = 0x106, /* On/Off Control */
+ kHIDUsage_Csmr_FireAlarm = 0x107, /* One-Shot Control */
+ kHIDUsage_Csmr_PoliceAlarm = 0x108, /* One-Shot Control */
+ kHIDUsage_Csmr_Proximity = 0x109, /* Linear Control */
+ kHIDUsage_Csmr_Motion = 0x10A, /* One-Shot Control */
+ kHIDUsage_Csmr_DuressAlarm = 0x10B, /* One-Shot Control */
+ kHIDUsage_Csmr_HoldupAlarm = 0x10C, /* One-Shot Control */
+ kHIDUsage_Csmr_MedicalAlarm = 0x10D, /* One-Shot Control */
+ /* 0x10E - 0x14F Reserved */
+ kHIDUsage_Csmr_BalanceRight = 0x150, /* Re-Trigger Control */
+ kHIDUsage_Csmr_BalanceLeft = 0x151, /* Re-Trigger Control */
+ kHIDUsage_Csmr_BassIncrement = 0x152, /* Re-Trigger Control */
+ kHIDUsage_Csmr_BassDecrement = 0x153, /* Re-Trigger Control */
+ kHIDUsage_Csmr_TrebleIncrement = 0x154, /* Re-Trigger Control */
+ kHIDUsage_Csmr_TrebleDecrement = 0x155, /* Re-Trigger Control */
+ /* 0x156 - 0x15F Reserved */
+ kHIDUsage_Csmr_SpeakerSystem = 0x160, /* Logical Collection */
+ kHIDUsage_Csmr_ChannelLeft = 0x161, /* Logical Collection */
+ kHIDUsage_Csmr_ChannelRight = 0x162, /* Logical Collection */
+ kHIDUsage_Csmr_ChannelCenter = 0x163, /* Logical Collection */
+ kHIDUsage_Csmr_ChannelFront = 0x164, /* Logical Collection */
+ kHIDUsage_Csmr_ChannelCenterFront = 0x165, /* Logical Collection */
+ kHIDUsage_Csmr_ChannelSide = 0x166, /* Logical Collection */
+ kHIDUsage_Csmr_ChannelSurround = 0x167, /* Logical Collection */
+ kHIDUsage_Csmr_ChannelLowFrequencyEnhancement = 0x168, /* Logical Collection */
+ kHIDUsage_Csmr_ChannelTop = 0x169, /* Logical Collection */
+ kHIDUsage_Csmr_ChannelUnknown = 0x16A, /* Logical Collection */
+ /* 0x16B - 0x16F Reserved */
+ kHIDUsage_Csmr_SubChannel = 0x170, /* Linear Control */
+ kHIDUsage_Csmr_SubChannelIncrement = 0x171, /* One-Shot Control */
+ kHIDUsage_Csmr_SubChannelDecrement = 0x172, /* One-Shot Control */
+ kHIDUsage_Csmr_AlternateAudioIncrement = 0x173, /* One-Shot Control */
+ kHIDUsage_Csmr_AlternateAudioDecrement = 0x174, /* One-Shot Control */
+ /* 0x175 - 0x17F Reserved */
+ kHIDUsage_Csmr_ApplicationLaunchButtons = 0x180, /* Named Array */
+ kHIDUsage_Csmr_ALLaunchButtonConfigurationTool = 0x181, /* Selector */
+ kHIDUsage_Csmr_ALProgrammableButtonConfiguration = 0x182, /* Selector */
+ kHIDUsage_Csmr_ALConsumerControlConfiguration = 0x183, /* Selector */
+ kHIDUsage_Csmr_ALWordProcessor = 0x184, /* Selector */
+ kHIDUsage_Csmr_ALTextEditor = 0x185, /* Selector */
+ kHIDUsage_Csmr_ALSpreadsheet = 0x186, /* Selector */
+ kHIDUsage_Csmr_ALGraphicsEditor = 0x187, /* Selector */
+ kHIDUsage_Csmr_ALPresentationApp = 0x188, /* Selector */
+ kHIDUsage_Csmr_ALDatabaseApp = 0x189, /* Selector */
+ kHIDUsage_Csmr_ALEmailReader = 0x18A, /* Selector */
+ kHIDUsage_Csmr_ALNewsreader = 0x18B, /* Selector */
+ kHIDUsage_Csmr_ALVoicemail = 0x18C, /* Selector */
+ kHIDUsage_Csmr_ALContactsOrAddressBook = 0x18D, /* Selector */
+ kHIDUsage_Csmr_ALCalendarOrSchedule = 0x18E, /* Selector */
+ kHIDUsage_Csmr_ALTaskOrProjectManager = 0x18F, /* Selector */
+ kHIDUsage_Csmr_ALLogOrJournalOrTimecard = 0x190, /* Selector */
+ kHIDUsage_Csmr_ALCheckbookOrFinance = 0x191, /* Selector */
+ kHIDUsage_Csmr_ALCalculator = 0x192, /* Selector */
+ kHIDUsage_Csmr_ALAOrVCaptureOrPlayback = 0x193, /* Selector */
+ kHIDUsage_Csmr_ALLocalMachineBrowser = 0x194, /* Selector */
+ kHIDUsage_Csmr_ALLANOrWANBrowser = 0x195, /* Selector */
+ kHIDUsage_Csmr_ALInternetBrowser = 0x196, /* Selector */
+ kHIDUsage_Csmr_ALRemoteNetworkingOrISPConnect = 0x197, /* Selector */
+ kHIDUsage_Csmr_ALNetworkConference = 0x198, /* Selector */
+ kHIDUsage_Csmr_ALNetworkChat = 0x199, /* Selector */
+ kHIDUsage_Csmr_ALTelephonyOrDialer = 0x19A, /* Selector */
+ kHIDUsage_Csmr_ALLogon = 0x19B, /* Selector */
+ kHIDUsage_Csmr_ALLogoff = 0x19C, /* Selector */
+ kHIDUsage_Csmr_ALLogonOrLogoff = 0x19D, /* Selector */
+ kHIDUsage_Csmr_ALTerminalLockOrScreensaver = 0x19E, /* Selector */
+ kHIDUsage_Csmr_ALControlPanel = 0x19F, /* Selector */
+ kHIDUsage_Csmr_ALCommandLineProcessorOrRun = 0x1A0, /* Selector */
+ kHIDUsage_Csmr_ALProcessOrTaskManager = 0x1A1, /* Selector */
+ kHIDUsage_Csmr_AL = 0x1A2, /* Selector */
+ kHIDUsage_Csmr_ALNextTaskOrApplication = 0x1A3, /* Selector */
+ kHIDUsage_Csmr_ALPreviousTaskOrApplication = 0x1A4, /* Selector */
+ kHIDUsage_Csmr_ALPreemptiveHaltTaskOrApplication = 0x1A5, /* Selector */
+ kHIDUsage_Csmr_ALIntegratedHelpCenter = 0x1A6, /* Selector */
+ kHIDUsage_Csmr_ALDocuments = 0x1A7, /* Selector */
+ kHIDUsage_Csmr_ALThesaurus = 0x1A8, /* Selector */
+ kHIDUsage_Csmr_ALDictionary = 0x1A9, /* Selector */
+ kHIDUsage_Csmr_ALDesktop = 0x1AA, /* Selector */
+ kHIDUsage_Csmr_ALSpellCheck = 0x1AB, /* Selector */
+ kHIDUsage_Csmr_ALGrammerCheck = 0x1AC, /* Selector */
+ kHIDUsage_Csmr_ALWirelessStatus = 0x1AD, /* Selector */
+ kHIDUsage_Csmr_ALKeyboardLayout = 0x1AE, /* Selector */
+ kHIDUsage_Csmr_ALVirusProtection = 0x1AF, /* Selector */
+ kHIDUsage_Csmr_ALEncryption = 0x1B0, /* Selector */
+ kHIDUsage_Csmr_ALScreenSaver = 0x1B1, /* Selector */
+ kHIDUsage_Csmr_ALAlarms = 0x1B2, /* Selector */
+ kHIDUsage_Csmr_ALClock = 0x1B3, /* Selector */
+ kHIDUsage_Csmr_ALFileBrowser = 0x1B4, /* Selector */
+ kHIDUsage_Csmr_ALPowerStatus = 0x1B5, /* Selector */
+ kHIDUsage_Csmr_ALImageBrowser = 0x1B6, /* Selector */
+ kHIDUsage_Csmr_ALAudioBrowser = 0x1B7, /* Selector */
+ kHIDUsage_Csmr_ALMovieBrowser = 0x1B8, /* Selector */
+ kHIDUsage_Csmr_ALDigitalRightsManager = 0x1B9, /* Selector */
+ kHIDUsage_Csmr_ALDigitalWallet = 0x1BA, /* Selector */
+ /* 0x1BB Reserved */
+ kHIDUsage_Csmr_ALInstantMessaging = 0x1BC, /* Selector */
+ kHIDUsage_Csmr_ALOEMFeatureBrowser = 0x1BD, /* Selector */
+ kHIDUsage_Csmr_ALOEMHelp = 0x1BE, /* Selector */
+ kHIDUsage_Csmr_ALOnlineCommunity = 0x1BF, /* Selector */
+ kHIDUsage_Csmr_ALEntertainmentContentBrowser = 0x1C0, /* Selector */
+ kHIDUsage_Csmr_ALOnlineShoppingBrowswer = 0x1C1, /* Selector */
+ kHIDUsage_Csmr_ALSmartCardInformationOrHelp = 0x1C2, /* Selector */
+ kHIDUsage_Csmr_ALMarketMonitorOrFinanceBrowser = 0x1C3, /* Selector */
+ kHIDUsage_Csmr_ALCustomizedCorporateNewsBrowser = 0x1C4, /* Selector */
+ kHIDUsage_Csmr_ALOnlineActivityBrowswer= 0x1C5, /* Selector */
+ kHIDUsage_Csmr_ALResearchOrSearchBrowswer = 0x1C6, /* Selector */
+ kHIDUsage_Csmr_ALAudioPlayer= 0x1C7, /* Selector */
+ kHIDUsage_Csmr_ALNavigation = 0x1C8, /* Selector */
+ /* 0x1C9 - 0x1FF Reserved */
+ kHIDUsage_Csmr_GenericGUIApplicationControls = 0x200, /* Named Array */
+ kHIDUsage_Csmr_ACNew = 0x201, /* Selector */
+ kHIDUsage_Csmr_ACOpen = 0x202, /* Selector */
+ kHIDUsage_Csmr_ACClose = 0x203, /* Selector */
+ kHIDUsage_Csmr_ACExit = 0x204, /* Selector */
+ kHIDUsage_Csmr_ACMaximize = 0x205, /* Selector */
+ kHIDUsage_Csmr_ACMinimize = 0x206, /* Selector */
+ kHIDUsage_Csmr_ACSave = 0x207, /* Selector */
+ kHIDUsage_Csmr_ACPrint = 0x208, /* Selector */
+ kHIDUsage_Csmr_ACProperties = 0x209, /* Selector */
+ kHIDUsage_Csmr_ACUndo = 0x21A, /* Selector */
+ kHIDUsage_Csmr_ACCopy = 0x21B, /* Selector */
+ kHIDUsage_Csmr_ACCut = 0x21C, /* Selector */
+ kHIDUsage_Csmr_ACPaste = 0x21D, /* Selector */
+ kHIDUsage_Csmr_AC = 0x21E, /* Selector */
+ kHIDUsage_Csmr_ACFind = 0x21F, /* Selector */
+ kHIDUsage_Csmr_ACFindandReplace = 0x220, /* Selector */
+ kHIDUsage_Csmr_ACSearch = 0x221, /* Selector */
+ kHIDUsage_Csmr_ACGoTo = 0x222, /* Selector */
+ kHIDUsage_Csmr_ACHome = 0x223, /* Selector */
+ kHIDUsage_Csmr_ACBack = 0x224, /* Selector */
+ kHIDUsage_Csmr_ACForward = 0x225, /* Selector */
+ kHIDUsage_Csmr_ACStop = 0x226, /* Selector */
+ kHIDUsage_Csmr_ACRefresh = 0x227, /* Selector */
+ kHIDUsage_Csmr_ACPreviousLink = 0x228, /* Selector */
+ kHIDUsage_Csmr_ACNextLink = 0x229, /* Selector */
+ kHIDUsage_Csmr_ACBookmarks = 0x22A, /* Selector */
+ kHIDUsage_Csmr_ACHistory = 0x22B, /* Selector */
+ kHIDUsage_Csmr_ACSubscriptions = 0x22C, /* Selector */
+ kHIDUsage_Csmr_ACZoomIn = 0x22D, /* Selector */
+ kHIDUsage_Csmr_ACZoomOut = 0x22E, /* Selector */
+ kHIDUsage_Csmr_ACZoom = 0x22F, /* Selector */
+ kHIDUsage_Csmr_ACFullScreenView = 0x230, /* Selector */
+ kHIDUsage_Csmr_ACNormalView = 0x231, /* Selector */
+ kHIDUsage_Csmr_ACViewToggle = 0x232, /* Selector */
+ kHIDUsage_Csmr_ACScrollUp = 0x233, /* Selector */
+ kHIDUsage_Csmr_ACScrollDown = 0x234, /* Selector */
+ kHIDUsage_Csmr_ACScroll = 0x235, /* Selector */
+ kHIDUsage_Csmr_ACPanLeft = 0x236, /* Selector */
+ kHIDUsage_Csmr_ACPanRight = 0x237, /* Selector */
+ kHIDUsage_Csmr_ACPan = 0x238, /* Selector */
+ kHIDUsage_Csmr_ACNewWindow = 0x239, /* Selector */
+ kHIDUsage_Csmr_ACTileHorizontally = 0x23A, /* Selector */
+ kHIDUsage_Csmr_ACTileVertically = 0x23B, /* Selector */
+ kHIDUsage_Csmr_ACFormat = 0x23C, /* Selector */
+ kHIDUsage_Csmr_ACEdit = 0x23D, /* Selector */
+ kHIDUsage_Csmr_ACBold = 0x23E, /* Selector */
+ kHIDUsage_Csmr_ACItalics = 0x23F, /* Selector */
+ kHIDUsage_Csmr_ACUnderline = 0x240, /* Selector */
+ kHIDUsage_Csmr_ACStrikethrough = 0x241, /* Selector */
+ kHIDUsage_Csmr_ACSubscript = 0x242, /* Selector */
+ kHIDUsage_Csmr_ACSuperscript = 0x243, /* Selector */
+ kHIDUsage_Csmr_ACAllCaps = 0x244, /* Selector */
+ kHIDUsage_Csmr_ACRotate = 0x245, /* Selector */
+ kHIDUsage_Csmr_ACResize = 0x246, /* Selector */
+ kHIDUsage_Csmr_ACFlipHorizontal = 0x247, /* Selector */
+ kHIDUsage_Csmr_ACFlipVertical = 0x248, /* Selector */
+ kHIDUsage_Csmr_ACMirrorHorizontal = 0x249, /* Selector */
+ kHIDUsage_Csmr_ACMirrorVertical = 0x24A, /* Selector */
+ kHIDUsage_Csmr_ACFontSelect = 0x24B, /* Selector */
+ kHIDUsage_Csmr_ACFontColor = 0x24C, /* Selector */
+ kHIDUsage_Csmr_ACFontSize = 0x24D, /* Selector */
+ kHIDUsage_Csmr_ACJustifyLeft = 0x24E, /* Selector */
+ kHIDUsage_Csmr_ACJustifyCenterH = 0x24F, /* Selector */
+ kHIDUsage_Csmr_ACJustifyRight = 0x250, /* Selector */
+ kHIDUsage_Csmr_ACJustifyBlockH = 0x251, /* Selector */
+ kHIDUsage_Csmr_ACJustifyTop = 0x252, /* Selector */
+ kHIDUsage_Csmr_ACJustifyCenterV = 0x253, /* Selector */
+ kHIDUsage_Csmr_ACJustifyBottom = 0x254, /* Selector */
+ kHIDUsage_Csmr_ACJustifyBlockV = 0x255, /* Selector */
+ kHIDUsage_Csmr_ACIndentyDecrease = 0x256, /* Selector */
+ kHIDUsage_Csmr_ACIndentyIncrease = 0x257, /* Selector */
+ kHIDUsage_Csmr_ACNumberedList = 0x258, /* Selector */
+ kHIDUsage_Csmr_ACRestartNumbering = 0x259, /* Selector */
+ kHIDUsage_Csmr_ACBulletedList = 0x25A, /* Selector */
+ kHIDUsage_Csmr_ACPromote = 0x25B, /* Selector */
+ kHIDUsage_Csmr_ACDemote = 0x25C, /* Selector */
+ kHIDUsage_Csmr_ACYes = 0x25D, /* Selector */
+ kHIDUsage_Csmr_ACNo = 0x25E, /* Selector */
+ kHIDUsage_Csmr_ACCancel = 0x25F, /* Selector */
+ kHIDUsage_Csmr_ACCatalog = 0x260, /* Selector */
+ kHIDUsage_Csmr_ACBuyOrCheckout = 0x261, /* Selector */
+ kHIDUsage_Csmr_ACAddToCart = 0x262, /* Selector */
+ kHIDUsage_Csmr_ACExpand = 0x263, /* Selector */
+ kHIDUsage_Csmr_ACExpandAll = 0x264, /* Selector */
+ kHIDUsage_Csmr_ACCollapse = 0x265, /* Selector */
+ kHIDUsage_Csmr_ACCollapseAll = 0x266, /* Selector */
+ kHIDUsage_Csmr_ACPrintPreview = 0x267, /* Selector */
+ kHIDUsage_Csmr_ACPasteSpecial = 0x268, /* Selector */
+ kHIDUsage_Csmr_ACInsertMode = 0x269, /* Selector */
+ kHIDUsage_Csmr_ACDelete = 0x26A, /* Selector */
+ kHIDUsage_Csmr_ACLock = 0x26B, /* Selector */
+ kHIDUsage_Csmr_ACUnlock = 0x26C, /* Selector */
+ kHIDUsage_Csmr_ACProtect = 0x26D, /* Selector */
+ kHIDUsage_Csmr_ACUnprotect = 0x26E, /* Selector */
+ kHIDUsage_Csmr_ACAttachComment = 0x26F, /* Selector */
+ kHIDUsage_Csmr_ACDetachComment = 0x270, /* Selector */
+ kHIDUsage_Csmr_ACViewComment = 0x271, /* Selector */
+ kHIDUsage_Csmr_ACSelectWord = 0x272, /* Selector */
+ kHIDUsage_Csmr_ACSelectSentence = 0x273, /* Selector */
+ kHIDUsage_Csmr_ACSelectParagraph = 0x274, /* Selector */
+ kHIDUsage_Csmr_ACSelectColumn = 0x275, /* Selector */
+ kHIDUsage_Csmr_ACSelectRow = 0x276, /* Selector */
+ kHIDUsage_Csmr_ACSelectTable = 0x277, /* Selector */
+ kHIDUsage_Csmr_ACSelectObject = 0x278, /* Selector */
+ kHIDUsage_Csmr_ACRedoOrRepeat = 0x279, /* Selector */
+ kHIDUsage_Csmr_ACSort = 0x27A, /* Selector */
+ kHIDUsage_Csmr_ACSortAscending = 0x27B, /* Selector */
+ kHIDUsage_Csmr_ACSortDescending = 0x27C, /* Selector */
+ kHIDUsage_Csmr_ACFilter = 0x27D, /* Selector */
+ kHIDUsage_Csmr_ACSetClock = 0x27E, /* Selector */
+ kHIDUsage_Csmr_ACViewClock = 0x27F, /* Selector */
+ kHIDUsage_Csmr_ACSelectTimeZone = 0x280, /* Selector */
+ kHIDUsage_Csmr_ACEditTimeZones = 0x281, /* Selector */
+ kHIDUsage_Csmr_ACSetAlarm = 0x282, /* Selector */
+ kHIDUsage_Csmr_ACClearAlarm = 0x283, /* Selector */
+ kHIDUsage_Csmr_ACSnoozeAlarm = 0x284, /* Selector */
+ kHIDUsage_Csmr_ACResetAlarm = 0x285, /* Selector */
+ kHIDUsage_Csmr_ACSynchronize = 0x286, /* Selector */
+ kHIDUsage_Csmr_ACSendOrReceive = 0x287, /* Selector */
+ kHIDUsage_Csmr_ACSendTo = 0x288, /* Selector */
+ kHIDUsage_Csmr_ACReply = 0x289, /* Selector */
+ kHIDUsage_Csmr_ACReplyAll = 0x28A, /* Selector */
+ kHIDUsage_Csmr_ACForwardMessage = 0x28B, /* Selector */
+ kHIDUsage_Csmr_ACSend = 0x28C, /* Selector */
+ kHIDUsage_Csmr_ACAttachFile = 0x28D, /* Selector */
+ kHIDUsage_Csmr_ACUpload = 0x28E, /* Selector */
+ kHIDUsage_Csmr_ACDownload = 0x28F, /* Selector */
+ kHIDUsage_Csmr_ACSetBorders = 0x290, /* Selector */
+ kHIDUsage_Csmr_ACInsertRow = 0x291, /* Selector */
+ kHIDUsage_Csmr_ACInsertColumn = 0x292, /* Selector */
+ kHIDUsage_Csmr_ACInsertFile = 0x293, /* Selector */
+ kHIDUsage_Csmr_ACInsertPicture = 0x294, /* Selector */
+ kHIDUsage_Csmr_ACInsertObject = 0x295, /* Selector */
+ kHIDUsage_Csmr_ACInsertSymbol = 0x296, /* Selector */
+ kHIDUsage_Csmr_ACSaveAndClose = 0x297, /* Selector */
+ kHIDUsage_Csmr_ACRename = 0x298, /* Selector */
+ kHIDUsage_Csmr_ACMerge = 0x299, /* Selector */
+ kHIDUsage_Csmr_ACSplit = 0x29A, /* Selector */
+ kHIDUsage_Csmr_ACDistributeH = 0x29B, /* Selector */
+ kHIDUsage_Csmr_ACDistributeV = 0x29C, /* Selector */
+ kHIDUsage_Csmr_ACKeyboardLayoutSelect = 0x29D, /* One-Shot Control */
+ kHIDUsage_Csmr_ACNavigationGuidance = 0x29E, /* Selector */
+ kHIDUsage_Csmr_ACDesktopShowAllWindows = 0x29F, /* Selector */
+ kHIDUsage_Csmr_ACDesktopShowAllApplications = 0x2A0, /* Selector */
+ /* 0x2A1 - 0xFFFF Reserved */
+ kHIDUsage_Csmr_Reserved = 0xFFFF
+};
+
+/* Digitizer Page (0x0D) */
+/* This section provides detailed descriptions of the usages employed by Digitizer Devices. */
+enum
+{
+ kHIDUsage_Dig_Digitizer = 0x01, /* Application Collection */
+ kHIDUsage_Dig_Pen = 0x02, /* Application Collection */
+ kHIDUsage_Dig_LightPen = 0x03, /* Application Collection */
+ kHIDUsage_Dig_TouchScreen = 0x04, /* Application Collection */
+ kHIDUsage_Dig_TouchPad = 0x05, /* Application Collection */
+ kHIDUsage_Dig_WhiteBoard = 0x06, /* Application Collection */
+ kHIDUsage_Dig_CoordinateMeasuringMachine = 0x07, /* Application Collection */
+ kHIDUsage_Dig_3DDigitizer = 0x08, /* Application Collection */
+ kHIDUsage_Dig_StereoPlotter = 0x09, /* Application Collection */
+ kHIDUsage_Dig_ArticulatedArm = 0x0A, /* Application Collection */
+ kHIDUsage_Dig_Armature = 0x0B, /* Application Collection */
+ kHIDUsage_Dig_MultiplePointDigitizer = 0x0C, /* Application Collection */
+ kHIDUsage_Dig_FreeSpaceWand = 0x0D, /* Application Collection */
+ kHIDUsage_Dig_DeviceConfiguration = 0x0E, /* Application Collection */
+ /* 0x0F - 0x1F Reserved */
+ kHIDUsage_Dig_Stylus = 0x20, /* Logical Collection */
+ kHIDUsage_Dig_Puck = 0x21, /* Logical Collection */
+ kHIDUsage_Dig_Finger = 0x22, /* Logical Collection */
+ kHIDUsage_Dig_DeviceSettings = 0x23, /* Logical Collection */
+ kHIDUsage_Dig_GestureCharacter = 0x24, /* Logical Collection */
+ /* 0x25 - 0x2F Reserved */
+ kHIDUsage_Dig_TipPressure = 0x30, /* Dynamic Value */
+ kHIDUsage_Dig_BarrelPressure = 0x31, /* Dynamic Value */
+ kHIDUsage_Dig_InRange = 0x32, /* Momentary Control */
+ kHIDUsage_Dig_Touch = 0x33, /* Momentary Control */
+ kHIDUsage_Dig_Untouch = 0x34, /* One-Shot Control */
+ kHIDUsage_Dig_Tap = 0x35, /* One-Shot Control */
+ kHIDUsage_Dig_Quality = 0x36, /* Dynamic Value */
+ kHIDUsage_Dig_DataValid = 0x37, /* Momentary Control */
+ kHIDUsage_Dig_TransducerIndex = 0x38, /* Dynamic Value */
+ kHIDUsage_Dig_TabletFunctionKeys = 0x39, /* Logical Collection */
+ kHIDUsage_Dig_ProgramChangeKeys = 0x3A, /* Logical Collection */
+ kHIDUsage_Dig_BatteryStrength = 0x3B, /* Dynamic Value */
+ kHIDUsage_Dig_Invert = 0x3C, /* Momentary Control */
+ kHIDUsage_Dig_XTilt = 0x3D, /* Dynamic Value */
+ kHIDUsage_Dig_YTilt = 0x3E, /* Dynamic Value */
+ kHIDUsage_Dig_Azimuth = 0x3F, /* Dynamic Value */
+ kHIDUsage_Dig_Altitude = 0x40, /* Dynamic Value */
+ kHIDUsage_Dig_Twist = 0x41, /* Dynamic Value */
+ kHIDUsage_Dig_TipSwitch = 0x42, /* Momentary Control */
+ kHIDUsage_Dig_SecondaryTipSwitch = 0x43, /* Momentary Control */
+ kHIDUsage_Dig_BarrelSwitch = 0x44, /* Momentary Control */
+ kHIDUsage_Dig_Eraser = 0x45, /* Momentary Control */
+ kHIDUsage_Dig_TabletPick = 0x46, /* Momentary Control */
+ kHIDUsage_Dig_TouchValid = 0x47, /* Momentary Control */
+ kHIDUsage_Dig_Width = 0x48, /* Dynamic Value */
+ kHIDUsage_Dig_Height = 0x49, /* Dynamic Value */
+ /* 0x4A - 0x50 Reserved */
+ kHIDUsage_Dig_ContactIdentifier = 0x51, /* Dynamic Value */
+ kHIDUsage_Dig_DeviceMode = 0x52, /* Dynamic Value */
+ kHIDUsage_Dig_DeviceIdentifier = 0x53, /* Dynamic Value */
+ kHIDUsage_Dig_ContactCount = 0x54, /* Dynamic Value */
+ kHIDUsage_Dig_ContactCountMaximum = 0x55, /* Static Value */
+ kHIDUsage_Dig_RelativeScanTime = 0x56, /* Dynamic Value */
+ kHIDUsage_Dig_SurfaceSwitch = 0x57, /* Dynamic Flag */
+
+ /* 0x56 - 0x5F Reserved */
+ kHIDUsage_Dig_GestureCharacterEnable = 0x60, /* Dynamic Flag */
+ kHIDUsage_Dig_GestureCharacterQuality = 0x61, /* Dynamic Value */
+ kHIDUsage_Dig_GestureCharacterDataLength = 0x62, /* Dynamic Value */
+ kHIDUsage_Dig_GestureCharacterData = 0x63, /* Buffered Bytes */
+ kHIDUsage_Dig_GestureCharacterEncoding = 0x64, /* Named Array */
+ kHIDUsage_Dig_GestureCharacterEncodingUTF8 = 0x65, /* Selector */
+ kHIDUsage_Dig_GestureCharacterEncodingUTF16LE = 0x66, /* Selector */
+ kHIDUsage_Dig_GestureCharacterEncodingUTF16BE = 0x67, /* Selector */
+ kHIDUsage_Dig_GestureCharacterEncodingUTF32LE = 0x68, /* Selector */
+ kHIDUsage_Dig_GestureCharacterEncodingUTF32BE = 0x69, /* Selector */
+
+ kHIDUsage_Dig_ReportRate = 0xA1, /* Dynamic Value */
+
+ /* 0x70 - 0xFFFF Reserved */
+ kHIDUsage_Dig_Reserved = 0xFFFF
+};
+
+/* Physical Interface Device Page (0x0F) */
+/* This section provides detailed descriptions of the usages employed by Power Devices. */
+enum
+{
+ kHIDUsage_PID_PhysicalInterfaceDevice = 0x01, /* CA - A collection of PID usages */
+ /* 0x02 - 0x1F Reserved */
+ kHIDUsage_PID_Normal = 0x20, /* DV - A force applied perpendicular to the surface of an object */
+ kHIDUsage_PID_SetEffectReport = 0x21, /* XXX */
+ kHIDUsage_PID_EffectBlockIndex = 0x22, /* XXX */
+ kHIDUsage_PID_ParamBlockOffset = 0x23, /* XXX */
+ kHIDUsage_PID_ROM_Flag = 0x24, /* XXX */
+ kHIDUsage_PID_EffectType = 0x25, /* XXX */
+ kHIDUsage_PID_ET_ConstantForce = 0x26, /* XXX */
+ kHIDUsage_PID_ET_Ramp = 0x27, /* XXX */
+ kHIDUsage_PID_ET_CustomForceData = 0x28, /* XXX */
+ /* 0x29 - 0x2F Reserved */
+ kHIDUsage_PID_ET_Square = 0x30, /* XXX */
+ kHIDUsage_PID_ET_Sine = 0x31, /* XXX */
+ kHIDUsage_PID_ET_Triangle = 0x32, /* XXX */
+ kHIDUsage_PID_ET_SawtoothUp = 0x33, /* XXX */
+ kHIDUsage_PID_ET_SawtoothDown = 0x34, /* XXX */
+ /* 0x35 - 0x3F Reserved */
+ kHIDUsage_PID_ET_Spring = 0x40, /* XXX */
+ kHIDUsage_PID_ET_Damper = 0x41, /* XXX */
+ kHIDUsage_PID_ET_Inertia = 0x42, /* XXX */
+ kHIDUsage_PID_ET_Friction = 0x43, /* XXX */
+ /* 0x44 - 0x4F Reserved */
+ kHIDUsage_PID_Duration = 0x50, /* XXX */
+ kHIDUsage_PID_SamplePeriod = 0x51, /* XXX */
+ kHIDUsage_PID_Gain = 0x52, /* XXX */
+ kHIDUsage_PID_TriggerButton = 0x53, /* XXX */
+ kHIDUsage_PID_TriggerRepeatInterval = 0x54, /* XXX */
+ kHIDUsage_PID_AxesEnable = 0x55, /* XXX */
+ kHIDUsage_PID_DirectionEnable = 0x56, /* XXX */
+ kHIDUsage_PID_Direction = 0x57, /* XXX */
+ kHIDUsage_PID_TypeSpecificBlockOffset = 0x58, /* XXX */
+ kHIDUsage_PID_BlockType = 0x59, /* XXX */
+ kHIDUsage_PID_SetEnvelopeReport = 0x5A, /* XXX */
+ kHIDUsage_PID_AttackLevel = 0x5B, /* XXX */
+ kHIDUsage_PID_AttackTime = 0x5C, /* XXX */
+ kHIDUsage_PID_FadeLevel = 0x5D, /* XXX */
+ kHIDUsage_PID_FadeTime = 0x5E, /* XXX */
+ kHIDUsage_PID_SetConditionReport = 0x5F, /* XXX */
+
+ kHIDUsage_PID_CP_Offset = 0x60, /* XXX */
+ kHIDUsage_PID_PositiveCoefficient = 0x61, /* XXX */
+ kHIDUsage_PID_NegativeCoefficient = 0x62, /* XXX */
+ kHIDUsage_PID_PositiveSaturation = 0x63, /* XXX */
+ kHIDUsage_PID_NegativeSaturation = 0x64, /* XXX */
+ kHIDUsage_PID_DeadBand = 0x65, /* XXX */
+ kHIDUsage_PID_DownloadForceSample = 0x66, /* XXX */
+ kHIDUsage_PID_IsochCustomForceEnable = 0x67, /* XXX */
+ kHIDUsage_PID_CustomForceDataReport = 0x68, /* XXX */
+ kHIDUsage_PID_CustomForceData = 0x69, /* XXX */
+ kHIDUsage_PID_CustomForceVendorDefinedData = 0x6A, /* XXX */
+ kHIDUsage_PID_SetCustomForceReport = 0x6B, /* XXX */
+ kHIDUsage_PID_CustomForceDataOffset = 0x6C, /* XXX */
+ kHIDUsage_PID_SampleCount = 0x6D, /* XXX */
+ kHIDUsage_PID_SetPeriodicReport = 0x6E, /* XXX */
+ kHIDUsage_PID_Offset = 0x6F, /* XXX */
+
+ kHIDUsage_PID_Magnitude = 0x70, /* XXX */
+ kHIDUsage_PID_Phase = 0x71, /* XXX */
+ kHIDUsage_PID_Period = 0x72, /* XXX */
+ kHIDUsage_PID_SetConstantForceReport = 0x73, /* XXX */
+ kHIDUsage_PID_SetRampForceReport = 0x74, /* XXX */
+ kHIDUsage_PID_RampStart = 0x75, /* XXX */
+ kHIDUsage_PID_RampEnd = 0x76, /* XXX */
+ kHIDUsage_PID_EffectOperationReport = 0x77, /* XXX */
+ kHIDUsage_PID_EffectOperation = 0x78, /* XXX */
+ kHIDUsage_PID_OpEffectStart = 0x79, /* XXX */
+ kHIDUsage_PID_OpEffectStartSolo = 0x7A, /* XXX */
+ kHIDUsage_PID_OpEffectStop = 0x7B, /* XXX */
+ kHIDUsage_PID_LoopCount = 0x7C, /* XXX */
+ kHIDUsage_PID_DeviceGainReport = 0x7D, /* XXX */
+ kHIDUsage_PID_DeviceGain = 0x7E, /* XXX */
+ kHIDUsage_PID_PoolReport = 0x7F, /* XXX */
+
+ kHIDUsage_PID_RAM_PoolSize = 0x80, /* XXX */
+ kHIDUsage_PID_ROM_PoolSize = 0x81, /* XXX */
+ kHIDUsage_PID_ROM_EffectBlockCount = 0x82, /* XXX */
+ kHIDUsage_PID_SimultaneousEffectsMax = 0x83, /* XXX */
+ kHIDUsage_PID_PoolAlignment = 0x84, /* XXX */
+ kHIDUsage_PID_PoolMoveReport = 0x85, /* XXX */
+ kHIDUsage_PID_MoveSource = 0x86, /* XXX */
+ kHIDUsage_PID_MoveDestination = 0x87, /* XXX */
+ kHIDUsage_PID_MoveLength = 0x88, /* XXX */
+ kHIDUsage_PID_BlockLoadReport = 0x89, /* XXX */
+ /* 0x8A Reserved */
+ kHIDUsage_PID_BlockLoadStatus = 0x8B, /* XXX */
+ kHIDUsage_PID_BlockLoadSuccess = 0x8C, /* XXX */
+ kHIDUsage_PID_BlockLoadFull = 0x8D, /* XXX */
+ kHIDUsage_PID_BlockLoadError = 0x8E, /* XXX */
+ kHIDUsage_PID_BlockHandle = 0x8F, /* XXX */
+
+ kHIDUsage_PID_BlockFreeReport = 0x90, /* XXX */
+ kHIDUsage_PID_TypeSpecificBlockHandle = 0x91, /* XXX */
+ kHIDUsage_PID_StateReport = 0x92, /* XXX */
+ /* 0x93 Reserved */
+ kHIDUsage_PID_EffectPlaying = 0x94, /* XXX */
+ kHIDUsage_PID_DeviceControlReport = 0x95, /* XXX */
+ kHIDUsage_PID_DeviceControl = 0x96, /* XXX */
+ kHIDUsage_PID_DC_EnableActuators = 0x97, /* XXX */
+ kHIDUsage_PID_DC_DisableActuators = 0x98, /* XXX */
+ kHIDUsage_PID_DC_StopAllEffects = 0x99, /* XXX */
+ kHIDUsage_PID_DC_DeviceReset = 0x9A, /* XXX */
+ kHIDUsage_PID_DC_DevicePause = 0x9B, /* XXX */
+ kHIDUsage_PID_DC_DeviceContinue = 0x9C, /* XXX */
+ /* 0x9d - 0x9E Reserved */
+ kHIDUsage_PID_DevicePaused = 0x9F, /* XXX */
+
+ kHIDUsage_PID_ActuatorsEnabled = 0xA0, /* XXX */
+ /* 0xA1 - 0xA3 Reserved */
+ kHIDUsage_PID_SafetySwitch = 0xA4, /* XXX */
+ kHIDUsage_PID_ActuatorOverrideSwitch = 0xA5, /* XXX */
+ kHIDUsage_PID_ActuatorPower = 0xA6, /* XXX */
+ kHIDUsage_PID_StartDelay = 0xA7, /* XXX */
+ kHIDUsage_PID_ParameterBlockSize = 0xA8, /* XXX */
+ kHIDUsage_PID_DeviceManagedPool = 0xA9, /* XXX */
+ kHIDUsage_PID_SharedParameterBlocks = 0xAA, /* XXX */
+ kHIDUsage_PID_CreateNewEffectReport = 0xAB, /* XXX */
+ kHIDUsage_PID_RAM_PoolAvailable = 0xAC, /* XXX */
+ /* 0xAD - 0xFFFF Reserved */
+ kHIDUsage_PID_Reserved = 0xFFFF
+};
+
+/* AlphanumericDisplay Page (0x14) */
+/* The Alphanumeric Display page is intended for use by simple alphanumeric displays that are used on consumer devices. */
+enum
+{
+ kHIDUsage_AD_AlphanumericDisplay = 0x01, /* Application Collection */
+ /* 0x02 - 0x1F Reserved */
+ kHIDUsage_AD_DisplayAttributesReport = 0x20, /* Logical Collection */
+ kHIDUsage_AD_ASCIICharacterSet = 0x21, /* Static Flag */
+ kHIDUsage_AD_DataReadBack = 0x22, /* Static Flag */
+ kHIDUsage_AD_FontReadBack = 0x23, /* Static Flag */
+ kHIDUsage_AD_DisplayControlReport = 0x24, /* Logical Collection */
+ kHIDUsage_AD_ClearDisplay = 0x25, /* Dynamic Flag */
+ kHIDUsage_AD_DisplayEnable = 0x26, /* Dynamic Flag */
+ kHIDUsage_AD_ScreenSaverDelay = 0x27, /* Static Value */
+ kHIDUsage_AD_ScreenSaverEnable = 0x28, /* Dynamic Flag */
+ kHIDUsage_AD_VerticalScroll = 0x29, /* Static Flag */
+ kHIDUsage_AD_HorizontalScroll = 0x2A, /* Static Flag */
+ kHIDUsage_AD_CharacterReport = 0x2B, /* Logical Collection */
+ kHIDUsage_AD_DisplayData = 0x2C, /* Dynamic Value */
+ kHIDUsage_AD_DisplayStatus = 0x2D, /* Logical Collection */
+ kHIDUsage_AD_StatNotReady = 0x2E, /* Selector */
+ kHIDUsage_AD_StatReady = 0x2F, /* Selector */
+ kHIDUsage_AD_ErrNotaloadablecharacter = 0x30, /* Selector */
+ kHIDUsage_AD_ErrFontdatacannotberead = 0x31, /* Selector */
+ kHIDUsage_AD_CursorPositionReport = 0x32, /* Logical Collection */
+ kHIDUsage_AD_Row = 0x33, /* Dynamic Value */
+ kHIDUsage_AD_Column = 0x34, /* Dynamic Value */
+ kHIDUsage_AD_Rows = 0x35, /* Static Value */
+ kHIDUsage_AD_Columns = 0x36, /* Static Value */
+ kHIDUsage_AD_CursorPixelPositioning = 0x37, /* Static Flag */
+ kHIDUsage_AD_CursorMode = 0x38, /* Dynamic Flag */
+ kHIDUsage_AD_CursorEnable = 0x39, /* Dynamic Flag */
+ kHIDUsage_AD_CursorBlink = 0x3A, /* Dynamic Flag */
+ kHIDUsage_AD_FontReport = 0x3B, /* Logical Collection */
+ kHIDUsage_AD_FontData = 0x3C, /* Buffered Byte */
+ kHIDUsage_AD_CharacterWidth = 0x3D, /* Static Value */
+ kHIDUsage_AD_CharacterHeight = 0x3E, /* Static Value */
+ kHIDUsage_AD_CharacterSpacingHorizontal = 0x3F, /* Static Value */
+ kHIDUsage_AD_CharacterSpacingVertical = 0x40, /* Static Value */
+ kHIDUsage_AD_UnicodeCharacterSet = 0x41, /* Static Flag */
+ /* 0x42 - 0xFFFF Reserved */
+ kHIDUsage_AD_Reserved = 0xFFFF
+};
+
+/* Sensor Page (0x20) */
+/* The Sensor page is intended for use by devices that capture biometric, electrical, environmental, light, location, mechanical, motion, orientation, scanner, etc events. */
+enum
+{
+ kHIDUsage_Snsr_Undefined = 0x00,
+ kHIDUsage_Snsr_Sensor = 0x01, /* Application/Physical Collection */
+ /* 0x02 - 0x0F Reserved */
+ kHIDUsage_Snsr_Biometric = 0x10, /* Application/Physical Collection */
+ kHIDUsage_Snsr_Biometric_HumanPresence = 0x11, /* Application/Physical Collection */
+ kHIDUsage_Snsr_Biometric_HumanProximity = 0x12, /* Application/Physical Collection */
+ kHIDUsage_Snsr_Biometric_HumanTouch = 0x13, /* Application/Physical Collection */
+ /* 0x14 - 0x1F Reserved */
+ kHIDUsage_Snsr_Electrical = 0x20, /* Application/Physical Collection */
+ kHIDUsage_Snsr_Electrical_Capacitance = 0x21, /* Application/Physical Collection */
+ kHIDUsage_Snsr_Electrical_Current = 0x22, /* Application/Physical Collection */
+ kHIDUsage_Snsr_Electrical_Power = 0x23, /* Application/Physical Collection */
+ kHIDUsage_Snsr_Electrical_Inductance = 0x24, /* Application/Physical Collection */
+ kHIDUsage_Snsr_Electrical_Resistance = 0x25, /* Application/Physical Collection */
+ kHIDUsage_Snsr_Electrical_Voltage = 0x26, /* Application/Physical Collection */
+ kHIDUsage_Snsr_Electrical_Potentiometer = 0x27, /* Application/Physical Collection */
+ kHIDUsage_Snsr_Electrical_Frequency = 0x28, /* Application/Physical Collection */
+ kHIDUsage_Snsr_Electrical_Period = 0x29, /* Application/Physical Collection */
+ /* 0x2A - 0x2F Reserved */
+ kHIDUsage_Snsr_Environmental = 0x30, /* Application/Physical Collection */
+ kHIDUsage_Snsr_Environmental_AtmosphericPressure = 0x31, /* Application/Physical Collection */
+ kHIDUsage_Snsr_Environmental_Humidity = 0x32, /* Application/Physical Collection */
+ kHIDUsage_Snsr_Environmental_Temperature = 0x33, /* Application/Physical Collection */
+ kHIDUsage_Snsr_Environmental_WindDirection = 0x34, /* Application/Physical Collection */
+ kHIDUsage_Snsr_Environmental_WindSpeed = 0x35, /* Application/Physical Collection */
+ /* 0x36 - 0x3F Reserved */
+ kHIDUsage_Snsr_Light = 0x40, /* Application/Physical Collection */
+ kHIDUsage_Snsr_Light_AmbientLight = 0x41, /* Application/Physical Collection */
+ kHIDUsage_Snsr_Light_ConsumerInfrared = 0x42, /* Application/Physical Collection */
+ /* 0x43 - 0x4F Reserved */
+ kHIDUsage_Snsr_Location = 0x50, /* Application/Physical Collection */
+ kHIDUsage_Snsr_Location_Broadcast = 0x51, /* Application/Physical Collection */
+ kHIDUsage_Snsr_Location_DeadReckoning = 0x52, /* Application/Physical Collection */
+ kHIDUsage_Snsr_Location_GPS = 0x53, /* Application/Physical Collection */
+ kHIDUsage_Snsr_Location_Lookup = 0x54, /* Application/Physical Collection */
+ kHIDUsage_Snsr_Location_Other = 0x55, /* Application/Physical Collection */
+ kHIDUsage_Snsr_Location_Static = 0x56, /* Application/Physical Collection */
+ kHIDUsage_Snsr_Location_Triangulation = 0x57, /* Application/Physical Collection */
+ /* 0x58 - 0x5F Reserved */
+ kHIDUsage_Snsr_Mechanical = 0x60, /* Application/Physical Collection */
+ kHIDUsage_Snsr_Mechanical_BooleanSwitch = 0x61, /* Application/Physical Collection */
+ kHIDUsage_Snsr_Mechanical_BooleanSwitchArray = 0x62, /* Application/Physical Collection */
+ kHIDUsage_Snsr_Mechanical_MultivalueSwitch = 0x63, /* Application/Physical Collection */
+ kHIDUsage_Snsr_Mechanical_Force = 0x64, /* Application/Physical Collection */
+ kHIDUsage_Snsr_Mechanical_Pressure = 0x65, /* Application/Physical Collection */
+ kHIDUsage_Snsr_Mechanical_Strain = 0x66, /* Application/Physical Collection */
+ kHIDUsage_Snsr_Mechanical_Weight = 0x67, /* Application/Physical Collection */
+ kHIDUsage_Snsr_Mechanical_HapticVibrator = 0x68, /* Application/Physical Collection */
+ kHIDUsage_Snsr_Mechanical_HallEffectSwitch = 0x69, /* Application/Physical Collection */
+ /* 0x6A - 0x6F Reserved */
+ kHIDUsage_Snsr_Motion = 0x70, /* Application/Physical Collection */
+ kHIDUsage_Snsr_Motion_Accelerometer1D = 0x71, /* Application/Physical Collection */
+ kHIDUsage_Snsr_Motion_Accelerometer2D = 0x72, /* Application/Physical Collection */
+ kHIDUsage_Snsr_Motion_Accelerometer3D = 0x73, /* Application/Physical Collection */
+ kHIDUsage_Snsr_Motion_Gyrometer1D = 0x74, /* Application/Physical Collection */
+ kHIDUsage_Snsr_Motion_Gyrometer2D = 0x75, /* Application/Physical Collection */
+ kHIDUsage_Snsr_Motion_Gyrometer3D = 0x76, /* Application/Physical Collection */
+ kHIDUsage_Snsr_Motion_MotionDetector = 0x77, /* Application/Physical Collection */
+ kHIDUsage_Snsr_Motion_Speedometer = 0x78, /* Application/Physical Collection */
+ kHIDUsage_Snsr_Motion_Accelerometer = 0x79, /* Application/Physical Collection */
+ kHIDUsage_Snsr_Motion_Gyrometer = 0x7A, /* Application/Physical Collection */
+ /* 0x7B - 0x7F Reserved */
+ kHIDUsage_Snsr_Orientation = 0x80, /* Application/Physical Collection */
+ kHIDUsage_Snsr_Orientation_Compass1D = 0x81, /* Application/Physical Collection */
+ kHIDUsage_Snsr_Orientation_Compass2D = 0x82, /* Application/Physical Collection */
+ kHIDUsage_Snsr_Orientation_Compass3D = 0x83, /* Application/Physical Collection */
+ kHIDUsage_Snsr_Orientation_Inclinometer1D = 0x84, /* Application/Physical Collection */
+ kHIDUsage_Snsr_Orientation_Inclinometer2D = 0x85, /* Application/Physical Collection */
+ kHIDUsage_Snsr_Orientation_Inclinometer3D = 0x86, /* Application/Physical Collection */
+ kHIDUsage_Snsr_Orientation_Distance1D = 0x87, /* Application/Physical Collection */
+ kHIDUsage_Snsr_Orientation_Distance2D = 0x88, /* Application/Physical Collection */
+ kHIDUsage_Snsr_Orientation_Distance3D = 0x89, /* Application/Physical Collection */
+ kHIDUsage_Snsr_Orientation_DeviceOrientation = 0x8A, /* Application/Physical Collection */
+ kHIDUsage_Snsr_Orientation_CompassD = 0x8B, /* Application/Physical Collection */
+ kHIDUsage_Snsr_Orientation_InclinometerD = 0x8C, /* Application/Physical Collection */
+ kHIDUsage_Snsr_Orientation_DistanceD = 0x8D, /* Application/Physical Collection */
+ /* 0x8E - 0x8F Reserved */
+ kHIDUsage_Snsr_Scanner = 0x90, /* Application/Physical Collection */
+ kHIDUsage_Snsr_Scanner_Barcode = 0x91, /* Application/Physical Collection */
+ kHIDUsage_Snsr_Scanner_RFID = 0x92, /* Application/Physical Collection */
+ kHIDUsage_Snsr_Scanner_NFC = 0x93, /* Application/Physical Collection */
+ /* 0x94 - 0x9F Reserved */
+ kHIDUsage_Snsr_Time = 0xA0, /* Application/Physical Collection */
+ kHIDUsage_Snsr_Time_AlarmTimer = 0xA1, /* Application/Physical Collection */
+ kHIDUsage_Snsr_Time_RealTimeClock = 0xA2, /* Application/Physical Collection */
+ /* 0xA3 - 0xDF Reserved */
+ kHIDUsage_Snsr_Other = 0xE0, /* Application/Physical Collection */
+ kHIDUsage_Snsr_Other_Custom = 0xE1, /* Application/Physical Collection */
+ kHIDUsage_Snsr_Other_Generic = 0xE2, /* Application/Physical Collection */
+ kHIDUsage_Snsr_Other_GenericEnumerator = 0xE3, /* Application/Physical Collection */
+ /* 0xE4 - 0xEF Reserved */
+ /* 0xF0 - 0xFF Vendor Reserved */
+
+ /* Common Sensor Type Data Fields */
+
+ /* Usage Switches used in conjunction with other Data Usages. The value of the modifier is OR-ed in to the upper nibble of the 16bit Data Usage. */
+ kHIDUsage_Snsr_Modifier_None = 0x0, /* Data Field Usage Switch */
+ kHIDUsage_Snsr_Modifier_ChangeSensitivityAbsolute = 0x1, /* Data Field Usage Switch */
+ kHIDUsage_Snsr_Modifier_Max = 0x2, /* Data Field Usage Switch */
+ kHIDUsage_Snsr_Modifier_Min = 0x3, /* Data Field Usage Switch */
+ kHIDUsage_Snsr_Modifier_Accuracy = 0x4, /* Data Field Usage Switch */
+ kHIDUsage_Snsr_Modifier_Resolution = 0x5, /* Data Field Usage Switch */
+ kHIDUsage_Snsr_Modifier_ThresholdHigh = 0x6, /* Data Field Usage Switch */
+ kHIDUsage_Snsr_Modifier_ThresholdLow = 0x7, /* Data Field Usage Switch */
+ kHIDUsage_Snsr_Modifier_CalibrationOffset = 0x8, /* Data Field Usage Switch */
+ kHIDUsage_Snsr_Modifier_CalibrationMultiplier = 0x9, /* Data Field Usage Switch */
+ kHIDUsage_Snsr_Modifier_ReportInterval = 0xA, /* Data Field Usage Switch */
+ kHIDUsage_Snsr_Modifier_FrequencyMax = 0xB, /* Data Field Usage Switch */
+ kHIDUsage_Snsr_Modifier_PeriodMax = 0xC, /* Data Field Usage Switch */
+ kHIDUsage_Snsr_Modifier_ChangeSensitivityPercentRange = 0xD, /* Data Field Usage Switch */
+ kHIDUsage_Snsr_Modifier_ChangeSensitivityPercentRelative = 0xE, /* Data Field Usage Switch */
+ kHIDUsage_Snsr_Modifier_VendorDefined = 0xF, /* Data Field Usage Switch */
+
+ /* Event Usages */
+ kHIDUsage_Snsr_Event = 0x0200,
+ kHIDUsage_Snsr_Event_SensorState = 0x0201,
+ kHIDUsage_Snsr_Event_SensorEvent = 0x0202,
+ /* 0x0203 - 0x02FF Event Reserved */
+
+ kHIDUsage_Snsr_Event_SensorState_Undefined = 0x0800,
+ kHIDUsage_Snsr_Event_SensorState_Ready = 0x0801,
+ kHIDUsage_Snsr_Event_SensorState_NotAvailable = 0x0802,
+ kHIDUsage_Snsr_Event_SensorState_NoData = 0x0803,
+ kHIDUsage_Snsr_Event_SensorState_Initializing = 0x0804,
+ kHIDUsage_Snsr_Event_SensorState_AccessDenied = 0x0805,
+ kHIDUsage_Snsr_Event_SensorState_Error = 0x0806,
+ /* 0x0807 - 0x080F Reserved */
+
+ kHIDUsage_Snsr_Event_SensorEvent_Unknown = 0x0810,
+ kHIDUsage_Snsr_Event_SensorEvent_StateChanged = 0x0811,
+ kHIDUsage_Snsr_Event_SensorEvent_PropertyChanged = 0x0812,
+ kHIDUsage_Snsr_Event_SensorEvent_DataUpdated = 0x0813,
+ kHIDUsage_Snsr_Event_SensorEvent_PollResponse = 0x0814,
+ kHIDUsage_Snsr_Event_SensorEvent_ChangeSensitivity = 0x0815,
+ kHIDUsage_Snsr_Event_SensorEvent_RangeMaxReached = 0x0816,
+ kHIDUsage_Snsr_Event_SensorEvent_RangeMinReached = 0x0817,
+ kHIDUsage_Snsr_Event_SensorEvent_HighThresholdCrossUp = 0x0818,
+ kHIDUsage_Snsr_Event_SensorEvent_HighThresholdCrossDown = 0x0819,
+ kHIDUsage_Snsr_Event_SensorEvent_LowThresholdCrossUp = 0x081A,
+ kHIDUsage_Snsr_Event_SensorEvent_LowThresholdCrossDown = 0x081B,
+ kHIDUsage_Snsr_Event_SensorEvent_ZeroThresholdCrossUp = 0x081C,
+ kHIDUsage_Snsr_Event_SensorEvent_ZeroThresholdCrossDown = 0x081D,
+ kHIDUsage_Snsr_Event_SensorEvent_PeriodExceeded = 0x081E,
+ kHIDUsage_Snsr_Event_SensorEvent_FrequencyExceeded = 0x081F,
+ kHIDUsage_Snsr_Event_SensorEvent_ComplexTrigger = 0x0820,
+ /* 0x0821 - 0x082F Reserved */
+
+ /* Property Usages */
+ kHIDUsage_Snsr_Property = 0x0300,
+ kHIDUsage_Snsr_Property_FriendlyName = 0x0301,
+ kHIDUsage_Snsr_Property_PersistentUniqueID = 0x0302,
+ kHIDUsage_Snsr_Property_SensorStatus = 0x0303,
+ kHIDUsage_Snsr_Property_MinimumReportInterval = 0x0304,
+ kHIDUsage_Snsr_Property_Manufacturer = 0x0305,
+ kHIDUsage_Snsr_Property_Model = 0x0306,
+ kHIDUsage_Snsr_Property_SerialNumber = 0x0307,
+ kHIDUsage_Snsr_Property_Description = 0x0308,
+ kHIDUsage_Snsr_Property_ConnectionType = 0x0309,
+ kHIDUsage_Snsr_Property_DevicePath = 0x030A,
+ kHIDUsage_Snsr_Property_HardwareRevision = 0x030B,
+ kHIDUsage_Snsr_Property_FirmwareVersion = 0x030C,
+ kHIDUsage_Snsr_Property_ReleaseData = 0x030D,
+ kHIDUsage_Snsr_Property_ReportInterval = 0x030E,
+ kHIDUsage_Snsr_Property_ChangeSensitivityAbsolute = 0x030F,
+ kHIDUsage_Snsr_Property_ChangeSensitivityPercentRange = 0x0310,
+ kHIDUsage_Snsr_Property_ChangeSensitivityPercentRelative = 0x0311,
+ kHIDUsage_Snsr_Property_Accuracy = 0x0312,
+ kHIDUsage_Snsr_Property_Resolution = 0x0313,
+ kHIDUsage_Snsr_Property_Maximum = 0x0314,
+ kHIDUsage_Snsr_Property_Minimum = 0x0315,
+ kHIDUsage_Snsr_Property_ReportingState = 0x0316,
+ kHIDUsage_Snsr_Property_SamplingRate = 0x0317,
+ kHIDUsage_Snsr_Property_ResponseCurve = 0x0318,
+ kHIDUsage_Snsr_Property_PowerState = 0x0319,
+ kHIDUsage_Snsr_Property_MaxFIFOEvents = 0x031A,
+ kHIDUsage_Snsr_Property_ReportLatency = 0x031B,
+
+ /* 0x031C - 0x03FF Reserved */
+
+ kHIDUsage_Snsr_Property_ConnectionType_Integrated = 0x0830,
+ kHIDUsage_Snsr_Property_ConnectionType_Attached = 0x0831,
+ kHIDUsage_Snsr_Property_ConnectionType_External = 0x0832,
+ /* 0x0833 - 0x083F Reserved */
+ kHIDUsage_Snsr_Property_ReportingState_NoEvents = 0x0840,
+ kHIDUsage_Snsr_Property_ReportingState_AllEvents = 0x0841,
+ kHIDUsage_Snsr_Property_ReportingState_ThresholdEvents = 0x0842,
+ kHIDUsage_Snsr_Property_ReportingState_WakeNoEvents = 0x0843,
+ kHIDUsage_Snsr_Property_ReportingState_WakeAllEvents = 0x0844,
+ kHIDUsage_Snsr_Property_ReportingState_WakeThresholdEvents = 0x0845,
+ /* 0x0846 - 0x084F Reserved */
+ kHIDUsage_Snsr_Property_PowerState_Undefined = 0x0850,
+ kHIDUsage_Snsr_Property_PowerState_D0_FullPower = 0x0851,
+ kHIDUsage_Snsr_Property_PowerState_D1_LowPower = 0x0852,
+ kHIDUsage_Snsr_Property_PowerState_D2_Standby = 0x0853,
+ kHIDUsage_Snsr_Property_PowerState_D3_Sleep = 0x0854,
+ kHIDUsage_Snsr_Property_PowerState_D4_PowerOff = 0x0855,
+ /* 0x0855 - 0x085F Reserved */
+ kHIDUsage_Snsr_Light_Illuminance = 0x04D1,
+
+ /* Specific Sensor Type Data Fields */
+
+ /* Location Sensor Data Fields */
+ kHIDUsage_Snsr_Data_Location = 0x0400,
+ kHIDUsage_Snsr_Data_Location_Reserved = 0x0401,
+ kHIDUsage_Snsr_Data_Location_AltitudeAntennaSeaLevel = 0x0402,
+ kHIDUsage_Snsr_Data_Location_DifferentialReferenceStationID = 0x0403,
+ kHIDUsage_Snsr_Data_Location_AltitudeEllipsoidError = 0x0404,
+ kHIDUsage_Snsr_Data_Location_AltitudeEllipsoid = 0x0405,
+ kHIDUsage_Snsr_Data_Location_AltitudeSeaLevelError = 0x0406,
+ kHIDUsage_Snsr_Data_Location_AltitudeSeaLevel = 0x0407,
+ kHIDUsage_Snsr_Data_Location_DifferentialGPSDataAge = 0x0408,
+ kHIDUsage_Snsr_Data_Location_ErrorRadius = 0x0409,
+
+ kHIDUsage_Snsr_Data_Location_FixQuality = 0x040A,
+ kHIDUsage_Snsr_Data_Location_FixQualityNoFix = 0x0870,
+ kHIDUsage_Snsr_Data_Location_FixQualityGPS = 0x0871,
+ kHIDUsage_Snsr_Data_Location_FixQualityDGPS = 0x0872,
+
+ kHIDUsage_Snsr_Data_Location_FixType = 0x040B,
+ kHIDUsage_Snsr_Data_Location_FixTypeNoFix = 0x0880,
+ kHIDUsage_Snsr_Data_Location_FixTypeGPSSPSMode = 0x0881,
+ kHIDUsage_Snsr_Data_Location_FixTypeDGPSSPSMode = 0x0882,
+ kHIDUsage_Snsr_Data_Location_FixTypeGPSPPSMode = 0x0883,
+ kHIDUsage_Snsr_Data_Location_FixTypeRealTimeKinematic = 0x0884,
+ kHIDUsage_Snsr_Data_Location_FixTypeFloatRTK = 0x0885,
+ kHIDUsage_Snsr_Data_Location_FixTypeEstimated = 0x0886,
+ kHIDUsage_Snsr_Data_Location_FixTypeManualInputMode = 0x0887,
+ kHIDUsage_Snsr_Data_Location_FixTypeSimulatorMode = 0x0888,
+
+ kHIDUsage_Snsr_Data_Location_GeoidalSeparation = 0x040C,
+
+ kHIDUsage_Snsr_Data_Location_GPSOperationMode = 0x040D,
+ kHIDUsage_Snsr_Data_Location_GPSOperationModeManual = 0x0890,
+ kHIDUsage_Snsr_Data_Location_GPSOperationModeAutomatic = 0x0891,
+
+ kHIDUsage_Snsr_Data_Location_GPSSelectionMode = 0x040E,
+ kHIDUsage_Snsr_Data_Location_GPSSelectionModeAutonomous = 0x08A0,
+ kHIDUsage_Snsr_Data_Location_GPSSelectionModeDGPS = 0x08A1,
+ kHIDUsage_Snsr_Data_Location_GPSSelectionModeEstimated = 0x08A2,
+ kHIDUsage_Snsr_Data_Location_GPSSelectionModeManualInput = 0x08A3,
+ kHIDUsage_Snsr_Data_Location_GPSSelectionModeSimulator = 0x08A4,
+ kHIDUsage_Snsr_Data_Location_GPSSelectionModeDataNotValid = 0x08A5,
+
+ kHIDUsage_Snsr_Data_Location_GPSStatus = 0x040F,
+ kHIDUsage_Snsr_Data_Location_GPSStatusDataValid = 0x08B0,
+ kHIDUsage_Snsr_Data_Location_GPSStatusDataNotValid = 0x08B1,
+
+ kHIDUsage_Snsr_Data_Location_PositionDilutionOfPrecision = 0x0410,
+ kHIDUsage_Snsr_Data_Location_HorizontalDilutionOfPrecision = 0x0411,
+ kHIDUsage_Snsr_Data_Location_VerticalDilutionOfPrecision = 0x0412,
+ kHIDUsage_Snsr_Data_Location_Latitude = 0x0413,
+ kHIDUsage_Snsr_Data_Location_Longitude = 0x0414,
+ kHIDUsage_Snsr_Data_Location_TrueHeading = 0x0415,
+ kHIDUsage_Snsr_Data_Location_MagneticHeading = 0x0416,
+ kHIDUsage_Snsr_Data_Location_MagneticVariation = 0x0417,
+ kHIDUsage_Snsr_Data_Location_Speed = 0x0418,
+ kHIDUsage_Snsr_Data_Location_SatellitesInView = 0x0419,
+ kHIDUsage_Snsr_Data_Location_SatellitesInViewAzimuth = 0x041A,
+ kHIDUsage_Snsr_Data_Location_SatellitesInViewElevation = 0x041B,
+ kHIDUsage_Snsr_Data_Location_SatellitesInViewIDs = 0x041C,
+ kHIDUsage_Snsr_Data_Location_SatellitesInViewPRNs = 0x041D,
+ kHIDUsage_Snsr_Data_Location_SatellitesInViewSNRatios = 0x041E,
+ kHIDUsage_Snsr_Data_Location_SatellitesUsedCount = 0x041F,
+ kHIDUsage_Snsr_Data_Location_SatellitesUsedPRNs = 0x0420,
+ kHIDUsage_Snsr_Data_Location_NMEASentence = 0x0421,
+ kHIDUsage_Snsr_Data_Location_AddressLine1 = 0x0422,
+ kHIDUsage_Snsr_Data_Location_AddressLine2 = 0x0423,
+ kHIDUsage_Snsr_Data_Location_City = 0x0424,
+ kHIDUsage_Snsr_Data_Location_StateOrProvince = 0x0425,
+ kHIDUsage_Snsr_Data_Location_CountryOrRegion = 0x0426,
+ kHIDUsage_Snsr_Data_Location_PostalCode = 0x0427,
+ /* 0x0428 - 0x0429 Reserved */
+
+ /* Location Sensor Properties */
+ kHIDUsage_Snsr_Property_Location = 0x042A,
+ kHIDUsage_Snsr_Property_Location_DesiredAccuracy = 0x042B,
+ kHIDUsage_Snsr_Property_Location_AccuracyDefault = 0x0860,
+ kHIDUsage_Snsr_Property_Location_AccuracyHigh = 0x0861,
+ kHIDUsage_Snsr_Property_Location_AccuracyMedium = 0x0862,
+ kHIDUsage_Snsr_Property_Location_AccuracyLow = 0x0863,
+ /* 0x042C - 0x042F Reserved */
+
+ /* Environmental Sensor Data Fields */
+ kHIDUsage_Snsr_Data_Environmental = 0x0430,
+ kHIDUsage_Snsr_Data_Environmental_AtmosphericPressure = 0x0431,
+ kHIDUsage_Snsr_Data_Environmental_Reserved = 0x0432,
+ kHIDUsage_Snsr_Data_Environmental_RelativeHumidity = 0x0433,
+ kHIDUsage_Snsr_Data_Environmental_Temperature = 0x0434,
+ kHIDUsage_Snsr_Data_Environmental_WindDirection = 0x0435,
+ kHIDUsage_Snsr_Data_Environmental_WindSpeed = 0x0436,
+ /* 0x0437 - 0x043F Reserved */
+
+ /* Environmental Sensor Properties */
+ kHIDUsage_Snsr_Property_Environmental = 0x0440,
+ kHIDUsage_Snsr_Property_Environmental_ReferencePressure = 0x0441,
+ /* 0x0442 - 0x044F Reserved */
+
+ /* Motion Sensor Data Fields */
+ kHIDUsage_Snsr_Data_Motion = 0x0450,
+ kHIDUsage_Snsr_Data_Motion_State = 0x0451,
+ kHIDUsage_Snsr_Data_Motion_Acceleration = 0x0452,
+ kHIDUsage_Snsr_Data_Motion_AccelerationAxisX = 0x0453,
+ kHIDUsage_Snsr_Data_Motion_AccelerationAxisY = 0x0454,
+ kHIDUsage_Snsr_Data_Motion_AccelerationAxisZ = 0x0455,
+ kHIDUsage_Snsr_Data_Motion_AngularVelocity = 0x0456,
+ kHIDUsage_Snsr_Data_Motion_AngularVelocityXAxis = 0x0457,
+ kHIDUsage_Snsr_Data_Motion_AngularVelocityYAxis = 0x0458,
+ kHIDUsage_Snsr_Data_Motion_AngularVelocityZAxis = 0x0459,
+ kHIDUsage_Snsr_Data_Motion_AngularPosition = 0x045A,
+ kHIDUsage_Snsr_Data_Motion_AngularPositionXAxis = 0x045B,
+ kHIDUsage_Snsr_Data_Motion_AngularPositionYAxis = 0x045C,
+ kHIDUsage_Snsr_Data_Motion_AngularPositionZAxis = 0x045D,
+ kHIDUsage_Snsr_Data_Motion_Speed = 0x045E,
+ kHIDUsage_Snsr_Data_Motion_Intensity = 0x045F,
+ /* 0x0460 - 0x046F Reserved */
+
+ /* Orientation Sensor Data Fields */
+ kHIDUsage_Snsr_Data_Orientation = 0x0470,
+ kHIDUsage_Snsr_Data_Orientation_Heading = 0x0471,
+ kHIDUsage_Snsr_Data_Orientation_HeadingXAxis = 0x0472,
+ kHIDUsage_Snsr_Data_Orientation_HeadingYAxis = 0x0473,
+ kHIDUsage_Snsr_Data_Orientation_HeadingZAxis = 0x0474,
+ kHIDUsage_Snsr_Data_Orientation_HeadingCompensatedMagneticNorth = 0x0475,
+ kHIDUsage_Snsr_Data_Orientation_HeadingCompensatedTrueNorth = 0x0476,
+ kHIDUsage_Snsr_Data_Orientation_HeadingMagneticNorth = 0x0477,
+ kHIDUsage_Snsr_Data_Orientation_HeadingTrueNorth = 0x0478,
+ kHIDUsage_Snsr_Data_Orientation_Distance = 0x0479,
+ kHIDUsage_Snsr_Data_Orientation_DistanceXAxis = 0x047A,
+ kHIDUsage_Snsr_Data_Orientation_DistanceYAxis = 0x047B,
+ kHIDUsage_Snsr_Data_Orientation_DistanceZAxis = 0x047C,
+ kHIDUsage_Snsr_Data_Orientation_DistanceOutOfRange = 0x047D,
+ kHIDUsage_Snsr_Data_Orientation_Tilt = 0x047E,
+ kHIDUsage_Snsr_Data_Orientation_TiltXAxis = 0x047F,
+ kHIDUsage_Snsr_Data_Orientation_TiltYAxis = 0x0480,
+ kHIDUsage_Snsr_Data_Orientation_TiltZAxis = 0x0481,
+ kHIDUsage_Snsr_Data_Orientation_RotationMatrix = 0x0482,
+ kHIDUsage_Snsr_Data_Orientation_Quaternion = 0x0483,
+ kHIDUsage_Snsr_Data_Orientation_MagneticFlux = 0x0484,
+ kHIDUsage_Snsr_Data_Orientation_MagneticFluxXAxis = 0x0485,
+ kHIDUsage_Snsr_Data_Orientation_MagneticFluxYAxis = 0x0486,
+ kHIDUsage_Snsr_Data_Orientation_MagneticFluxZAxis = 0x0487,
+ /* 0x0488 - 0x048F Reserved */
+
+ /* Mechanical Sensor Data Field */
+ kHIDUsage_Snsr_Data_Mechanical = 0x0490,
+ kHIDUsage_Snsr_Data_Mechanical_BooleanSwitchState = 0x0491,
+ kHIDUsage_Snsr_Data_Mechanical_BooleanSwitchArrayStates = 0x0492,
+ kHIDUsage_Snsr_Data_Mechanical_MultivalueSwitchValue = 0x0493,
+ kHIDUsage_Snsr_Data_Mechanical_Force = 0x0494,
+ kHIDUsage_Snsr_Data_Mechanical_AbsolutePressure = 0x0495,
+ kHIDUsage_Snsr_Data_Mechanical_GaugePressure = 0x0496,
+ kHIDUsage_Snsr_Data_Mechanical_Strain = 0x0497,
+ kHIDUsage_Snsr_Data_Mechanical_Weight = 0x0498,
+ /* 0x0499 - 0x49F Reserved */
+
+ /* Mechanical Sensor Properties */
+ kHIDUsage_Snsr_Property_Mechanical = 0x04A0,
+ kHIDUsage_Snsr_Property_Mechanical_VibrationState = 0x04A1,
+ kHIDUsage_Snsr_Property_Mechanical_ForwardVibrationSpeed = 0x04A2,
+ kHIDUsage_Snsr_Property_Mechanical_BackwardVibrationSpeed = 0x04A3,
+ /* 0x04A4 - 0x04AF Reserved */
+
+ /* Biometric Sensor Data Fields */
+ kHIDUsage_Snsr_Data_Biometric = 0x04B0,
+ kHIDUsage_Snsr_Data_Biometric_HumanPresence = 0x04B1,
+ kHIDUsage_Snsr_Data_Biometric_HumanProximityRange = 0x04B2,
+ kHIDUsage_Snsr_Data_Biometric_HumanProximityOutOfRange = 0x04B3,
+ kHIDUsage_Snsr_Data_Biometric_HumanTouchState = 0x04B4,
+ /* 0x04B5 - 0x04CF Reserved */
+
+ /* Light Sensor Data Fields */
+ kHIDUsage_Snsr_Data_Light = 0x04D0,
+ kHIDUsage_Snsr_Data_Light_Illuminance = 0x04D1,
+ kHIDUsage_Snsr_Data_Light_ColorTemperature = 0x04D2,
+ kHIDUsage_Snsr_Data_Light_Chromaticity = 0x04D3,
+ kHIDUsage_Snsr_Data_Light_ChromaticityX = 0x04D4,
+ kHIDUsage_Snsr_Data_Light_ChromaticityY = 0x04D5,
+ kHIDUsage_Snsr_Data_Light_ConsumerIRSentenceReceive = 0x04D6,
+ /* 0x04D7 - 0x04DF Reserved */
+
+ /* Light Sensor Properties */
+ kHIDUsage_Snsr_Property_Light = 0x04E0,
+ kHIDUsage_Snsr_Property_Light_ConsumerIRSentenceSend = 0x04E1,
+ /* 0x04E2 - 0x04EF Reserved */
+
+ /* Scanner Sensor Data Fields */
+ kHIDUsage_Snsr_Data_Scanner = 0x04F0,
+ kHIDUsage_Snsr_Data_Scanner_RFIDTag40Bit = 0x04F1,
+ kHIDUsage_Snsr_Data_Scanner_NFCSentenceReceive = 0x04F2,
+ /* 0x04F3 - 0x04F7 Reserved */
+
+ /* Scanner Sensor Properties */
+ kHIDUsage_Snsr_Property_Scanner = 0x04F8,
+ kHIDUsage_Snsr_Property_Scanner_NFCSentenceSend = 0x0F49,
+ /* 0x04FA - 0x04FF Reserved */
+
+ /* Electrical Sensor Data Fields */
+ kHIDUsage_Snsr_Data_Electrical = 0x0500,
+ kHIDUsage_Snsr_Data_Electrical_Capacitance = 0x0501,
+ kHIDUsage_Snsr_Data_Electrical_Current = 0x0502,
+ kHIDUsage_Snsr_Data_Electrical_ElectricalPower = 0x0503,
+ kHIDUsage_Snsr_Data_Electrical_Inductance = 0x0504,
+ kHIDUsage_Snsr_Data_Electrical_Resistance = 0x0505,
+ kHIDUsage_Snsr_Data_Electrical_Voltage = 0x0506,
+ kHIDUsage_Snsr_Data_Electrical_Frequency = 0x0507,
+ kHIDUsage_Snsr_Data_Electrical_Period = 0x0508,
+ kHIDUsage_Snsr_Data_Electrical_PercentOfRange = 0x0509,
+ /* 0x050A - 0x051F Reserved */
+
+ /* Time Sensor Data Fields */
+ kHIDUsage_Snsr_Data_Time = 0x0520,
+ kHIDUsage_Snsr_Data_Time_Year = 0x0521,
+ kHIDUsage_Snsr_Data_Time_Month = 0x0522,
+ kHIDUsage_Snsr_Data_Time_Day = 0x0523,
+
+ kHIDUsage_Snsr_Data_Time_DayOfWeek = 0x0524,
+ kHIDUsage_Snsr_Data_Time_DayOfWeekSunday = 0x08C0,
+ kHIDUsage_Snsr_Data_Time_DayOfWeekMonday = 0x08C1,
+ kHIDUsage_Snsr_Data_Time_DayOfWeekTuesday = 0x08C2,
+ kHIDUsage_Snsr_Data_Time_DayOfWeekWednesday = 0x08C3,
+ kHIDUsage_Snsr_Data_Time_DayOfWeekThursday = 0x08C4,
+ kHIDUsage_Snsr_Data_Time_DayOfWeekFriday = 0x08C5,
+ kHIDUsage_Snsr_Data_Time_DayOfWeekSaturday = 0x08C6,
+
+ kHIDUsage_Snsr_Data_Time_Hour = 0x0525,
+ kHIDUsage_Snsr_Data_Time_Minute = 0x0526,
+ kHIDUsage_Snsr_Data_Time_Second = 0x0527,
+ kHIDUsage_Snsr_Data_Time_Millisecond = 0x0528,
+ kHIDUsage_Snsr_Data_Time_Timestamp = 0x0529,
+ kHIDUsage_Snsr_Data_Time_JulianDayOfYear = 0x052A,
+ /* 0x052B - 0x052F Reserved */
+
+ /* Time Sensor Properties */
+ kHIDUsage_Snsr_Property_Time = 0x0530,
+ kHIDUsage_Snsr_Property_Time_TimeZoneOffsetFromUTC = 0x0531,
+ kHIDUsage_Snsr_Property_Time_TimeZoneName = 0x0532,
+ kHIDUsage_Snsr_Property_Time_DaylightSavingsTimeObserved = 0x0533,
+ kHIDUsage_Snsr_Property_Time_TimeTrimAdjustment = 0x0534,
+ kHIDUsage_Snsr_Property_Time_ArmAlarm = 0x0535,
+ /* 0x0536 - 0x053F Reserved */
+
+ /* Custom Sensor Data Fields */
+ kHIDUsage_Snsr_Data_Custom = 0x0540,
+ kHIDUsage_Snsr_Data_Custom_Usage = 0x0541,
+ kHIDUsage_Snsr_Data_Custom_BooleanArray = 0x0542,
+ kHIDUsage_Snsr_Data_Custom_Value = 0x0543,
+ kHIDUsage_Snsr_Data_Custom_Value1 = 0x0544,
+ kHIDUsage_Snsr_Data_Custom_Value2 = 0x0545,
+ kHIDUsage_Snsr_Data_Custom_Value3 = 0x0546,
+ kHIDUsage_Snsr_Data_Custom_Value4 = 0x0547,
+ kHIDUsage_Snsr_Data_Custom_Value5 = 0x0548,
+ kHIDUsage_Snsr_Data_Custom_Value6 = 0x0549,
+ /* 0x054A - 0x055F Reserved */
+};
+
+/* Power Device Page (0x84) */
+/* This section provides detailed descriptions of the usages employed by Power Devices. */
+enum
+{
+
+ kHIDUsage_PD_Undefined = 0x00, /* Power Device Undefined Usage */
+ kHIDUsage_PD_iName = 0x01, /* CL- Power Device Name Index */
+ kHIDUsage_PD_PresentStatus = 0x02, /* CL- Power Device Present Status */
+ kHIDUsage_PD_ChangedStatus = 0x03, /* CA- Power Device Changed Status */
+ kHIDUsage_PD_UPS = 0x04, /* CA- Uninterruptible Power Supply */
+ kHIDUsage_PD_PowerSupply = 0x05, /* CA- Power Supply */
+ kHIDUsage_PD_PeripheralDevice = 0x06, /* CA- Perpheral Device */
+ /* Reserved 0x07 - 0x0F */
+ kHIDUsage_PD_BatterySystem = 0x10, /* CP- Battery System power module */
+ kHIDUsage_PD_BatterySystemID = 0x11, /* SV IF- Battery System ID */
+ kHIDUsage_PD_Battery = 0x12, /* CP- Battery */
+ kHIDUsage_PD_BatteryID = 0x13, /* SV IF- Battery ID */
+ kHIDUsage_PD_Charger = 0x14, /* CP- Charger */
+ kHIDUsage_PD_ChargerID = 0x15, /* SV IF- Charger ID */
+ kHIDUsage_PD_PowerConverter = 0x16, /* CP- Power Converter power module */
+ kHIDUsage_PD_PowerConverterID = 0x17, /* SV IF- Power Converter ID */
+ kHIDUsage_PD_OutletSystem = 0x18, /* CP- Outlet System power module */
+ kHIDUsage_PD_OutletSystemID = 0x19, /* SV IF-Outlet System ID */
+ kHIDUsage_PD_Input = 0x1A, /* CP- Power Device Input */
+ kHIDUsage_PD_InputID = 0x1B, /* SV IF- Power Device Input ID */
+ kHIDUsage_PD_Output = 0x1C, /* CP- Power Device Output */
+ kHIDUsage_PD_OutputID = 0x1D, /* SV IF- Power Device Output ID */
+ kHIDUsage_PD_Flow = 0x1E, /* CP- Power Device Flow */
+ kHIDUsage_PD_FlowID = 0x1F, /* Item IF- Power Device Flow ID */
+ kHIDUsage_PD_Outlet = 0x20, /* CP- Power Device Outlet */
+ kHIDUsage_PD_OutletID = 0x21, /* SV IF- Power Device Outlet ID */
+ kHIDUsage_PD_Gang = 0x22, /* CL/CP- Power Device Gang */
+ kHIDUsage_PD_GangID = 0x23, /* SV IF- Power Device Gang ID */
+ kHIDUsage_PD_PowerSummary = 0x24, /* CL/CP- Power Device Power Summary */
+ kHIDUsage_PD_PowerSummaryID = 0x25, /* SV IF- Power Device Power Summary ID */
+ /* Reserved 0x26 - 0x2F */
+ kHIDUsage_PD_Voltage = 0x30, /* DV IF- Power Device Voltage */
+ kHIDUsage_PD_Current = 0x31, /* DV IF- Power Device Current */
+ kHIDUsage_PD_Frequency = 0x32, /* DV IF- Power Device Frequency */
+ kHIDUsage_PD_ApparentPower = 0x33, /* DV IF- Power Device Apparent Power */
+ kHIDUsage_PD_ActivePower = 0x34, /* DV IF- Power Device RMS Power */
+ kHIDUsage_PD_PercentLoad = 0x35, /* DV IF- Power Device Percent Load */
+ kHIDUsage_PD_Temperature = 0x36, /* DV IF- Power Device Temperature */
+ kHIDUsage_PD_Humidity = 0x37, /* DV IF- Power Device Humidity */
+ kHIDUsage_PD_BadCount = 0x38, /* DV IF- Power Device Bad Condition Count */
+ /* Reserved 0x39 - 0x3F */
+ kHIDUsage_PD_ConfigVoltage = 0x40, /* SV/DV F- Power Device Nominal Voltage */
+ kHIDUsage_PD_ConfigCurrent = 0x41, /* SV/DV F- Power Device Nominal Current */
+ kHIDUsage_PD_ConfigFrequency = 0x42, /* SV/DV F- Power Device Nominal Frequency */
+ kHIDUsage_PD_ConfigApparentPower = 0x43, /* SV/DV F- Power Device Nominal Apparent Power */
+ kHIDUsage_PD_ConfigActivePower = 0x44, /* SV/DV F- Power Device Nominal RMS Power */
+ kHIDUsage_PD_ConfigPercentLoad = 0x45, /* SV/DV F- Power Device Nominal Percent Load */
+ kHIDUsage_PD_ConfigTemperature = 0x46, /* SV/DV F- Power Device Nominal Temperature */
+ kHIDUsage_PD_ConfigHumidity = 0x47, /* SV/DV F- Power Device Nominal Humidity */
+ /* Reserved 0x48 - 0x4F */
+ kHIDUsage_PD_SwitchOnControl = 0x50, /* DV F- Power Device Switch On Control */
+ kHIDUsage_PD_SwitchOffControl = 0x51, /* DV F- Power Device Switch Off Control */
+ kHIDUsage_PD_ToggleControl = 0x52, /* DV F- Power Device Toogle Sequence Control */
+ kHIDUsage_PD_LowVoltageTransfer = 0x53, /* DV F- Power Device Min Transfer Voltage */
+ kHIDUsage_PD_HighVoltageTransfer = 0x54, /* DV F- Power Device Max Transfer Voltage */
+ kHIDUsage_PD_DelayBeforeReboot = 0x55, /* DV F- Power Device Delay Before Reboot */
+ kHIDUsage_PD_DelayBeforeStartup = 0x56, /* DV F- Power Device Delay Before Startup */
+ kHIDUsage_PD_DelayBeforeShutdown = 0x57, /* DV F- Power Device Delay Before Shutdown */
+ kHIDUsage_PD_Test = 0x58, /* DV F- Power Device Test Request/Result */
+ kHIDUsage_PD_ModuleReset = 0x59, /* DV F- Power Device Reset Request/Result */
+ kHIDUsage_PD_AudibleAlarmControl = 0x5A, /* DV F- Power Device Audible Alarm Control */
+ /* Reserved 0x5B - 0x5F */
+ kHIDUsage_PD_Present = 0x60, /* DV IOF- Power Device Present */
+ kHIDUsage_PD_Good = 0x61, /* DV IOF- Power Device Good */
+ kHIDUsage_PD_InternalFailure = 0x62, /* DV IOF- Power Device Internal Failure */
+ kHIDUsage_PD_VoltageOutOfRange = 0x63, /* DV IOF- Power Device Voltage Out Of Range */
+ kHIDUsage_PD_FrequencyOutOfRange = 0x64, /* DV IOF- Power Device Frequency Out Of Range */
+ kHIDUsage_PD_Overload = 0x65, /* DV IOF- Power Device Overload */
+ kHIDUsage_PD_OverCharged = 0x66, /* DV IOF- Power Device Over Charged */
+ kHIDUsage_PD_OverTemperature = 0x67, /* DV IOF- Power Device Over Temperature */
+ kHIDUsage_PD_ShutdownRequested = 0x68, /* DV IOF- Power Device Shutdown Requested */
+ kHIDUsage_PD_ShutdownImminent = 0x69, /* DV IOF- Power Device Shutdown Imminent */
+ /* Reserved 0x6A */
+ kHIDUsage_PD_SwitchOnOff = 0x6B, /* DV IOF- Power Device On/Off Switch Status */
+ kHIDUsage_PD_Switchable = 0x6C, /* DV IOF- Power Device Switchable */
+ kHIDUsage_PD_Used = 0x6D, /* DV IOF- Power Device Used */
+ kHIDUsage_PD_Boost = 0x6E, /* DV IOF- Power Device Boosted */
+ kHIDUsage_PD_Buck = 0x6F, /* DV IOF- Power Device Bucked */
+ kHIDUsage_PD_Initialized = 0x70, /* DV IOF- Power Device Initialized */
+ kHIDUsage_PD_Tested = 0x71, /* DV IOF- Power Device Tested */
+ kHIDUsage_PD_AwaitingPower = 0x72, /* DV IOF- Power Device Awaiting Power */
+ kHIDUsage_PD_CommunicationLost = 0x73, /* DV IOF- Power Device Communication Lost */
+ /* Reserved 0x74 - 0xFC */
+ kHIDUsage_PD_iManufacturer = 0xFD, /* SV F- Power Device Manufacturer String Index */
+ kHIDUsage_PD_iProduct = 0xFE, /* SV F- Power Device Product String Index */
+ kHIDUsage_PD_iserialNumber = 0xFF /* SV F- Power Device Serial Number String Index */
+};
+
+/* Battery System Page (x85) */
+/* This section provides detailed descriptions of the usages employed by Battery Systems. */
+enum
+{
+ kHIDUsage_BS_Undefined = 0x00, /* Battery System Undefined */
+ kHIDUsage_BS_SMBBatteryMode = 0x01, /* CL - SMB Mode */
+ kHIDUsage_BS_SMBBatteryStatus = 0x02, /* CL - SMB Status */
+ kHIDUsage_BS_SMBAlarmWarning = 0x03, /* CL - SMB Alarm Warning */
+ kHIDUsage_BS_SMBChargerMode = 0x04, /* CL - SMB Charger Mode */
+ kHIDUsage_BS_SMBChargerStatus = 0x05, /* CL - SMB Charger Status */
+ kHIDUsage_BS_SMBChargerSpecInfo = 0x06, /* CL - SMB Charger Extended Status */
+ kHIDUsage_BS_SMBSelectorState = 0x07, /* CL - SMB Selector State */
+ kHIDUsage_BS_SMBSelectorPresets = 0x08, /* CL - SMB Selector Presets */
+ kHIDUsage_BS_SMBSelectorInfo = 0x09, /* CL - SMB Selector Info */
+ /* Reserved 0x0A - 0x0F */
+ kHIDUsage_BS_OptionalMfgFunction1 = 0x10, /* DV F - Battery System Optional SMB Mfg Function 1 */
+ kHIDUsage_BS_OptionalMfgFunction2 = 0x11, /* DV F - Battery System Optional SMB Mfg Function 2 */
+ kHIDUsage_BS_OptionalMfgFunction3 = 0x12, /* DV F - Battery System Optional SMB Mfg Function 3 */
+ kHIDUsage_BS_OptionalMfgFunction4 = 0x13, /* DV F - Battery System Optional SMB Mfg Function 4 */
+ kHIDUsage_BS_OptionalMfgFunction5 = 0x14, /* DV F - Battery System Optional SMB Mfg Function 5 */
+ kHIDUsage_BS_ConnectionToSMBus = 0x15, /* DF F - Battery System Connection To System Management Bus */
+ kHIDUsage_BS_OutputConnection = 0x16, /* DF F - Battery System Output Connection Status */
+ kHIDUsage_BS_ChargerConnection = 0x17, /* DF F - Battery System Charger Connection */
+ kHIDUsage_BS_BatteryInsertion = 0x18, /* DF F - Battery System Battery Insertion */
+ kHIDUsage_BS_Usenext = 0x19, /* DF F - Battery System Use Next */
+ kHIDUsage_BS_OKToUse = 0x1A, /* DF F - Battery System OK To Use */
+ kHIDUsage_BS_BatterySupported = 0x1B, /* DF F - Battery System Battery Supported */
+ kHIDUsage_BS_SelectorRevision = 0x1C, /* DF F - Battery System Selector Revision */
+ kHIDUsage_BS_ChargingIndicator = 0x1D, /* DF F - Battery System Charging Indicator */
+ /* Reserved 0x1E - 0x27 */
+ kHIDUsage_BS_ManufacturerAccess = 0x28, /* DV F - Battery System Manufacturer Access */
+ kHIDUsage_BS_RemainingCapacityLimit = 0x29, /* DV F - Battery System Remaining Capacity Limit */
+ kHIDUsage_BS_RemainingTimeLimit = 0x2A, /* DV F - Battery System Remaining Time Limit */
+ kHIDUsage_BS_AtRate = 0x2B, /* DV F - Battery System At Rate... */
+ kHIDUsage_BS_CapacityMode = 0x2C, /* DV F - Battery System Capacity Mode */
+ kHIDUsage_BS_BroadcastToCharger = 0x2D, /* DV F - Battery System Broadcast To Charger */
+ kHIDUsage_BS_PrimaryBattery = 0x2E, /* DV F - Battery System Primary Battery */
+ kHIDUsage_BS_ChargeController = 0x2F, /* DV F - Battery System Charge Controller */
+ /* Reserved 0x30 - 0x3F */
+ kHIDUsage_BS_TerminateCharge = 0x40, /* DF IOF - Battery System Terminate Charge */
+ kHIDUsage_BS_TerminateDischarge = 0x41, /* DF IOF - Battery System Terminate Discharge */
+ kHIDUsage_BS_BelowRemainingCapacityLimit = 0x42, /* DF IOF - Battery System Below Remaining Capacity Limit */
+ kHIDUsage_BS_RemainingTimeLimitExpired = 0x43, /* DF IOF - Battery System Remaining Time Limit Expired */
+ kHIDUsage_BS_Charging = 0x44, /* DF IOF - Battery System Charging */
+ kHIDUsage_BS_Discharging = 0x45, /* DV IOF - Battery System Discharging */
+ kHIDUsage_BS_FullyCharged = 0x46, /* DF IOF - Battery System Fully Charged */
+ kHIDUsage_BS_FullyDischarged = 0x47, /* DV IOF - Battery System Fully Discharged */
+ kHIDUsage_BS_ConditioningFlag = 0x48, /* DV IOF - Battery System Conditioning Flag */
+ kHIDUsage_BS_AtRateOK = 0x49, /* DV IOF - Battery System At Rate OK */
+ kHIDUsage_BS_SMBErrorCode = 0x4A, /* DF IOF - Battery System SMB Error Code */
+ kHIDUsage_BS_NeedReplacement = 0x4B, /* DF IOF - Battery System Need Replacement */
+ /* Reserved 0x4C - 0x5F */
+ kHIDUsage_BS_AtRateTimeToFull = 0x60, /* DV IF - Battery System At Rate Time To Full */
+ kHIDUsage_BS_AtRateTimeToEmpty = 0x61, /* DV IF - Battery System At Rate Time To Empty */
+ kHIDUsage_BS_AverageCurrent = 0x62, /* DV IF - Battery System Average Current */
+ kHIDUsage_BS_Maxerror = 0x63, /* DV IF - Battery System Max Error */
+ kHIDUsage_BS_RelativeStateOfCharge = 0x64, /* DV IF - Battery System Relative State Of Charge */
+ kHIDUsage_BS_AbsoluteStateOfCharge = 0x65, /* DV IF - Battery System Absolute State Of Charge */
+ kHIDUsage_BS_RemainingCapacity = 0x66, /* DV IF - Battery System Remaining Capacity */
+ kHIDUsage_BS_FullChargeCapacity = 0x67, /* DV IF - Battery System Full Charge Capacity */
+ kHIDUsage_BS_RunTimeToEmpty = 0x68, /* DV IF - Battery System Run Time To Empty */
+ kHIDUsage_BS_AverageTimeToEmpty = 0x69, /* DV IF - Battery System Average Time To Empty */
+ kHIDUsage_BS_AverageTimeToFull = 0x6A, /* DV IF - Battery System Average Time To Full */
+ kHIDUsage_BS_CycleCount = 0x6B, /* DV IF - Battery System Cycle Count */
+ /* Reserved 0x6C - 0x7F */
+ kHIDUsage_BS_BattPackModelLevel = 0x80, /* SV F - Battery System Batt Pack Model Level */
+ kHIDUsage_BS_InternalChargeController = 0x81, /* SF F - Battery System Internal Charge Controller */
+ kHIDUsage_BS_PrimaryBatterySupport = 0x82, /* SF F - Battery System Primary Battery Support */
+ kHIDUsage_BS_DesignCapacity = 0x83, /* SV F - Battery System Design Capacity */
+ kHIDUsage_BS_SpecificationInfo = 0x84, /* SV F - Battery System Specification Info */
+ kHIDUsage_BS_ManufacturerDate = 0x85, /* SV F - Battery System Manufacturer Date */
+ kHIDUsage_BS_SerialNumber = 0x86, /* SV F - Battery System Serial Number */
+ kHIDUsage_BS_iManufacturerName = 0x87, /* SV F - Battery System Manufacturer Name Index */
+ kHIDUsage_BS_iDevicename = 0x88, /* SV F - Battery System Device Name Index */
+ kHIDUsage_BS_iDeviceChemistry = 0x89, /* SV F - Battery System Device Chemistry Index */
+ kHIDUsage_BS_ManufacturerData = 0x8A, /* SV F - Battery System Manufacturer Data */
+ kHIDUsage_BS_Rechargable = 0x8B, /* SV F - Battery System Rechargable */
+ kHIDUsage_BS_WarningCapacityLimit = 0x8C, /* SV F - Battery System Warning Capacity Limit */
+ kHIDUsage_BS_CapacityGranularity1 = 0x8D, /* SV F - Battery System Capacity Granularity 1 */
+ kHIDUsage_BS_CapacityGranularity2 = 0x8E, /* SV F - Battery System Capacity Granularity 2 */
+ kHIDUsage_BS_iOEMInformation = 0x8F, /* SV F - Battery System OEM Information Index */
+ /* Reserved 0x90 - 0xBF */
+ kHIDUsage_BS_InhibitCharge = 0xC0, /* DF IOF - Battery System Inhibit Charge */
+ kHIDUsage_BS_EnablePolling = 0xC1, /* DF IOF - Battery System Enable Polling */
+ kHIDUsage_BS_ResetToZero = 0xC2, /* DF IOF - Battery System Reset To Zero */
+ /* Reserved 0xC3 - 0xCF */
+ kHIDUsage_BS_ACPresent = 0xD0, /* DF IOF - Battery System AC Present */
+ kHIDUsage_BS_BatteryPresent = 0xD1, /* DF IOF - Battery System Battery Present */
+ kHIDUsage_BS_PowerFail = 0xD2, /* DF IOF - Battery System Power Fail */
+ kHIDUsage_BS_AlarmInhibited = 0xD3, /* DF IOF - Battery System Alarm Inhibited */
+ kHIDUsage_BS_ThermistorUnderRange = 0xD4, /* DF IOF - Battery System Thermistor Under Range */
+ kHIDUsage_BS_ThermistorHot = 0xD5, /* DF IOF - Battery System Thermistor Hot */
+ kHIDUsage_BS_ThermistorCold = 0xD6, /* DF IOF - Battery System Thermistor Cold */
+ kHIDUsage_BS_ThermistorOverRange = 0xD7, /* DF IOF - Battery System Thermistor Over Range */
+ kHIDUsage_BS_VoltageOutOfRange = 0xD8, /* DF IOF - Battery System Voltage Out Of Range */
+ kHIDUsage_BS_CurrentOutOfRange = 0xD9, /* DF IOF - Battery System Current Out Of Range */
+ kHIDUsage_BS_CurrentNotRegulated = 0xDA, /* DF IOF - Battery System Current Not Regulated */
+ kHIDUsage_BS_VoltageNotRegulated = 0xDB, /* DF IOF - Battery System Voltage Not Regulated */
+ kHIDUsage_BS_MasterMode = 0xDC, /* DF IOF - Battery System Master Mode */
+ /* Reserved 0xDD - 0xEF */
+ kHIDUsage_BS_ChargerSelectorSupport = 0xF0, /* SF F- Battery System Charger Support Selector */
+ kHIDUsage_BS_ChargerSpec = 0xF1, /* SF F- Battery System Charger Specification */
+ kHIDUsage_BS_Level2 = 0xF2, /* SF F- Battery System Charger Level 2 */
+ kHIDUsage_BS_Level3 = 0xF3 /* SF F- Battery System Charger Level 3 */
+ /* Reserved 0xF2 - 0xFF */
+};
+
+/* Bar Code Scanner Page (0x8C) */
+/* This section provides detailed descriptions of the usages employed by Bar Code Scanner Devices. */
+enum
+{
+ kHIDUsage_BCS_Undefined = 0x00, /* Bar Code Scanner Undefined Usage */
+ kHIDUsage_BCS_BadgeReader = 0x01, /* CA - Bar Code Badge Reader */
+ kHIDUsage_BCS_BarCodeScanner = 0x02, /* CA -Bar Code Scanner */
+ kHIDUsage_BCS_DumbBarCodeScanner = 0x03, /* CA -Dumb Bar Code Scanner Usage */
+ kHIDUsage_BCS_CordlessScannerBase = 0x04, /* CA -Cordless Base Usage */
+ kHIDUsage_BCS_BarCodeScannerCradle = 0x05, /* CA -Bar Code Scanner Cradle Usage */
+ /* Reserved 0x06 - 0x0F */
+ kHIDUsage_BCS_AttributeReport = 0x10, /* CL - Attribute Report */
+ kHIDUsage_BCS_SettingsReport = 0x11, /* CL - Settings Report */
+ kHIDUsage_BCS_ScannedDataReport = 0x12, /* CL - Scanned Data Report */
+ kHIDUsage_BCS_RawScannedDataReport = 0x13, /* CL - Raw Scanned Data Report */
+ kHIDUsage_BCS_TriggerReport = 0x14, /* CL - Trigger Report */
+ kHIDUsage_BCS_StatusReport = 0x15, /* CL - Status Report */
+ kHIDUsage_BCS_UPC_EANControlReport = 0x16, /* CL - UPC/EAN Control Report */
+ kHIDUsage_BCS_EAN2_3LabelControlReport = 0x17, /* CL - EAN 2/3 Label Control Report */
+ kHIDUsage_BCS_Code39ControlReport = 0x18, /* CL - Code 39 Control Report */
+ kHIDUsage_BCS_Interleaved2of5ControlReport = 0x19, /* CL - Interleaved 2 of 5 Control Report */
+ kHIDUsage_BCS_Standard2of5ControlReport = 0x1A, /* CL - Standard 2 of 5 Control Report */
+ kHIDUsage_BCS_MSIPlesseyControlReport = 0x1B, /* CL - MSI Plessey Control Report */
+ kHIDUsage_BCS_CodabarControlReport = 0x1C, /* CL - Codabar Control Report */
+ kHIDUsage_BCS_Code128ControlReport = 0x1D, /* CL - Code 128 Control Report */
+ kHIDUsage_BCS_Misc1DControlReport = 0x1E, /* CL - Misc 1D Control Report */
+ kHIDUsage_BCS_2DControlReport = 0x1F, /* CL - 2D Control Report */
+ /* Reserved 0x20 - 0x2F */
+ kHIDUsage_BCS_Aiming_PointerMide = 0x30, /* SF - Aiming Pointer Mode */
+ kHIDUsage_BCS_BarCodePresentSensor = 0x31, /* SF - Bar Code Present Sensor */
+ kHIDUsage_BCS_Class1ALaser = 0x32, /* SF - Class 1A Laser */
+ kHIDUsage_BCS_Class2Laser = 0x33, /* SF - Class 2 Laser */
+ kHIDUsage_BCS_HeaterPresent = 0x34, /* SF - Heater Present */
+ kHIDUsage_BCS_ContactScanner = 0x35, /* SF - Contact Scanner */
+ kHIDUsage_BCS_ElectronicArticleSurveillanceNotification = 0x36, /* SF - Electronic Article Surveillance Notification */
+ kHIDUsage_BCS_ConstantElectronicArticleSurveillance = 0x37, /* SF - Constant Electronic Article Surveillance */
+ kHIDUsage_BCS_ErrorIndication = 0x38, /* SF - Error Indication */
+ kHIDUsage_BCS_FixedBeeper = 0x39, /* SF - Fixed Beeper */
+ kHIDUsage_BCS_GoodDecodeIndication = 0x3A, /* SF - Good Decode Indication */
+ kHIDUsage_BCS_HandsFreeScanning = 0x3B, /* SF - Hands Free Scanning */
+ kHIDUsage_BCS_IntrinsicallySafe = 0x3C, /* SF - Intrinsically Safe */
+ kHIDUsage_BCS_KlasseEinsLaser = 0x3D, /* SF - Klasse Eins Laser */
+ kHIDUsage_BCS_LongRangeScanner = 0x3E, /* SF - Long Range Scanner */
+ kHIDUsage_BCS_MirrorSpeedControl = 0x3F, /* SF - Mirror Speed Control */
+ kHIDUsage_BCS_NotOnFileIndication = 0x40, /* SF - Not On File Indication */
+ kHIDUsage_BCS_ProgrammableBeeper = 0x41, /* SF - Programmable Beeper */
+ kHIDUsage_BCS_Triggerless = 0x42, /* SF - Triggerless */
+ kHIDUsage_BCS_Wand = 0x43, /* SF - Wand */
+ kHIDUsage_BCS_WaterResistant = 0x44, /* SF - Water Resistant */
+ kHIDUsage_BCS_MultiRangeScanner = 0x45, /* SF - Multi-Range Scanner */
+ kHIDUsage_BCS_ProximitySensor = 0x46, /* SF - Proximity Sensor */
+ /* Reserved 0x47 - 0x4C */
+ kHIDUsage_BCS_FragmentDecoding = 0x4D, /* DF - Fragment Decoding */
+ kHIDUsage_BCS_ScannerReadConfidence = 0x4E, /* DV - Scanner Read Confidence */
+ kHIDUsage_BCS_DataPrefix = 0x4F, /* NAry - Data Prefix */
+ kHIDUsage_BCS_PrefixAIMI = 0x50, /* SEL - Prefix AIMI */
+ kHIDUsage_BCS_PrefixNone = 0x51, /* SEL - Prefix None */
+ kHIDUsage_BCS_PrefixProprietary = 0x52, /* SEL - Prefix Proprietary */
+ /* Reserved 0x53 - 0x54 */
+ kHIDUsage_BCS_ActiveTime = 0x55, /* DV - Active Time */
+ kHIDUsage_BCS_AimingLaserPattern = 0x56, /* DF - Aiming Laser Pattern */
+ kHIDUsage_BCS_BarCodePresent = 0x57, /* OOC - Bar Code Present */
+ kHIDUsage_BCS_BeeperState = 0x58, /* OOC - Beeper State */
+ kHIDUsage_BCS_LaserOnTime = 0x59, /* DV - Laser On Time */
+ kHIDUsage_BCS_LaserState = 0x5A, /* OOC - Laser State */
+ kHIDUsage_BCS_LockoutTime = 0x5B, /* DV - Lockout Time */
+ kHIDUsage_BCS_MotorState = 0x5C, /* OOC - Motor State */
+ kHIDUsage_BCS_MotorTimeout = 0x5D, /* DV - Motor Timeout */
+ kHIDUsage_BCS_PowerOnResetScanner = 0x5E, /* DF - Power On Reset Scanner */
+ kHIDUsage_BCS_PreventReadOfBarcodes = 0x5F, /* DF - Prevent Read of Barcodes */
+ kHIDUsage_BCS_InitiateBarcodeRead = 0x60, /* DF - Initiate Barcode Read */
+ kHIDUsage_BCS_TriggerState = 0x61, /* DF - Trigger State */
+ kHIDUsage_BCS_TriggerMode = 0x62, /* NAry - Trigger Mode */
+ kHIDUsage_BCS_TriggerModeBlinkingLaserOn = 0x63, /* SEL - Trigger Mode Blinking Laser On */
+ kHIDUsage_BCS_TriggerModeContinuousLaserOn = 0x64, /* SEL - Trigger Mode Continuous Laser On */
+ kHIDUsage_BCS_TriggerModeLaserOnWhilePulled = 0x65, /* SEL - Trigger Mode Laser on while Pulled */
+ kHIDUsage_BCS_TriggerModeLaserStaysOnAfterTriggerRelease = 0x66, /* SEL - Trigger Mode Laser stays on after Trigger Release */
+ /* Reserved 0x67 - 0x6C */
+ kHIDUsage_BCS_CommitParametersToNVM = 0x6D, /* DF - Commit Parameters to NVM */
+ kHIDUsage_BCS_ParameterScanning = 0x6E, /* DF - Parameter Scanning */
+ kHIDUsage_BCS_ParametersChanged = 0x6F, /* OOC - Parameters Changed */
+ kHIDUsage_BCS_SetParameterDefaultValues = 0x70, /* DF - Set parameter default values */
+ /* Reserved 0x71 - 0x74 */
+ kHIDUsage_BCS_ScannerInCradle = 0x75, /* OOC - Scanner In Cradle */
+ kHIDUsage_BCS_ScannerInRange = 0x76, /* OOC - Scanner In Range */
+ /* Reserved 0x77 - 0x79 */
+ kHIDUsage_BCS_AimDuration = 0x7A, /* DV - Aim Duration */
+ kHIDUsage_BCS_GoodReadLampDuration = 0x7B, /* DV - Good Read Lamp Duration */
+ kHIDUsage_BCS_GoodReadLampIntensity = 0x7C, /* DV - Good Read Lamp Intensity */
+ kHIDUsage_BCS_GoodReadLED = 0x7D, /* DF - Good Read LED */
+ kHIDUsage_BCS_GoodReadToneFrequency = 0x7E, /* DV - Good Read Tone Frequency*/
+ kHIDUsage_BCS_GoodReadToneLength = 0x7F, /* DV - Good Read Tone Length */
+ kHIDUsage_BCS_GoodReadToneVolume = 0x80, /* DV - Good Read Tone Volume */
+ /* Reserved 0x81 */
+ kHIDUsage_BCS_NoReadMessage = 0x82, /* DF - No Read Message */
+ kHIDUsage_BCS_NotOnFileVolume = 0x83, /* DV - Not on File Volume */
+ kHIDUsage_BCS_PowerupBeep = 0x84, /* DF - Powerup Beep */
+ kHIDUsage_BCS_SoundErrorBeep = 0x85, /* DF - Sound Error Beep */
+ kHIDUsage_BCS_SoundGoodReadBeep = 0x86, /* DF - Sound Good Read Beep */
+ kHIDUsage_BCS_SoundNotOnFileBeep = 0x87, /* DF - Sound Not On File Beep */
+ kHIDUsage_BCS_GoodReadWhenToWrite = 0x88, /* NArry - Good Read When to Write */
+ kHIDUsage_BCS_GRWTIAfterDecode = 0x89, /* SEL - GRWTI After Decode */
+ kHIDUsage_BCS_GRWTIBeep_LampAfterTransmit = 0x8A, /* SEL - GRWTI Beep/Lamp after transmit */
+ kHIDUsage_BCS_GRWTINoBeep_LampUseAtAll = 0x8B, /* SEL - GRWTI No Beep/Lamp at all */
+ /* Reserved 0x8C - 0x90 */
+ kHIDUsage_BCS_BooklandEAN = 0x91, /* DF - Bookland EAN */
+ kHIDUsage_BCS_ConvertEAN8To13Type = 0x92, /* DF - Convert EAN 8 to 13 Type */
+ kHIDUsage_BCS_ConvertUPCAToEAN_13 = 0x93, /* DF - Convert UPC A to EAN-13 */
+ kHIDUsage_BCS_ConvertUPC_EToA = 0x94, /* DF - Convert UPC-E to A */
+ kHIDUsage_BCS_EAN_13 = 0x95, /* DF - EAN-13 */
+ kHIDUsage_BCS_EAN_8 = 0x96, /* DF - EAN_8 */
+ kHIDUsage_BCS_EAN_99_128_Mandatory = 0x97, /* DF - EAN-99 128_Mandatory */
+ kHIDUsage_BCS_EAN_99_P5_128_Optional = 0x98, /* DF - EAN-99 P5/128_Optional */
+ /* Reserved 0x99 */
+ kHIDUsage_BCS_UPC_EAN = 0x9A, /* DF - UPC/EAN */
+ kHIDUsage_BCS_UPC_EANCouponCode = 0x9B, /* DF - UPC/EAN Coupon Code */
+ kHIDUsage_BCS_UPC_EANPeriodicals = 0x9C, /* DV - UPC/EAN Periodicals */
+ kHIDUsage_BCS_UPC_A = 0x9D, /* DF - UPC-A */
+ kHIDUsage_BCS_UPC_AWith128Mandatory = 0x9E, /* DF - UPC-A with 128 Mandatory */
+ kHIDUsage_BCS_UPC_AWith128Optical = 0x9F, /* DF - UPC-A with 128 Optical */
+ kHIDUsage_BCS_UPC_AWithP5Optional = 0xA0, /* DF - UPC-A with P5 Optional */
+ kHIDUsage_BCS_UPC_E = 0xA1, /* DF - UPC-E */
+ kHIDUsage_BCS_UPC_E1 = 0xA2, /* DF - UPC-E1 */
+ /* Reserved 0xA3 - 0xA8 */
+ kHIDUsage_BCS_Periodical = 0xA9, /* NArry - Periodical */
+ kHIDUsage_BCS_PeriodicalAutoDiscriminatePlus2 = 0xAA,/* SEL - Periodical Auto-Discriminate + 2 */
+ kHIDUsage_BCS_PeriodicalOnlyDecodeWithPlus2 = 0xAB, /* SEL - Periodical Only Decode with + 2 */
+ kHIDUsage_BCS_PeriodicalIgnorePlus2 = 0xAC, /* SEL - Periodical Ignore + 2 */
+ kHIDUsage_BCS_PeriodicalAutoDiscriminatePlus5 = 0xAD,/* SEL - Periodical Auto-Discriminate + 5 */
+ kHIDUsage_BCS_PeriodicalOnlyDecodeWithPlus5 = 0xAE, /* SEL - Periodical Only Decode with + 5 */
+ kHIDUsage_BCS_PeriodicalIgnorePlus5 = 0xAF, /* SEL - Periodical Ignore + 5 */
+ kHIDUsage_BCS_Check = 0xB0, /* NArry - Check */
+ kHIDUsage_BCS_CheckDisablePrice = 0xB1, /* SEL - Check Disable Price */
+ kHIDUsage_BCS_CheckEnable4DigitPrice = 0xB2, /* SEL - Check Enable 4 digit Price */
+ kHIDUsage_BCS_CheckEnable5DigitPrice = 0xB3, /* SEL - Check Enable 5 digit Price */
+ kHIDUsage_BCS_CheckEnableEuropean4DigitPrice = 0xB4,/* SEL - Check Enable European 4 digit Price */
+ kHIDUsage_BCS_CheckEnableEuropean5DigitPrice = 0xB5,/* SEL - Check Enable European 5 digit Price */
+ /* Reserved 0xB6 */
+ kHIDUsage_BCS_EANTwoLabel = 0xB7, /* DF - EAN Two Label */
+ kHIDUsage_BCS_EANThreeLabel = 0xB8, /* DF - EAN Thread Label */
+ kHIDUsage_BCS_EAN8FlagDigit1 = 0xB9, /* DV - EAN 8 Flag Digit 1 */
+ kHIDUsage_BCS_EAN8FlagDigit2 = 0xBA, /* DV - EAN 8 Flag Digit 2 */
+ kHIDUsage_BCS_EAN8FlagDigit3 = 0xBB, /* DV - EAN 8 Flag Digit 3 */
+ kHIDUsage_BCS_EAN13FlagDigit1 = 0xBC, /* DV - EAN 13 Flag Digit 1 */
+ kHIDUsage_BCS_EAN13FlagDigit2 = 0xBD, /* DV - EAN 13 Flag Digit 2 */
+ kHIDUsage_BCS_EAN13FlagDigit3 = 0xBE, /* DV - EAN 13 Flag Digit 3 */
+ kHIDUsage_BCS_AddEAN2_3LabelDefinition = 0xBF, /* DF - Add EAN 2/3 Label Definition */
+ kHIDUsage_BCS_ClearAllEAN2_3LabelDefinitions = 0xC0,/* DF - Clear all EAN 2/3 Label Definitions */
+ /* Reserved 0xC1 - 0xC2 */
+ kHIDUsage_BCS_Codabar = 0xC3, /* DF - Codabar */
+ kHIDUsage_BCS_Code128 = 0xC4, /* DF - Code 128 */
+ /* Reserved 0xC5 - 0xC6 */
+ kHIDUsage_BCS_Code39 = 0xC7, /* DF - Code 39 */
+ kHIDUsage_BCS_Code93 = 0xC8, /* DF - Code 93 */
+ kHIDUsage_BCS_FullASCIIConversion = 0xC9, /* DF - Full ASCII Conversion */
+ kHIDUsage_BCS_Interleaved2of5 = 0xCA, /* DF - Interleaved 2 of 5 */
+ kHIDUsage_BCS_ItalianPharmacyCode = 0xCB, /* DF - Italian Pharmacy Code */
+ kHIDUsage_BCS_MSI_Plessey = 0xCC, /* DF - MSI/Plessey */
+ kHIDUsage_BCS_Standard2of5IATA = 0xCD, /* DF - Standard 2 of 5 IATA */
+ kHIDUsage_BCS_Standard2of5 = 0xCE, /* DF - Standard 2 of 5 */
+ /* Reserved 0xCF - 0xD2 */
+ kHIDUsage_BCS_TransmitStart_Stop = 0xD3, /* DF - Transmit Start/Stop */
+ kHIDUsage_BCS_TriOptic = 0xD4, /* DF - Tri-Optic */
+ kHIDUsage_BCS_UCC_EAN_128 = 0xD5, /* DF - UCC/EAN-128 */
+ kHIDUsage_BCS_CheckDigit = 0xD6, /* NArry - Check Digit */
+ kHIDUsage_BCS_CheckDigitDisable = 0xD7, /* SEL - Check Digit Disable */
+ kHIDUsage_BCS_CheckDigitEnableInterleaved2of5OPCC = 0xD8, /* SEL - Check Digit Enable Interleaved 2 of 5 OPCC */
+ kHIDUsage_BCS_CheckDigitEnableInterleaved2of5USS = 0xD9, /* SEL - Check Digit Enable Interleaved 2 of 5 USS */
+ kHIDUsage_BCS_CheckDigitEnableStandard2of5OPCC = 0xD8, /* SEL - Check Digit Enable Standard 2 of 5 OPCC */
+ kHIDUsage_BCS_CheckDigitEnableStandard2of5USS = 0xD9, /* SEL - Check Digit Enable Standard 2 of 5 USS */
+ kHIDUsage_BCS_CheckDigitEnableOneMSIPlessey = 0xDC, /* SEL - Check Digit Enable One MSI Plessey */
+ kHIDUsage_BCS_CheckDigitEnableTwoMSIPlessey = 0xDD, /* SEL - Check Digit Enable Two MSI Plessey */
+ kHIDUsage_BCS_CheckDigitCodabarEnable = 0xDE, /* SEL - Check Digit Codabar Enable */
+ kHIDUsage_BCS_CheckDigitCode99Enable = 0xDF, /* SEL - Check Digit Code 99 Enable */
+ /* Reserved 0xE0 - 0xEF */
+ kHIDUsage_BCS_TransmitCheckDigit = 0xF0, /* NArry - Transmit Check Digit */
+ kHIDUsage_BCS_DisableCheckDigitTransmit = 0xF1, /* SEL - Disable Check Digit Transmit */
+ kHIDUsage_BCS_EnableCheckDigitTransmit = 0xF2, /* SEL - Enable Check Digit Transmit */
+ /* Reserved 0xF3 - 0xFA */
+ kHIDUsage_BCS_SymbologyIdentifier1 = 0xFB, /* DV - Symbology Identifier 1 */
+ kHIDUsage_BCS_SymbologyIdentifier2 = 0xFC, /* DV - Symbology Identifier 2 */
+ kHIDUsage_BCS_SymbologyIdentifier3 = 0xFD, /* DV - Symbology Identifier 3 */
+ kHIDUsage_BCS_DecodedData = 0xFE, /* DV - Decoded Data */
+ kHIDUsage_BCS_DecodeDataContinued = 0xFF, /* DF - Decode Data Continued */
+ kHIDUsage_BCS_BarSpaceData = 0x100, /* DV - Bar Space Data */
+ kHIDUsage_BCS_ScannerDataAccuracy = 0x101, /* DV - Scanner Data Accuracy */
+ kHIDUsage_BCS_RawDataPolarity = 0x102, /* NArry - Raw Data Polarity */
+ kHIDUsage_BCS_PolarityInvertedBarCode = 0x103, /* SEL - Polarity Inverted Bar Code */
+ kHIDUsage_BCS_PolarityNormalBarCode = 0x103, /* SEL - Polarity Normal Bar Code */
+ /* Reserved 0x105 */
+ kHIDUsage_BCS_MinimumLengthToDecode = 0x106, /* DV - Minimum Length to Decode */
+ kHIDUsage_BCS_MaximumLengthToDecode = 0x107, /* DV - Maximum Length to Decode */
+ kHIDUsage_BCS_FirstDiscreteLengthToDecode = 0x108, /* DV - First Discrete Length to Decode */
+ kHIDUsage_BCS_SecondDiscreteLengthToDecode = 0x109, /* DV - Second Discrete Length to Decode */
+ kHIDUsage_BCS_DataLengthMethod = 0x10A, /* NArry - Data Length Method */
+ kHIDUsage_BCS_DLMethodReadAny = 0x10B, /* DF - DL Method Read any */
+ kHIDUsage_BCS_DLMethodCheckInRange = 0x10C, /* DF - DL Method Check in Range */
+ kHIDUsage_BCS_DLMethodCheckForDiscrete = 0x10D, /* DF - DL Method Check for Discrete */
+ /* Reserved 0x10E - 0x10F */
+ kHIDUsage_BCS_AztecCode = 0x110, /* DF - Aztec Code */
+ kHIDUsage_BCS_BC412 = 0x111, /* DF - BC412 */
+ kHIDUsage_BCS_ChannelCode = 0x112, /* DF - Channel Code */
+ kHIDUsage_BCS_Code16 = 0x113, /* DF - Code 16 */
+ kHIDUsage_BCS_Code32 = 0x114, /* DF - Code 32 */
+ kHIDUsage_BCS_Code49 = 0x115, /* DF - Code 49 */
+ kHIDUsage_BCS_CodeOne = 0x116, /* DF - Code One */
+ kHIDUsage_BCS_Colorcode = 0x117, /* DF - Colorcode */
+ kHIDUsage_BCS_DataMatrix = 0x118, /* DF - Data Matrix */
+ kHIDUsage_BCS_MaxiCode = 0x119, /* DF - MaxiCode */
+ kHIDUsage_BCS_MicroPDF = 0x11A, /* DF - MicroPDF */
+ kHIDUsage_BCS_PDF_417 = 0x11B, /* DF - PDF-417 */
+ kHIDUsage_BCS_PosiCode = 0x11C, /* DF - PosiCode */
+ kHIDUsage_BCS_QRCode = 0x11D, /* DF - QR Code */
+ kHIDUsage_BCS_SuperCode = 0x11E, /* DF - SuperCode */
+ kHIDUsage_BCS_UltraCode = 0x11F, /* DF - UltraCode */
+ kHIDUsage_BCS_USB_5_SlugCode = 0x120, /* DF - USD-5 (Slug Code) */
+ kHIDUsage_BCS_VeriCode = 0x121 /* DF - VeriCode */
+ /* Reserved 0x122 - 0xFFFF */
+};
+
+/* Weighing Devices Page (0x8D) */
+/* This section provides detailed descriptions of the usages employed by Weighing Devices. */
+enum
+{
+ kHIDUsage_WD_Undefined = 0x00, /* Weighing Device Undefined Usage */
+ kHIDUsage_WD_WeighingDevice = 0x01, /* CA - Weighing Device */
+ /* Reserved 0x02 - 0x1F */
+ kHIDUsage_WD_ScaleScaleDevice = 0x20, /* CL - Scale Device */
+ kHIDUsage_WD_ScaleScaleClassIMetricCL = 0x21, /* CL - Scale Class I Metric */
+ kHIDUsage_WD_ScaleScaleClassIMetric = 0x22, /* SEL - Scale Class I Metric */
+ kHIDUsage_WD_ScaleScaleClassIIMetric = 0x23, /* SEL - Scale Class II Metric */
+ kHIDUsage_WD_ScaleScaleClassIIIMetric = 0x24, /* SEL - Scale Class III Metric */
+ kHIDUsage_WD_ScaleScaleClassIIILMetric = 0x25, /* SEL - Scale Class IIIL Metric */
+ kHIDUsage_WD_ScaleScaleClassIVMetric = 0x26, /* SEL - Scale Class IV Metric */
+ kHIDUsage_WD_ScaleScaleClassIIIEnglish = 0x27, /* SEL - Scale Class III English */
+ kHIDUsage_WD_ScaleScaleClassIIILEnglish = 0x28, /* SEL - Scale Class IIIL English */
+ kHIDUsage_WD_ScaleScaleClassIVEnglish = 0x29, /* SEL - Scale Class IV English */
+ kHIDUsage_WD_ScaleScaleClassGeneric = 0x2A, /* SEL - Scale Class Generic */
+ /* Reserved 0x2B - 0x2F */
+ kHIDUsage_WD_ScaleAtrributeReport = 0x30, /* CL - Scale Attribute Report */
+ kHIDUsage_WD_ScaleControlReport = 0x31, /* CL - Scale Control Report */
+ kHIDUsage_WD_ScaleDataReport = 0x32, /* CL - Scale Data Report */
+ kHIDUsage_WD_ScaleStatusReport = 0x33, /* CL - Scale Status Report */
+ kHIDUsage_WD_ScaleWeightLimitReport = 0x34, /* CL - Scale Weight Limit Report */
+ kHIDUsage_WD_ScaleStatisticsReport = 0x35, /* CL - Scale Statistics Report */
+ /* Reserved 0x36 - 0x3F */
+ kHIDUsage_WD_DataWeight = 0x40, /* DV - Data Weight */
+ kHIDUsage_WD_DataScaling = 0x41, /* DV - Data Scaling */
+ /* Reserved 0x42 - 0x4F */
+ kHIDUsage_WD_WeightUnit = 0x50, /* CL - Weight Unit */
+ kHIDUsage_WD_WeightUnitMilligram = 0x51, /* SEL - Weight Unit Milligram */
+ kHIDUsage_WD_WeightUnitGram = 0x52, /* SEL - Weight Unit Gram */
+ kHIDUsage_WD_WeightUnitKilogram = 0x53, /* SEL - Weight Unit Kilogram */
+ kHIDUsage_WD_WeightUnitCarats = 0x54, /* SEL - Weight Unit Carats */
+ kHIDUsage_WD_WeightUnitTaels = 0x55, /* SEL - Weight Unit Taels */
+ kHIDUsage_WD_WeightUnitGrains = 0x56, /* SEL - Weight Unit Grains */
+ kHIDUsage_WD_WeightUnitPennyweights = 0x57, /* SEL - Weight Unit Pennyweights */
+ kHIDUsage_WD_WeightUnitMetricTon = 0x58, /* SEL - Weight Unit Metric Ton */
+ kHIDUsage_WD_WeightUnitAvoirTon = 0x59, /* SEL - Weight Unit Avoir Ton */
+ kHIDUsage_WD_WeightUnitTroyOunce = 0x5A, /* SEL - Weight Unit Troy Ounce */
+ kHIDUsage_WD_WeightUnitOunce = 0x5B, /* SEL - Weight Unit Ounce */
+ kHIDUsage_WD_WeightUnitPound = 0x5C, /* SEL - Weight Unit Pound */
+ /* Reserved 0x5D - 0x5F */
+ kHIDUsage_WD_CalibrationCount = 0x60, /* DV - Calibration Count */
+ kHIDUsage_WD_RezeroCount = 0x61, /* DV - Re-Zero Count*/
+ /* Reserved 0x62 - 0x6F */
+ kHIDUsage_WD_ScaleStatus = 0x70, /* CL - Scale Status */
+ kHIDUsage_WD_ScaleStatusFault = 0x71, /* SEL - Scale Status Fault */
+ kHIDUsage_WD_ScaleStatusStableAtZero = 0x72, /* SEL - Scale Status Stable at Center of Zero */
+ kHIDUsage_WD_ScaleStatusInMotion = 0x73, /* SEL - Scale Status In Motion */
+ kHIDUsage_WD_ScaleStatusWeightStable = 0x74, /* SEL - Scale Status Weight Stable */
+ kHIDUsage_WD_ScaleStatusUnderZero = 0x75, /* SEL - Scale Status Under Zero */
+ kHIDUsage_WD_ScaleStatusOverWeightLimit = 0x76, /* SEL - Scale Status Over Weight Limit */
+ kHIDUsage_WD_ScaleStatusRequiresCalibration = 0x77, /* SEL - Scale Status Requires Calibration */
+ kHIDUsage_WD_ScaleStatusRequiresRezeroing = 0x78, /* SEL - Scale Status Requires Re-zeroing */
+ /* Reserved 0x79 - 0x7F */
+ kHIDUsage_WD_ZeroScale = 0x80, /* OOC - Zero Scale */
+ kHIDUsage_WD_EnforcedZeroReturn = 0x81 /* OOC - Enforced Zero Return */
+ /* Reserved 0x82 - 0xFFFF */
+
+};
+
+/* Magnetic Stripe Reader Page (0x8E) */
+/* This section provides detailed descriptions of the usages employed by Magnetic Stripe Reader Devices. */
+enum
+{
+ kHIDUsage_MSR_Undefined = 0x00, /* MagStripe Undefined Usage */
+ kHIDUsage_MSR_DeviceReadOnly = 0x01, /* CA - MSR Device Read-Only */
+ /* Reserved 0x02 - 0x10 */
+ kHIDUsage_MSR_Track1Length = 0x11, /* SF, DF, SEL - Track 1 Length */
+ kHIDUsage_MSR_Track2Length = 0x12, /* SF, DF, SEL - Track 2 Length */
+ kHIDUsage_MSR_Track3Length = 0x13, /* SF, DF, SEL - Track 3 Length */
+ kHIDUsage_MSR_TrackJISLength = 0x14, /* SF, DF, SEL - Track JIS Length */
+ /* Reserved 0x15 - 0x1F */
+ kHIDUsage_MSR_TrackData = 0x20, /* SF, DF, SEL - Track Data */
+ kHIDUsage_MSR_Track1Data = 0x21, /* SF, DF, SEL - Track 1 Data */
+ kHIDUsage_MSR_Track2Data = 0x22, /* SF, DF, SEL - Track 2 Data */
+ kHIDUsage_MSR_Track3Data = 0x23, /* SF, DF, SEL - Track 3 Data */
+ kHIDUsage_MSR_TrackJISData = 0x24 /* SF, DF, SEL - Track JIS Data */
+ /* Reserved 0x25 - 0xFFFF */
+};
+
+/* Camera Control Page (0x90) */
+enum
+{
+ kHIDUsage_CC_Undefined = 0x00, /* Camera Control Undefined Usage */
+ /* Reserved 0x01 - 0x1F */
+ kHIDUsage_CC_Autofocus = 0x20, /* One-Shot Control */
+ kHIDUsage_CC_Shutter = 0x21, /* One-Shot Control */
+};
+
+#endif /* _IOHIDUSAGETABLES_H */
diff --git a/include/IOKit/hid/IOHIDUserDevice.h b/include/IOKit/hid/IOHIDUserDevice.h
new file mode 100644
index 0000000..3f6f8ca
--- /dev/null
+++ b/include/IOKit/hid/IOHIDUserDevice.h
@@ -0,0 +1,69 @@
+/*
+ *
+ * @APPLE_LICENSE_HEADER_START@
+ *
+ * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
+ *
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * @APPLE_LICENSE_HEADER_END@
+ */
+
+#ifndef _IOKIT_HID_IOHIDUSERDEVICE_USER_H
+#define _IOKIT_HID_IOHIDUSERDEVICE_USER_H
+
+#include
+#include
+
+__BEGIN_DECLS
+
+typedef struct __IOHIDUserDevice * IOHIDUserDeviceRef;
+
+/*!
+ @function IOHIDUserDeviceGetTypeID
+ @abstract Returns the type identifier of all IOHIDUserDevice instances.
+*/
+CF_EXPORT
+CFTypeID IOHIDUserDeviceGetTypeID(void);
+
+/*!
+ @function IOHIDUserDeviceCreate
+ @abstract Creates an virtual IOHIDDevice in the kernel.
+ @discussion The io_service_t passed in this method must reference an object
+ in the kernel of type IOHIDUserDevice.
+ @param allocator Allocator to be used during creation.
+ @param properties CFDictionaryRef containing device properties index by keys defined in IOHIDKeys.h.
+ @result Returns a new IOHIDUserDeviceRef.
+*/
+CF_EXPORT
+IOHIDUserDeviceRef IOHIDUserDeviceCreate(
+ CFAllocatorRef allocator,
+ CFDictionaryRef properties);
+
+
+/*!
+ @function IOHIDUserDeviceHandleReport
+ @abstract Dispatch a report to the IOHIDUserDevice.
+*/
+CF_EXPORT
+IOReturn IOHIDUserDeviceHandleReport(
+ IOHIDUserDeviceRef device,
+ uint8_t * report,
+ CFIndex reportLength);
+
+__END_DECLS
+
+#endif /* _IOKIT_HID_IOHIDUSERDEVICE_USER_H */
diff --git a/include/IOKit/hidsystem/IOHIDEventSystemClient.h b/include/IOKit/hidsystem/IOHIDEventSystemClient.h
new file mode 100644
index 0000000..ab31e2c
--- /dev/null
+++ b/include/IOKit/hidsystem/IOHIDEventSystemClient.h
@@ -0,0 +1,118 @@
+/*
+ * Copyright (c) 2016 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_LICENSE_HEADER_START@
+ *
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * @APPLE_LICENSE_HEADER_END@
+ */
+
+#ifndef IOHIDEventSystemClient_h
+#define IOHIDEventSystemClient_h
+
+#include
+
+__BEGIN_DECLS
+CF_ASSUME_NONNULL_BEGIN
+CF_IMPLICIT_BRIDGING_ENABLED
+
+/*!
+ @header IOHIDEventSystemClient
+
+ IOHIDEventSystemClient serves as a client that can be used
+ for reading/writing specific properties of the HID event system, as
+ well as getting services of the HID event system. A list of accessible
+ properties can be found in IOKit/hid/IOHIDProperties.h.
+
+ @seealso IOKit/hidsystem/IOHIDServiceClient.h
+ */
+
+typedef struct CF_BRIDGED_TYPE(id) __IOHIDEventSystemClient * IOHIDEventSystemClientRef;
+
+/*!
+ * @function IOHIDEventSystemClientCreateSimpleClient
+ *
+ * @abstract Creates a client of the HID event system that has to ability to read/write certain
+ * properties.
+ *
+ * @discussion Certain properties have the ability to be set/read by clients, see
+ * IOHIDProperties.h for a list of these properties.
+ *
+ * @param allocator a custom allocator reference to be used for allocation of the result.
+ *
+ * @result Returns a IOHIDEventSystemClientRef on success.
+ * Caller should CFRelease the client when they are finished with it, or keep a
+ * reference to the client if multiple properties need to be set/read.
+ */
+IOHIDEventSystemClientRef IOHIDEventSystemClientCreateSimpleClient(CFAllocatorRef _Nullable allocator);
+
+/*!
+ * @function IOHIDEventSystemClientSetProperty
+ *
+ * @abstract Sets a property on the HID event system.
+ *
+ * @param client the HID client that created via IOHIDEventSystemClientCreateSimpleClient().
+ *
+ * @param key the property key to set. A list of keys can be found in HIDProperties.h.
+ *
+ * @param property the value to set the property.
+ *
+ * @result Returns true on success.
+ */
+Boolean IOHIDEventSystemClientSetProperty(IOHIDEventSystemClientRef client, CFStringRef key, CFTypeRef property);
+
+/*!
+ * @function IOHIDEventSystemClientCopyProperty
+ *
+ * @abstract Copies a property from the HID event system.
+ *
+ * @param client the HID client created via IOHIDEventSystemClientCreateSimpleClient().
+ *
+ * @param key the property key to copy. A list of keys can be found in HIDProperties.h.
+ *
+ * @result Returns a CFTypeRef of the property to be copied on success, otherwise NULL.
+ * Caller is responsible for calling CFRelease on the property.
+ */
+CFTypeRef _Nullable IOHIDEventSystemClientCopyProperty(IOHIDEventSystemClientRef client, CFStringRef key);
+
+/*!
+ * @function IOHIDEventSystemClientGetTypeID
+ *
+ * @result Returns the CFTypeID of the IOHIDEventSystemClient class.
+ */
+CFTypeID IOHIDEventSystemClientGetTypeID(void);
+
+/*!
+ * @function IOHIDEventSystemClientCopyServices
+ *
+ * @abstract Copies all services available to the client.
+ *
+ * @discussion Useful for seeing services that are available. Clients can further probe
+ * the services with the APIs available in IOHIDServiceClient.h.
+ *
+ * @param client the HID client that created via IOHIDEventSystemClientCreateSimpleClient().
+ *
+ * @result On success, returns a CFArrayRef of IOHIDServiceClientRefs that are
+ * available to the client. Caller is responsible for releasing the array.
+ */
+CFArrayRef _Nullable IOHIDEventSystemClientCopyServices(IOHIDEventSystemClientRef client);
+
+CF_IMPLICIT_BRIDGING_DISABLED
+CF_ASSUME_NONNULL_END
+__END_DECLS
+
+#endif /* IOHIDEventSystemClient_h */
diff --git a/include/IOKit/hidsystem/IOHIDLib.h b/include/IOKit/hidsystem/IOHIDLib.h
new file mode 100644
index 0000000..eafe017
--- /dev/null
+++ b/include/IOKit/hidsystem/IOHIDLib.h
@@ -0,0 +1,220 @@
+/*
+ * Copyright (c) 1999-2009 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_LICENSE_HEADER_START@
+ *
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * @APPLE_LICENSE_HEADER_END@
+ */
+/*
+ * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
+ *
+ * HISTORY
+ *
+ */
+
+#ifndef _IOKIT_IOHIDLIB_H
+#define _IOKIT_IOHIDLIB_H
+
+#include
+#include
+
+__BEGIN_DECLS
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+extern kern_return_t
+IOHIDCreateSharedMemory( io_connect_t connect,
+ unsigned int version );
+
+extern kern_return_t
+IOHIDSetEventsEnable( io_connect_t connect,
+ boolean_t enable );
+
+extern kern_return_t
+IOHIDSetCursorEnable( io_connect_t connect,
+ boolean_t enable );
+
+enum {
+ // Options for IOHIDPostEvent()
+ kIOHIDSetGlobalEventFlags = 0x00000001,
+ kIOHIDSetCursorPosition = 0x00000002,
+ kIOHIDSetRelativeCursorPosition = 0x00000004,
+ kIOHIDPostHIDManagerEvent = 0x00000008
+};
+
+extern kern_return_t
+IOHIDPostEvent( io_connect_t connect,
+ UInt32 eventType,
+ IOGPoint location,
+ const NXEventData * eventData,
+ UInt32 eventDataVersion,
+ IOOptionBits eventFlags,
+ IOOptionBits options );
+
+extern kern_return_t
+IOHIDSetMouseLocation( io_connect_t connect, int x, int y);
+
+extern kern_return_t
+IOHIDGetButtonEventNum( io_connect_t connect,
+ NXMouseButton button, int * eventNum ) __deprecated;
+
+extern kern_return_t
+IOHIDGetScrollAcceleration( io_connect_t handle, double * acceleration ) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_12, __IPHONE_NA, __IPHONE_NA);
+
+extern kern_return_t
+IOHIDSetScrollAcceleration( io_connect_t handle, double acceleration ) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_12, __IPHONE_NA, __IPHONE_NA);
+
+extern kern_return_t
+IOHIDGetMouseAcceleration( io_connect_t handle, double * acceleration ) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_12, __IPHONE_NA, __IPHONE_NA);
+
+extern kern_return_t
+IOHIDSetMouseAcceleration( io_connect_t handle, double acceleration ) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_12, __IPHONE_NA, __IPHONE_NA);
+
+extern kern_return_t
+IOHIDGetMouseButtonMode( io_connect_t handle, int * mode );
+
+extern kern_return_t
+IOHIDSetMouseButtonMode( io_connect_t handle, int mode ) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_12, __IPHONE_NA, __IPHONE_NA);
+
+extern kern_return_t
+IOHIDGetAccelerationWithKey( io_connect_t handle, CFStringRef key, double * acceleration ) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_12, __IPHONE_NA, __IPHONE_NA);
+
+extern kern_return_t
+IOHIDSetAccelerationWithKey( io_connect_t handle, CFStringRef key, double acceleration ) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_12, __IPHONE_NA, __IPHONE_NA);
+
+extern kern_return_t
+IOHIDGetParameter( io_connect_t handle, CFStringRef key, IOByteCount maxSize,
+ void * bytes, IOByteCount * actualSize ) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_12, __IPHONE_2_0, __IPHONE_10_0);
+
+extern kern_return_t
+IOHIDSetParameter( io_connect_t handle, CFStringRef key,
+ const void * bytes, IOByteCount size ) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_12, __IPHONE_NA, __IPHONE_NA);
+
+extern kern_return_t
+IOHIDCopyCFTypeParameter( io_connect_t handle, CFStringRef key,
+ CFTypeRef * parameter );
+
+extern kern_return_t
+IOHIDSetCFTypeParameter( io_connect_t handle, CFStringRef key,
+ CFTypeRef parameter );
+
+// selectors are found in IOHIDParameter.h
+extern kern_return_t
+IOHIDGetModifierLockState( io_connect_t handle, int selector, bool *state );
+
+extern kern_return_t
+IOHIDSetModifierLockState( io_connect_t handle, int selector, bool state );
+
+extern kern_return_t
+IOHIDGetStateForSelector( io_connect_t handle, int selector, UInt32 *state );
+
+extern kern_return_t
+IOHIDSetStateForSelector( io_connect_t handle, int selector, UInt32 state );
+
+// Used by Window Server only
+extern kern_return_t
+IOHIDRegisterVirtualDisplay( io_connect_t handle, UInt32 *display_token );
+
+extern kern_return_t
+IOHIDUnregisterVirtualDisplay( io_connect_t handle, UInt32 display_token );
+
+extern kern_return_t
+IOHIDSetVirtualDisplayBounds( io_connect_t handle, UInt32 display_token, const IOGBounds * bounds );
+
+extern kern_return_t
+IOHIDGetActivityState( io_connect_t handle, bool *hidActivityIdle );
+
+/*
+ * @typedef IOHIDRequestType
+ *
+ * @abstract
+ * Request type passed in to IOHIDCheckAccess/IOHIDRequestAccess.
+ *
+ * @field kIOHIDRequestTypePostEvent
+ * Request to post event through IOHIDPostEvent API. Access must be granted
+ * by the user to use this API. If you do not request access through the
+ * IOHIDRequestAccess call, the request will be made on the process's behalf
+ * in the IOHIDPostEvent call.
+ *
+ * @field kIOHIDRequestTypeListenEvent
+ * Request to listen to event through IOHIDManager/IOHIDDevice API. Access must
+ * be granted by the user to use this API. If you do not request access through
+ * the IOHIDRequestAccess call, the request will be made on the process's behalf
+ * in IOHIDManagerOpen/IOHIDDeviceOpen calls.
+ *
+ */
+typedef enum {
+ kIOHIDRequestTypePostEvent,
+ kIOHIDRequestTypeListenEvent
+} IOHIDRequestType;
+
+/*
+ * @typedef IOHIDAccessType
+ *
+ * @abstract
+ * Enumerator of access types returned from IOHIDCheckAccess.
+ */
+typedef enum {
+ kIOHIDAccessTypeGranted,
+ kIOHIDAccessTypeDenied,
+ kIOHIDAccessTypeUnknown
+} IOHIDAccessType;
+
+/*!
+ * @function IOHIDCheckAccess
+ *
+ * @abstract
+ * Checks if the process has access to a specific IOHIDRequestType. A process
+ * may request access by calling the IOHIDRequestAccess function.
+ *
+ * @param requestType
+ * The request type defined in the IOHIDRequestType enumerator.
+ *
+ * @result
+ * Returns an access type defined in the IOHIDAccessType enumerator.
+ */
+IOHIDAccessType IOHIDCheckAccess(IOHIDRequestType requestType)
+__OSX_AVAILABLE(10.15) __IOS_AVAILABLE(13.0) __TVOS_AVAILABLE(13.0) __WATCHOS_AVAILABLE(6.0);
+
+/*!
+ * @function IOHIDRequestAccess
+ *
+ * @abstract
+ * Requests access from the user for a specific IOHIDRequestType.
+ *
+ * @discussion
+ * Processes that wish to post events through the IOHIDPostEvent API, or receive
+ * reports through the IOHIDManager/IOHIDDevice API must be granted access first
+ * by the user. If you do not call this API, it will be called on your behalf
+ * when the API are used.
+ *
+ * @param requestType
+ * The request type defined in the IOHIDRequestType enumerator.
+ *
+ * @result
+ * Returns true if access was granted.
+ */
+bool IOHIDRequestAccess(IOHIDRequestType requestType)
+__OSX_AVAILABLE(10.15) __IOS_AVAILABLE(13.0) __TVOS_AVAILABLE(13.0) __WATCHOS_AVAILABLE(6.0);
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+__END_DECLS
+
+#endif /* ! _IOKIT_IOHIDLIB_H */
+
diff --git a/include/IOKit/hidsystem/IOHIDParameter.h b/include/IOKit/hidsystem/IOHIDParameter.h
new file mode 100644
index 0000000..c805123
--- /dev/null
+++ b/include/IOKit/hidsystem/IOHIDParameter.h
@@ -0,0 +1,349 @@
+/*
+ * @APPLE_LICENSE_HEADER_START@
+ *
+ * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
+ *
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * @APPLE_LICENSE_HEADER_END@
+ */
+/* Copyright (c) 1992 NeXT Computer, Inc. All rights reserved.
+ *
+ * evsio.h - Get/Set parameter calls for Event Status Driver.
+ *
+ * CAUTION: Developers should stick to the API exported in
+ * to guarantee
+ * binary compatability of their applications in future
+ * releases.
+ *
+ * HISTORY
+ * 22 May 1992 Mike Paquette at NeXT
+ * Created.
+ */
+#ifndef _DEV_EVSIO_H
+#define _DEV_EVSIO_H
+
+/* Public type definitions. */
+#include
+#include
+#include
+
+/*
+ * Identify this driver as one that uses the new driverkit and messaging API
+ */
+#ifndef _NeXT_MACH_EVENT_DRIVER_
+#define _NeXT_MACH_EVENT_DRIVER_ (1)
+#endif /* !_NeXT_MACH_EVENT_DRIVER_ */
+
+/* * */
+
+#define kIOHIDKindKey "HIDKind"
+#define kIOHIDInterfaceIDKey "HIDInterfaceID"
+#define kIOHIDSubinterfaceIDKey "HIDSubinterfaceID"
+#define kIOHIDOriginalSubinterfaceIDKey "HIDOriginalSubinterfaceID"
+
+#define kIOHIDParametersKey "HIDParameters"
+
+#define kIOHIDVirtualHIDevice "HIDVirtualDevice"
+
+#define kIOHIDKeyRepeatKey "HIDKeyRepeat"
+#define kIOHIDInitialKeyRepeatKey "HIDInitialKeyRepeat"
+#define kIOHIDKeyMappingKey "HIDKeyMapping"
+#define kIOHIDResetKeyboardKey "HIDResetKeyboard"
+
+#define kIOHIDKeyboardModifierMappingPairsKey "HIDKeyboardModifierMappingPairs"
+#define kIOHIDKeyboardModifierMappingSrcKey "HIDKeyboardModifierMappingSrc"
+#define kIOHIDKeyboardModifierMappingDstKey "HIDKeyboardModifierMappingDst"
+
+#define kIOHIDKeyboardCapsLockDoesLockKey "HIDKeyboardCapsLockDoesLock"
+#define kIOHIDKeyboardSupportsF12EjectKey "HIDKeyboardSupportsF12Eject"
+#define kIOHIDKeyboardSupportedModifiersKey "HIDKeyboardSupportedModifiers"
+#define kIOHIDKeyboardGlobalModifiersKey "HIDKeyboardGlobalModifiers"
+
+
+//read only property that specify usage of clobal modifiers
+// Bit[0] - Report modifiers to the service by setting kIOHIDKeyboardGlobalModifiersKey with global modifiers
+// Bit[1] - Update/translate events from service taking global modifiers state in consideration
+#define kIOHIDServiceGlobalModifiersUsageKey "HIDServiceGlobalModifiersUsage"
+
+
+#define kIOHIDPointerResolutionKey "HIDPointerResolution"
+#define kIOHIDResetPointerKey "HIDResetPointer"
+#define kIOHIDPointerConvertAbsoluteKey "HIDPointerConvertAbsolute"
+#define kIOHIDPointerContactToMoveKey "HIDPointerContactToMove"
+#define kIOHIDPointerPressureToClickKey "HIDPointerPressureToClick"
+#define kIOHIDPointerButtonCountKey "HIDPointerButtonCount"
+
+#define kIOHIDPointerAccelerationSettingsKey "HIDPointerAccelerationSettings"
+#define kIOHIDPointerAccelerationTableKey "HIDPointerAccelerationTable"
+
+// velocity for pointer acceleration
+#define kIOHIDPointerAccelerationMultiplierKey "HIDPointerAccelerationMultiplier"
+
+
+#define kIOHIDScrollResetKey "HIDScrollReset"
+#define kIOHIDScrollResolutionKey "HIDScrollResolution"
+#define kIOHIDScrollReportRateKey "HIDScrollReportRate"
+#define kIOHIDScrollAccelerationTableKey "HIDScrollAccelerationTable"
+
+#define kIOHIDScrollResolutionXKey "HIDScrollResolutionX"
+#define kIOHIDScrollResolutionYKey "HIDScrollResolutionY"
+#define kIOHIDScrollResolutionZKey "HIDScrollResolutionZ"
+
+#define kIOHIDScrollAccelerationTableXKey "HIDScrollAccelerationTableX"
+#define kIOHIDScrollAccelerationTableYKey "HIDScrollAccelerationTableY"
+#define kIOHIDScrollAccelerationTableZKey "HIDScrollAccelerationTableZ"
+
+#define kIOHIDScrollMouseButtonKey "HIDScrollMouseButton"
+
+#define kIOHIDScrollZoomModifierMaskKey "HIDScrollZoomModifierMask"
+
+#define kIOHIDTrackpadScrollAccelerationKey "HIDTrackpadScrollAcceleration"
+
+#define kIOHIDTrackpadAccelerationType "HIDTrackpadAcceleration"
+
+#define kIOHIDClickTimeKey "HIDClickTime"
+#define kIOHIDClickSpaceKey "HIDClickSpace"
+
+#define kIOHIDWaitCursorFrameIntervalKey "HIDWaitCursorFrameInterval"
+
+#define kIOHIDAutoDimThresholdKey "HIDAutoDimThreshold"
+#define kIOHIDAutoDimStateKey "HIDAutoDimState"
+#define kIOHIDAutoDimTimeKey "HIDAutoDimTime"
+#define kIOHIDIdleTimeKey "HIDIdleTime"
+
+#define kIOHIDBrightnessKey "HIDBrightness"
+#define kIOHIDAutoDimBrightnessKey "HIDAutoDimBrightness"
+
+#define kIOHIDFKeyModeKey "HIDFKeyMode"
+
+// if kIOHIDStickyKeysDisabledKey is 1, then all sticky keys functionality
+// is completely turned off. Multiple shifts will have no effect.
+#define kIOHIDStickyKeysDisabledKey "HIDStickyKeysDisabled"
+
+// if kIOHIDStickyKeysOnKey is 1 then a depressed modifier will stay down
+// until a non-modifer key is pressed (or sticky keys is turned off)
+#define kIOHIDStickyKeysOnKey "HIDStickyKeysOn"
+
+// if kIOHIDStickyKeysShiftTogglesKey is 1, then a sequence of five
+// shift keys in sequence will toggle sticky keys on or off
+#define kIOHIDStickyKeysShiftTogglesKey "HIDStickyKeysShiftToggles"
+
+//
+//
+#define kIOHIDResetStickyKeyNotification "HIDResetStickyKeyNotification"
+
+// if kIOHIDMouseKeysOptionTogglesKey is 1, then a sequence of five
+// option keys in sequence will toggle mouse keys on or off
+#define kIOHIDMouseKeysOptionTogglesKey "HIDMouseKeysOptionToggles"
+
+// kIOHIDSlowKeysDelayKey represents the delay used for slow keys.
+// if kIOHIDSlowKeysDelayKey is 0, then slow keys off
+#define kIOHIDSlowKeysDelayKey "HIDSlowKeysDelay"
+
+#define kIOHIDF12EjectDelayKey "HIDF12EjectDelay"
+
+#define kIOHIDMouseKeysOnKey "HIDMouseKeysOn"
+
+#define kIOHIDUseKeyswitchKey "HIDUseKeyswitch"
+
+#define kIOHIDDisallowRemappingOfPrimaryClickKey "HIDDisallowRemappingOfPrimaryClick"
+#define kIOHIDMouseKeysEnablesVirtualNumPadKey "HIDMouseKeysEnablesVirtualNumPad"
+
+#define kIOHIDResetLEDsKey "HIDResetLEDs"
+
+// Parametric Acceleration Keys
+#define kHIDAccelParametricCurvesKey "HIDAccelCurves"
+#define kHIDPointerReportRateKey "HIDPointerReportRate"
+#define kHIDTrackingAccelParametricCurvesKey "HIDTrackingAccelCurves"
+#define kHIDScrollAccelParametricCurvesKey "HIDScrollAccelCurves"
+#define kHIDAccelParametricCurvesDebugKey "HIDAccelCurvesDebug"
+#define kHIDScrollAccelParametricCurvesDebugKey "HIDScrollAccelCurvesDebug"
+#define kHIDAccelGainLinearKey "HIDAccelGainLinear"
+#define kHIDAccelGainParabolicKey "HIDAccelGainParabolic"
+#define kHIDAccelGainCubicKey "HIDAccelGainCubic"
+#define kHIDAccelGainQuarticKey "HIDAccelGainQuartic"
+#define kHIDAccelTangentSpeedLinearKey "HIDAccelTangentSpeedLinear"
+#define kHIDAccelTangentSpeedParabolicRootKey "HIDAccelTangentSpeedParabolicRoot"
+#define kHIDAccelTangentSpeedCubicRootKey "HIDAccelTangentSpeedCubicRoot"
+#define kHIDAccelTangentSpeedQuarticRootKey "HIDAccelTangentSpeedQuarticRoot"
+#define kHIDAccelIndexKey "HIDAccelIndex"
+
+// Scroll Count Keys
+#define kIOHIDScrollCountMaxTimeDeltaBetweenKey "HIDScrollCountMaxTimeDeltaBetween"
+#define kIOHIDScrollCountMaxTimeDeltaToSustainKey "HIDScrollCountMaxTimeDeltaToSustain"
+#define kIOHIDScrollCountMinDeltaToStartKey "HIDScrollCountMinDeltaToStart"
+#define kIOHIDScrollCountMinDeltaToSustainKey "HIDScrollCountMinDeltaToSustain"
+#define kIOHIDScrollCountIgnoreMomentumScrollsKey "HIDScrollCountIgnoreMomentumScrolls"
+#define kIOHIDScrollCountMouseCanResetKey "HIDScrollCountMouseCanReset"
+#define kIOHIDScrollCountMaxKey "HIDScrollCountMax"
+#define kIOHIDScrollCountAccelerationFactorKey "HIDScrollCountAccelerationFactor"
+#define kIOHIDScrollCountZeroKey "HIDScrollCountZero"
+#define kIOHIDScrollCountBootDefaultKey "HIDScrollCountBootDefault"
+#define kIOHIDScrollCountResetKey "HIDScrollCountReset"
+
+// HIDSystem Property Key
+
+// Mark user activity state on HID System
+#define kIOHIDActivityUserIdleKey "IOHIDActivityUserIdle"
+
+// the following values are used in kIOHIDPointerButtonMode
+typedef enum {
+ kIOHIDButtonMode_BothLeftClicks = 0,
+ kIOHIDButtonMode_ReverseLeftRightClicks = 1,
+ kIOHIDButtonMode_EnableRightClick = 2
+} IOHIDButtonModes;
+
+#ifdef _undef
+#define EVS_PREFIX "Evs_" /* All EVS calls start with this string */
+
+/* WaitCursor-related ioctls */
+
+#define EVSIOSWT "Evs_SetWaitThreshold"
+#define EVSIOSWT_SIZE EVS_PACKED_TIME_SIZE
+
+#define EVSIOSWS "Evs_SetWaitSustain"
+#define EVSIOSWS_SIZE EVS_PACKED_TIME_SIZE
+
+#define EVSIOSWFI "Evs_SetWaitFrameInterval"
+#define EVSIOSWFI_SIZE EVS_PACKED_TIME_SIZE
+
+#define EVSIOCWINFO "Evs_CurrentWaitCursorInfo"
+#define EVSIOCWINFO_THRESH 0
+#define EVSIOCWINFO_SUSTAIN (EVSIOCWINFO_THRESH + EVS_PACKED_TIME_SIZE)
+#define EVSIOCWINFO_FINTERVAL (EVSIOCWINFO_SUSTAIN + EVS_PACKED_TIME_SIZE)
+#define EVSIOCWINFO_SIZE (EVSIOCWINFO_FINTERVAL + EVS_PACKED_TIME_SIZE)
+#endif
+
+#define EVS_PACKED_TIME_SIZE (sizeof(UInt64) / sizeof( unsigned int))
+
+/* Device control ioctls. Levels specified may be in the range 0 - 64. */
+
+#define EVSIOSB kIOHIDBrightnessKey
+#define EVSIOSB_SIZE 1
+
+#define EVSIOSADB kIOHIDAutoDimBrightnessKey
+#define EVSIOSADB_SIZE 1
+
+#ifdef _undef
+#define EVSIOSA "Evs_SetAttenuation"
+#define EVIOSA_SIZE 1
+
+#define EVSIO_DCTLINFO "Evs_DeviceControlInfo"
+typedef enum {
+ EVSIO_DCTLINFO_BRIGHT,
+ EVSIO_DCTLINFO_ATTEN,
+ EVSIO_DCTLINFO_AUTODIMBRIGHT
+} evsio_DCTLINFOIndices;
+#define EVSIO_DCTLINFO_SIZE (EVSIO_DCTLINFO_AUTODIMBRIGHT + 1)
+#endif
+
+/*
+ * Device status request
+ */
+#define EVSIOINFO NX_EVS_DEVICE_INFO
+
+
+/* Keyboard-related ioctls - implemented within Event Sources */
+
+#define EVSIOSKR kIOHIDKeyRepeatKey
+#define EVSIOSKR_SIZE EVS_PACKED_TIME_SIZE
+
+#define EVSIOSIKR kIOHIDInitialKeyRepeatKey
+#define EVSIOSIKR_SIZE EVS_PACKED_TIME_SIZE
+
+#define EVSIORKBD kIOHIDResetKeyboardKey
+#define EVSIORKBD_SIZE 1
+
+#define EVSIOCKR_SIZE EVS_PACKED_TIME_SIZE
+
+#define EVSIOCKML kIOHIDKeyMappingKey
+#define EVSIOCKML_SIZE 1
+
+/* The following two tokens are for use with the get/set character routines. */
+#define EVSIOSKM kIOHIDKeyMappingKey
+#define EVSIOSKM_SIZE 4096
+
+#define EVSIOCKM kIOHIDKeyMappingKey
+#define EVSIOCKM_SIZE 4096
+
+/* Mouse-related ioctls - implemented within Event Sources */
+
+#define EVSIOSMS kIOHIDPointerAccelerationKey
+#define EVSIOSMS_SIZE (1)
+
+#define EVSIOCMS kIOHIDPointerAccelerationKey
+#define EVSIOCMS_SIZE (1)
+
+#ifdef _undef
+#define EVSIOSMH "Evs_SetMouseHandedness"
+#define EVSIOSMH_SIZE 1 // value from NXMouseButton enum
+
+#define EVSIOCMH "Evs_CurrentMouseHandedness"
+#define EVSIOCMH_SIZE 1
+#endif
+
+/* Generic pointer device controls, implemented by the Event Driver. */
+#define EVSIOSCT kIOHIDClickTimeKey
+#define EVSIOSCT_SIZE EVS_PACKED_TIME_SIZE
+
+#define EVSIOSCS kIOHIDClickSpaceKey
+typedef enum {
+ EVSIOSCS_X,
+ EVSIOSCS_Y
+} evsioEVSIOSCSIndices;
+#define EVSIOSCS_SIZE (EVSIOSCS_Y + 1)
+
+#define EVSIOSADT kIOHIDAutoDimThresholdKey
+#define EVSIOSADT_SIZE EVS_PACKED_TIME_SIZE
+
+#define EVSIOSADS kIOHIDAutoDimStateKey
+#define EVSIOSADS_SIZE 1
+
+#define EVSIORMS kIOHIDResetPointerKey
+#define EVSIORMS_SIZE 1
+
+#define EVSIOCCT kIOHIDClickTimeKey
+#define EVSIOCCT_SIZE EVS_PACKED_TIME_SIZE
+
+#define EVSIOCADT kIOHIDAutoDimThresholdKey
+#define EVSIOCADT_SIZE EVS_PACKED_TIME_SIZE
+
+#define EVSIOGDADT kIOHIDAutoDimTimeKey
+#define EVSIOGDADT_SIZE EVS_PACKED_TIME_SIZE
+
+#define EVSIOIDLE kIOHIDIdleTimeKey
+#define EVSIOIDLE_SIZE EVS_PACKED_TIME_SIZE
+
+#define EVSIOCCS kIOHIDClickSpaceKey
+typedef enum {
+ EVSIOCCS_X,
+ EVSIOCCS_Y
+} evsioEVSIOCCSIndices;
+#define EVSIOCCS_SIZE (EVSIOCCS_Y + 1)
+
+#define EVSIOCADS kIOHIDAutoDimStateKey
+#define EVSIOCADS_SIZE 1
+
+enum {
+ // Selectors for IOHIDGetModifierLockState and IOHIDSetModifierLockState
+ kIOHIDCapsLockState = 0x00000001,
+ kIOHIDNumLockState = 0x00000002,
+ kIOHIDActivityUserIdle = 0x00000003,
+ kIOHIDActivityDisplayOn = 0x00000004,
+};
+
+#endif /* !_DEV_EVSIO_H */
diff --git a/include/IOKit/hidsystem/IOHIDServiceClient.h b/include/IOKit/hidsystem/IOHIDServiceClient.h
new file mode 100644
index 0000000..0a31195
--- /dev/null
+++ b/include/IOKit/hidsystem/IOHIDServiceClient.h
@@ -0,0 +1,106 @@
+/*
+ * Copyright (c) 2016 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_LICENSE_HEADER_START@
+ *
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * @APPLE_LICENSE_HEADER_END@
+ */
+
+#ifndef IOHIDServiceClient_h
+#define IOHIDServiceClient_h
+
+#include
+
+__BEGIN_DECLS
+CF_ASSUME_NONNULL_BEGIN
+CF_IMPLICIT_BRIDGING_ENABLED
+
+/*!
+ @header IOHIDServiceClient
+
+ IOHIDServiceClient serves as a client to the HID event system
+ services. Users are able to copy/set specific properties (defined in
+ IOKit/hid/IOHIDProperties.h), and gather more information
+ about the services available in the HID event system.
+ */
+
+typedef struct CF_BRIDGED_TYPE(id) __IOHIDServiceClient * IOHIDServiceClientRef;
+
+/*!
+ * @function IOHIDServiceClientSetProperty
+ *
+ * @abstract Sets a property on the HID service.
+ *
+ * @param service the HID service to set the property on.
+ *
+ * @param key the property key to set. A list of keys can be found in HIDProperties.h.
+ *
+ * @param property the value to set the property.
+ *
+ * @result Returns true on success.
+ */
+Boolean IOHIDServiceClientSetProperty(IOHIDServiceClientRef service, CFStringRef key, CFTypeRef property);
+
+/*!
+ * @function IOHIDServiceClientCopyProperty
+ *
+ * @abstract Copies a property from the HID service.
+ *
+ * @param service the HID service to copy the property from.
+ *
+ * @param key the property key to copy. A list of keys can be found in HIDProperties.h.
+ *
+ * @result Returns a CFTypeRef of the property to be copied on success, otherwise NULL.
+ * Caller is responsible for calling CFRelease on the property.
+ */
+CFTypeRef _Nullable IOHIDServiceClientCopyProperty(IOHIDServiceClientRef service, CFStringRef key);
+
+/*!
+ * @function IOHIDServiceClientGetTypeID
+ *
+ * @result Returns the CFTypeID of the IOHIDServiceClient class.
+ */
+CFTypeID IOHIDServiceClientGetTypeID(void);
+
+/*!
+ * @function IOHIDServiceClientGetRegistryID
+ *
+ * @param service the HID service to get the registry ID for.
+ *
+ * @result Returns a CFTypeRef containing the registry ID for the service.
+ */
+CFTypeRef IOHIDServiceClientGetRegistryID(IOHIDServiceClientRef service);
+
+/*!
+ * @function IOHIDServiceClientConformsTo
+ *
+ * @abstract Determines if a HID service conforms to a specific usage page and usage.
+ *
+ * @param usagePage A usage page defined in IOHIDUsageTables.h.
+ *
+ * @param usage A usage defined in IOHIDUsageTables.h.
+ *
+ * @result Returns true if the service conforms to the provided usage page and usage.
+ */
+boolean_t IOHIDServiceClientConformsTo(IOHIDServiceClientRef service, uint32_t usagePage, uint32_t usage);
+
+CF_IMPLICIT_BRIDGING_DISABLED
+CF_ASSUME_NONNULL_END
+__END_DECLS
+
+#endif /* IOHIDServiceClient_h */
diff --git a/include/IOKit/hidsystem/IOHIDShared.h b/include/IOKit/hidsystem/IOHIDShared.h
new file mode 100644
index 0000000..7ac20b1
--- /dev/null
+++ b/include/IOKit/hidsystem/IOHIDShared.h
@@ -0,0 +1,291 @@
+/*
+ * @APPLE_LICENSE_HEADER_START@
+ *
+ * Copyright (c) 1999-2011 Apple Computer, Inc. All Rights Reserved.
+ *
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * @APPLE_LICENSE_HEADER_END@
+ */
+
+#ifndef _DEV_EVIO_H
+#define _DEV_EVIO_H
+
+#include
+
+__BEGIN_DECLS
+
+#if KERNEL
+#include
+#else /* !KERNEL */
+#include
+#include
+#endif /* KERNEL */
+
+#include
+#include
+#include
+#include
+
+/*
+ * Identify this driver as one that uses the new driverkit and messaging API
+ */
+#ifndef _NeXT_MACH_EVENT_DRIVER_
+#define _NeXT_MACH_EVENT_DRIVER_ (1)
+#endif /* _NeXT_MACH_EVENT_DRIVER_ */
+
+
+/* Pressure Constants */
+#define MINPRESSURE EV_MINPRESSURE
+#define MAXPRESSURE EV_MAXPRESSURE
+
+#define LLEQSIZE 240 /* Entries in low-level event queue */
+
+typedef struct _NXEQElStruct {
+ int next; /* Slot of lleq for next event */
+ OSSpinLock sema; /* Is high-level code reading this event now? */
+ NXEvent event; /* The event itself */
+} NXEQElement;
+
+/******************************************************************************
+ SHARED MEMORY OVERVIEW
+
+ PERSPECTIVE
+ The ev driver and PostScript share at least one page of wired memory.
+ This memory contains the low-level event queue which ev deposits events
+ into and PostScript reads events from. Also, this memory contains other
+ important data such as wait cursor state and some general cursor state.
+ This memory is critical for speed. That is, we avoid having to make
+ system calls for common operations.
+
+ SHARED MEMORY REGIONS
+ There are currently three "regions" or "zones" delineated within this
+ shared memory. The first zone is the EvOffsets structure. This structure
+ contains two offsets from the beginning of shared memory. The first offset
+ is to the second zone, EvGlobals. The second offset is to the third
+ zone, private shmem for drivers.
+
+ INITIALIZATION OF SHARED MEMORY
+ When the WindowServer starts up, it finds all screens that will be active.
+ It then opens the ev driver and calls the EVIOSSCR ioctl repeatedly for
+ each screen in use. This lets the ev driver set up the evScreen array
+ and fill in each element. This ioctl also returns to PostScript a running
+ total shared memory size with which to allocate. PostScript then allocates
+ a region of memory this size and calls evmmap to "map in" this shared
+ region. Evmmap initializes and fills in the EvOffsets and EvGlobals.
+ Next the WindowServer calls each screen in turn to register itself with
+ the ev driver in the same sequence as presented to EVIOSSCR. Each screen
+ driver calls ev_register_screen() which among other things allocates a
+ part of the private shmem (of the third shared memory zone) for the driver.
+
+ DEBUGGING NOTES
+ You can easily display and set this shared memory from kgdb, but usually
+ cannot do so from within PostScript. Gdb (or some weird interaction
+ between gdb and the os) chokes on this shmem. So if you read or write
+ this area of memory, copy-on-write will occur and you'll get a completely
+ new page for PostScript. This will render the shared memory scheme
+ useless and you will have to restart PostScript. It was my understanding
+ that before, we were able to "read" this area from PS, but not write to
+ it (the idea behind copy-on-WRITE). However, this seems to be broken
+ in 2.0. We think this is a kernel bug.
+******************************************************************************/
+
+typedef volatile struct _evOffsets {
+ int evGlobalsOffset; /* Offset to EvGlobals structure */
+ int evShmemOffset; /* Offset to private shmem regions */
+} EvOffsets;
+
+/******************************************************************************
+ EvGlobals
+ This structures defines the portion of the events driver data structure
+ that is exported to the PostScript server. It contains the event queue
+ which is in memory shared between the driver and the PostScript server.
+ All the variables necessary to read and process events from the queue are
+ contained here.
+******************************************************************************/
+
+typedef volatile struct _evGlobals {
+ OSSpinLock cursorSema; /* set to disable periodic code */
+ int eNum; /* Unique id for mouse events */
+ int buttons; /* State of the mouse buttons 1==down, 0==up */
+ int eventFlags; /* The current value of event.flags */
+ int VertRetraceClock; /* The current value of event.time */
+ IOGPoint cursorLoc; /* The current location of the cursor, in desktop coordinates */
+ int frame; /* current cursor frame */
+ IOGBounds workBounds; /* bounding box of all screens */
+ IOGBounds mouseRect; /* Rect for mouse-exited events */
+ int version; /* for run time checks */
+ int structSize; /* for run time checks */
+ int lastFrame;
+ /* The current location of the cursor, 24.8 bit fixed point format */
+ IOFixedPoint32 screenCursorFixed; /* in Screen coordinates */
+ IOFixedPoint32 desktopCursorFixed;/* in Desktop coordinates */
+ unsigned int reservedA[27];
+
+ unsigned reserved:25;
+ unsigned updateCursorPositionFromFixed:1; /* if this is set, IOHIDSystem will take any cursor position updates from desktopCursorFixed instead of cursorLoc */
+ unsigned logCursorUpdates:1; /* log cursor updates */
+ unsigned wantPressure:1; /* pressure in current mouseRect? */
+ unsigned wantPrecision:1; /* precise coordinates in current mouseRect? */
+ unsigned dontWantCoalesce:1; /* coalesce within the current mouseRect? */
+ unsigned dontCoalesce:1; /* actual flag which determines coalescing */
+ unsigned mouseRectValid:1; /* If nonzero, post a mouse-exited whenever mouse outside mouseRect. */
+ int movedMask; /* This contains an event mask for the three events MOUSEMOVED,
+ LMOUSEDRAGGED, and RMOUSEDRAGGED. It says whether driver should
+ generate those events. */
+ OSSpinLock waitCursorSema; /* protects wait cursor fields */
+ int AALastEventSent; /* timestamp for wait cursor */
+ int AALastEventConsumed; /* timestamp for wait cursor */
+ int waitCursorUp; /* Is wait cursor up? */
+ char ctxtTimedOut; /* Has wait cursor timer expired? */
+ char waitCursorEnabled; /* Play wait cursor game (per ctxt)? */
+ char globalWaitCursorEnabled; /* Play wait cursor game (global)? */
+ int waitThreshold; /* time before wait cursor appears */
+
+ int LLEHead; /* The next event to be read */
+ int LLETail; /* Where the next event will go */
+ int LLELast; /* The last event entered */
+ NXEQElement lleq[LLEQSIZE]; /* The event queue itself */
+} EvGlobals;
+
+/* These evio structs are used in various calls supported by the ev driver. */
+
+struct evioLLEvent {
+ int setCursor;
+ int type;
+ IOGPoint location;
+ NXEventData data;
+ int setFlags;
+ int flags;
+};
+
+typedef struct evioLLEvent _NXLLEvent;
+
+#ifdef mach3xxx
+
+/*
+ * On a keypress of a VOL UP or VOL DOWN key, we send a message to the
+ * sound server to notify it of the volume change. The message includes
+ * a flag to indicate which key was pressed, and the machine independant
+ * flag bits to indicate which modifier keys were pressed.
+ */
+
+struct evioSpecialKeyMsg
+{
+ msg_header_t Head;
+ msg_type_t keyType;
+ int key; // special key number, from bsd/dev/ev_keymap.h
+ msg_type_t directionType;
+ int direction; // NX_KEYDOWN, NX_KEYUP from event.h
+ msg_type_t flagsType;
+ int flags; // device independant flags from event.h
+ msg_type_t levelType;
+ int level; // EV_AUDIO_MIN_VOLUME to EV_AUDIO_MAX_VOLUME
+};
+#else
+struct evioSpecialKeyMsg
+{
+ mach_msg_header_t Head;
+ int key; // special key number, from bsd/dev/ev_keymap.h
+ int direction; // NX_KEYDOWN, NX_KEYUP from event.h
+ int flags; // device independant flags from event.h
+ int level; // EV_AUDIO_MIN_VOLUME to EV_AUDIO_MAX_VOLUME
+};
+#endif
+
+#define EV_SPECIAL_KEY_MSG_ID (('S'<<24) | ('k'<<16) | ('e'<<8) | ('y'))
+typedef struct evioSpecialKeyMsg *evioSpecialKeyMsg_t;
+
+/*
+ * Volume ranges
+ */
+#define EV_AUDIO_MIN_VOLUME 0
+#define EV_AUDIO_MAX_VOLUME 64
+
+#define kIOHIDSystemClass "IOHIDSystem"
+#define kIOHIKeyboardClass "IOHIKeyboard"
+#define kIOHIPointingClass "IOHIPointing"
+
+#define IOHIDSYSTEM_CONFORMSTO kIOHIDSystemClass
+
+enum {
+ kIOHIDEventNotification = 0,
+};
+#define kIOHIDCurrentShmemVersion 4
+#define kIOHIDLastCompatibleShmemVersion 3
+
+enum {
+ kIOHIDServerConnectType = 0,
+ kIOHIDParamConnectType = 1,
+ kIOHIDEventSystemConnectType = 3,
+};
+
+enum {
+ kIOHIDGlobalMemory = 0
+};
+
+enum {
+ kIOHIDEventQueueTypeKernel = 0,
+ kIOHIDEventQueueTypeUser = 1
+};
+
+#ifdef KERNEL
+typedef UInt16 (*MasterVolumeUpdate)(void);
+typedef bool (*MasterMuteUpdate)(void);
+
+typedef struct {
+ MasterVolumeUpdate incrementMasterVolume;
+ MasterVolumeUpdate decrementMasterVolume;
+ MasterMuteUpdate toggleMasterMute;
+} MasterAudioFunctions;
+
+extern MasterAudioFunctions *masterAudioFunctions;
+#endif
+
+#ifndef KERNEL
+#ifndef _IOKIT_IOHIDLIB_H
+#include
+#endif
+#endif /* !KERNEL */
+
+
+
+enum {
+ /*!
+ @defined kIOHIDOpenedByEventSystem
+ @abstract option passed to open for IOHIDInterface if opened by IOHIDEventDriver
+ */
+ kIOHIDOpenedByEventSystem = 0x10000,
+ /*!
+ @defined kIOHIDOpenedByFastPathClient
+ @abstract option passed to open for IOHIDEventService if opened by fast path client
+ */
+ kIOHIDOpenedByFastPathClient = 0x20000
+};
+
+// iokit_vendor_specific_msg(1) unused
+
+/*!
+ @defined kIOHIDMessageRelayServiceInterfaceActive
+ @abstract message from IOHIDDevice to indicate that the IOHIDRelayService's USB interface is active.
+ */
+
+#define kIOHIDMessageRelayServiceInterfaceActive iokit_vendor_specific_msg(2)
+
+__END_DECLS
+
+
+#endif /* !_DEV_EVIO_H */
diff --git a/include/IOKit/hidsystem/IOHIDTypes.h b/include/IOKit/hidsystem/IOHIDTypes.h
new file mode 100644
index 0000000..c665f9b
--- /dev/null
+++ b/include/IOKit/hidsystem/IOHIDTypes.h
@@ -0,0 +1,182 @@
+/*
+ * @APPLE_LICENSE_HEADER_START@
+ *
+ * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
+ *
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * @APPLE_LICENSE_HEADER_END@
+ */
+/******************************************************************************
+ ev_types.h
+ Data types for the events status driver.
+ This file contains public API.
+ mpaque 11Oct91
+
+ Copyright 1991 NeXT Computer, Inc.
+ Copyright 1997-2011 Apple, Inc.
+
+ Modified:
+
+******************************************************************************/
+
+#ifndef _DEV_EV_TYPES_H
+#define _DEV_EV_TYPES_H
+
+#include
+#include
+#include
+
+// This should be removed, but is being used by others
+// IOHIDFamily-355 causes projects to fail to build with 'ev_lock_data_t' does not name a type
+#include
+
+/* Shared memory versions */
+#define EVENT_SYSTEM_VERSION 2
+
+/* Maximum length of SetMouseScaling arrays */
+#define NX_MAXMOUSESCALINGS 20
+
+typedef struct evsioKeymapping /* Match old struct names in kernel */
+{
+ int size;
+ char *mapping;
+} NXKeyMapping;
+
+typedef struct evsioMouseScaling /* Match old struct names in kernel */
+{
+ int numScaleLevels;
+ short scaleThresholds[NX_MAXMOUSESCALINGS];
+ short scaleFactors[NX_MAXMOUSESCALINGS];
+} NXMouseScaling;
+
+typedef enum {
+ NX_OneButton,
+ NX_LeftButton,
+ NX_RightButton
+} NXMouseButton;
+
+// IOFixedPoint32 is a 24.8 format
+typedef struct __IOFixedPoint32 {
+ int32_t x;
+ int32_t y;
+} IOFixedPoint32;
+
+/*
+ * NXEventSystemInfo() information structures. These are designed to
+ * allow for expansion.
+ *
+ * The current implementation of NXEventSystemInfo() uses an ioctl call.
+ * THIS WILL CHANGE.
+ */
+
+/*
+ * Generic query max size and typedefs.
+ *
+ * The maximum size is selected to support anticipated future extensions
+ * of request flavors. Certain flavors planned for future releases may
+ * require roughtly 800 ints to represent. We allow a little extra, in
+ * case further growth is needed.
+ */
+typedef int *NXEventSystemInfoType;
+#define NX_EVS_INFO_MAX (1024) /* Max array size */
+typedef int NXEventSystemInfoData[NX_EVS_INFO_MAX];
+
+/* Event System Devices query */
+#define NX_EVS_DEVICE_MAX 16
+
+ /* Interface types */
+#define NX_EVS_DEVICE_INTERFACE_OTHER 0
+#define NX_EVS_DEVICE_INTERFACE_NeXT 1 // NeXT custom, in older sys
+#define NX_EVS_DEVICE_INTERFACE_ADB 2 // NeXT/fruit keybds/mice
+#define NX_EVS_DEVICE_INTERFACE_ACE 3 // For x86 PC keyboards
+#define NX_EVS_DEVICE_INTERFACE_SERIAL_ACE 4 // For PC serial mice
+#define NX_EVS_DEVICE_INTERFACE_BUS_ACE 5 // For PC bus mice
+#define NX_EVS_DEVICE_INTERFACE_HIL 6 // For HIL hp keyboard
+#define NX_EVS_DEVICE_INTERFACE_TYPE5 7 // For Sun Type5 keyboard
+
+/*
+ * Note! if any new interface types are added above, the following
+ * definition of the number of interfaces supported must reflect this.
+ * This is used in the libkeymap project (storemap.c module) which needs
+ * to be cognizant of the number of new devices coming online
+ * via support for heterogeneous architecture platforms.
+ * e.g., PCs, HP's HIL, Sun's Type5 keyboard,...
+ */
+#define NUM_SUPPORTED_INTERFACES (NX_EVS_DEVICE_INTERFACE_TYPE5 + 1)
+ // Other, NeXT, ADB, ACE,...
+
+ /* Device types */
+#define NX_EVS_DEVICE_TYPE_OTHER 0
+#define NX_EVS_DEVICE_TYPE_KEYBOARD 1
+#define NX_EVS_DEVICE_TYPE_MOUSE 2 // Relative position devices
+#define NX_EVS_DEVICE_TYPE_TABLET 3 // Absolute position devices
+
+typedef struct {
+ int interface; /* NeXT, ADB, other */
+ int interface_addr; /* Device address on the interface */
+ int dev_type; /* Keyboard, mouse, tablet, other */
+ int id; /* manufacturer's device handler ID */
+} NXEventSystemDevice;
+
+typedef struct {
+ NXEventSystemDevice dev[NX_EVS_DEVICE_MAX];
+} NXEventSystemDeviceList;
+
+#define __OLD_NX_EVS_DEVICE_INFO 1
+#define NX_EVS_DEVICE_INFO "Evs_EventDeviceInfo"
+#define NX_EVS_DEVICE_INFO_COUNT \
+ (sizeof (NXEventSystemDeviceList) / sizeof (int))
+
+/*
+ * Types used in evScreen protocol compliant operations.
+ */
+
+typedef enum {EVNOP, EVHIDE, EVSHOW, EVMOVE, EVLEVEL} EvCmd; /* Cursor state */
+
+#define EV_SCREEN_MIN_BRIGHTNESS 0
+#define EV_SCREEN_MAX_BRIGHTNESS 64
+/* Scale should lie between MIN_BRIGHTNESS and MAX_BRIGHTNESS */
+#define EV_SCALE_BRIGHTNESS( scale, datum ) \
+ ((((UInt32)(datum))*((UInt32)scale)) >> 6)
+
+/*
+ * Definition of a tick, as a time in milliseconds. This controls how
+ * often the event system periodic jobs are run. All actual tick times
+ * are derived from the nanosecond timer. These values are typically used
+ * as part of computing mouse velocity for acceleration purposes.
+ */
+#define EV_TICK_TIME 16 /* 16 milliseconds */
+#define EV_TICKS_PER_SEC (1000/EV_TICK_TIME) /* ~ 62 Hz */
+
+/* Mouse Button bits, as passed from an EventSrc to the Event Driver */
+#define EV_RB (0x01)
+#define EV_LB (0x04)
+#define EV_MOUSEBUTTONMASK (EV_LB | EV_RB)
+
+/* Tablet Pressure Constants, as passed from an EventSrc to the Event Driver */
+#define EV_MINPRESSURE 0
+#define EV_MAXPRESSURE 255
+
+/* Cursor size in pixels */
+#define EV_CURSOR_WIDTH 16
+#define EV_CURSOR_HEIGHT 16
+
+
+#define kAppleOnboardGUID 0x0610000000000000ULL
+
+#endif /* !_DEV_EV_TYPES_H */
+
diff --git a/include/IOKit/hidsystem/IOHIDUserDevice.h b/include/IOKit/hidsystem/IOHIDUserDevice.h
new file mode 100644
index 0000000..caa3dee
--- /dev/null
+++ b/include/IOKit/hidsystem/IOHIDUserDevice.h
@@ -0,0 +1,382 @@
+/*
+ *
+ * @APPLE_LICENSE_HEADER_START@
+ *
+ * Copyright (c) 2019 Apple Computer, Inc. All Rights Reserved.
+ *
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * @APPLE_LICENSE_HEADER_END@
+ */
+
+#ifndef _IOKIT_HID_IOHIDUSERDEVICE_H
+#define _IOKIT_HID_IOHIDUSERDEVICE_H
+
+#include
+#include
+#include
+
+__BEGIN_DECLS
+
+CF_ASSUME_NONNULL_BEGIN
+CF_IMPLICIT_BRIDGING_ENABLED
+
+typedef struct CF_BRIDGED_TYPE(id) __IOHIDUserDevice * IOHIDUserDeviceRef;
+
+/*!
+ * @typedef IOHIDUserDeviceSetReportBlock
+ *
+ * @abstract
+ * The type block used for IOHIDUserDevice set report calls.
+ *
+ * @param type
+ * The report type.
+ *
+ * @param reportID
+ * The report ID.
+ *
+ * @param report
+ * The report bytes.
+ *
+ * @param reportLength
+ * The length of the report being passed in.
+ */
+typedef IOReturn (^IOHIDUserDeviceSetReportBlock)(IOHIDReportType type,
+ uint32_t reportID,
+ const uint8_t *report,
+ CFIndex reportLength);
+
+/*!
+ * @typedef IOHIDUserDeviceGetReportBlock
+ *
+ * @abstract
+ * The type block used for IOHIDUserDevice get report calls.
+ *
+ * @param type
+ * The report type.
+ *
+ * @param reportID
+ * The report ID.
+ *
+ * @param report
+ * A buffer to be filled in by the implementor with the report.
+ *
+ * @param reportLength
+ * The length of the report buffer being passed in. The implementor of this
+ * block may update the reportLength variable to reflect the actual length of
+ * the returned report.
+ */
+typedef IOReturn (^IOHIDUserDeviceGetReportBlock)(IOHIDReportType type,
+ uint32_t reportID,
+ uint8_t *report,
+ CFIndex *reportLength);
+
+/*!
+ * @enum IOHIDUserDeviceOptions
+ *
+ * @abstract
+ * Enumerator of IOHIDUserDeviceOptions to be passed in to
+ * IOHIDUserDeviceCreateWithOptions.
+ *
+ * @field IOHIDUserDeviceOptionsCreateOnActivate
+ * Specifies that the kernel HID device should not be created until the call
+ * to IOHIDUserDeviceActivate. This may be useful for preventing dropped get/set
+ * report calls to the user device.
+ */
+typedef CF_ENUM(IOOptionBits, IOHIDUserDeviceOptions) {
+ IOHIDUserDeviceOptionsCreateOnActivate = 1 << 0,
+};
+
+/*!
+ * @function IOHIDUserDeviceGetTypeID
+ *
+ * @abstract
+ * Returns the type identifier of all IOHIDUserDevice instances.
+ */
+CF_EXPORT
+CFTypeID IOHIDUserDeviceGetTypeID(void);
+
+/*!
+ * @function IOHIDUserDeviceCreateWithProperties
+ *
+ * @abstract
+ * Creates a virtual IOHIDDevice in the kernel.
+ *
+ * @discussion
+ * The IOHIDUserDeviceRef represents a virtual IOHIDDevice. In order to create
+ * the device, the entitlement "com.apple.developer.hid.virtual.device" is
+ * required to validate the source of the device.
+ *
+ * @param allocator
+ * Allocator to be used during creation.
+ *
+ * @param properties
+ * Dictionary containing device properties indexed by keys defined in
+ * IOHIDKeys.h. At the bare minimum, the kIOHIDReportDescriptorKey key must be
+ * provided, where the value represents a CFData representation of the device's
+ * report descriptor.
+ *
+ * @param options
+ * Options to be used when creating the device.
+ *
+ * @result
+ * Returns a IOHIDUserDeviceRef on success.
+ */
+CF_EXPORT
+IOHIDUserDeviceRef _Nullable IOHIDUserDeviceCreateWithProperties(
+ CFAllocatorRef _Nullable allocator,
+ CFDictionaryRef properties,
+ IOOptionBits options)
+__OSX_AVAILABLE(10.15) __IOS_AVAILABLE(13.0) __TVOS_AVAILABLE(13.0) __WATCHOS_AVAILABLE(6.0);
+
+/*!
+ * @function IOHIDUserDeviceRegisterGetReportBlock
+ *
+ * @abstract
+ * Registers a block to receive get report requests.
+ *
+ * @discussion
+ * The call to IOHIDUserDeviceRegisterGetReportBlock should be made before the
+ * device is activated. The device must be activated in order to receive
+ * get report requests.
+ *
+ * @param device
+ * Reference to a IOHIDUserDeviceRef
+ *
+ * @param block
+ * The block to be invoked for get report calls.
+ */
+CF_EXPORT
+void IOHIDUserDeviceRegisterGetReportBlock(IOHIDUserDeviceRef device,
+ IOHIDUserDeviceGetReportBlock block)
+__OSX_AVAILABLE(10.15) __IOS_AVAILABLE(13.0) __TVOS_AVAILABLE(13.0) __WATCHOS_AVAILABLE(6.0);
+
+/*!
+ * @function IOHIDUserDeviceRegisterSetReportBlock
+ *
+ * @abstract
+ * Registers a block to receive set report requests.
+ *
+ * @discussion
+ * The call to IOHIDUserDeviceRegisterSetReportBlock should be made before the
+ * device is activated. The device must be activated in order to receive set
+ * report requests.
+ *
+ * @param device
+ * Reference to a IOHIDUserDeviceRef
+ *
+ * @param block
+ * The block to be invoked for set report calls.
+ */
+CF_EXPORT
+void IOHIDUserDeviceRegisterSetReportBlock(IOHIDUserDeviceRef device,
+ IOHIDUserDeviceSetReportBlock block)
+__OSX_AVAILABLE(10.15) __IOS_AVAILABLE(13.0) __TVOS_AVAILABLE(13.0) __WATCHOS_AVAILABLE(6.0);
+
+/*!
+ * @function IOHIDUserDeviceSetDispatchQueue
+ *
+ * @abstract
+ * Sets the dispatch queue to be associated with the IOHIDUserDevice.
+ * This is necessary in order to receive asynchronous events from the kernel.
+ *
+ * @discussion
+ * A call to IOHIDUserDeviceSetDispatchQueue should only be made once.
+ *
+ * After a dispatch queue is set, the IOHIDUserDevice must make a call to
+ * activate via IOHIDUserDeviceActivate and cancel via IOHIDUserDeviceCancel.
+ * All calls to "Register" functions should be done before activation and not
+ * after cancellation.
+ *
+ * @param device
+ * Reference to an IOHIDUserDevice
+ *
+ * @param queue
+ * The dispatch queue to which the event handler block will be submitted.
+ */
+CF_EXPORT
+void IOHIDUserDeviceSetDispatchQueue(IOHIDUserDeviceRef device,
+ dispatch_queue_t queue)
+__OSX_AVAILABLE(10.15) __IOS_AVAILABLE(13.0) __TVOS_AVAILABLE(13.0) __WATCHOS_AVAILABLE(6.0);
+
+/*!
+ * @function IOHIDUserDeviceSetCancelHandler
+ *
+ * @abstract
+ * Sets a cancellation handler for the dispatch queue associated with
+ * IOHIDUserDeviceScheduleWithDispatchQueue.
+ *
+ * @discussion
+ * The cancellation handler (if specified) will be submitted to the device's
+ * dispatch queue in response to a call to to IOHIDUserDeviceCancel
+ * after all the events have been handled.
+ *
+ * The IOHIDUserDeviceRef should only be released after the device has been
+ * cancelled, and the cancel handler has been called. This is to ensure all
+ * asynchronous objects are released. For example:
+ *
+ * dispatch_block_t cancelHandler = dispatch_block_create(0, ^{
+ * CFRelease(device);
+ * });
+ * IOHIDUserDeviceSetCancelHandler(device, cancelHandler);
+ * IOHIDUserDeviceActivate(device);
+ * IOHIDUserDeviceCancel(device);
+ *
+ * @param device
+ * Reference to an IOHIDUserDevice.
+ *
+ * @param handler
+ * The cancellation handler block to be associated with the dispatch queue.
+ */
+CF_EXPORT
+void IOHIDUserDeviceSetCancelHandler(IOHIDUserDeviceRef device,
+ dispatch_block_t handler)
+__OSX_AVAILABLE(10.15) __IOS_AVAILABLE(13.0) __TVOS_AVAILABLE(13.0) __WATCHOS_AVAILABLE(6.0);
+
+/*!
+ * @function IOHIDUserDeviceActivate
+ *
+ * @abstract
+ * Activates the IOHIDUserDevice object.
+ *
+ * @discussion
+ * An IOHIDUserDevice object associated with a dispatch queue is created
+ * in an inactive state. The object must be activated in order to
+ * receive asynchronous events from the kernel.
+ *
+ * A dispatch queue must be set via IOHIDUserDeviceSetDispatchQueue before
+ * activation.
+ *
+ * An activated device must be cancelled via IOHIDUserDeviceCancel. All calls
+ * to "Register" functions should be done before activation and not after
+ * cancellation.
+ *
+ * Calling IOHIDUserDeviceActivate on an active IOHIDUserDevice has no effect.
+ *
+ * @param device
+ * Reference to an IOHIDUserDevice.
+ */
+CF_EXPORT
+void IOHIDUserDeviceActivate(IOHIDUserDeviceRef device)
+__OSX_AVAILABLE(10.15) __IOS_AVAILABLE(13.0) __TVOS_AVAILABLE(13.0) __WATCHOS_AVAILABLE(6.0);
+
+/*!
+ * @function IOHIDUserDeviceCancel
+ *
+ * @abstract
+ * Cancels the IOHIDUserDevice preventing any further invocation of its event
+ * handler block.
+ *
+ * @discussion
+ * Cancelling prevents any further invocation of the event handler block for
+ * the specified dispatch queue, but does not interrupt an event handler block
+ * that is already in progress.
+ *
+ * Explicit cancellation of the IOHIDUserDevice is required, no implicit
+ * cancellation takes place.
+ *
+ * Calling IOHIDUserDeviceCancel on an already cancelled queue has no effect.
+ *
+ * The IOHIDUserDeviceRef should only be released after the device has been
+ * cancelled, and the cancel handler has been called. This is to ensure all
+ * asynchronous objects are released. For example:
+ *
+ * dispatch_block_t cancelHandler = dispatch_block_create(0, ^{
+ * CFRelease(device);
+ * });
+ * IOHIDUserDeviceSetCancelHandler(device, cancelHandler);
+ * IOHIDUserDeviceActivate(device);
+ * IOHIDUserDeviceCancel(device);
+ *
+ * @param device
+ * Reference to an IOHIDUserDevice
+ */
+CF_EXPORT
+void IOHIDUserDeviceCancel(IOHIDUserDeviceRef device)
+__OSX_AVAILABLE(10.15) __IOS_AVAILABLE(13.0) __TVOS_AVAILABLE(13.0) __WATCHOS_AVAILABLE(6.0);
+
+/*!
+ * @function IOHIDUserDeviceCopyProperty
+ *
+ * @abstract
+ * Obtains a property from the device.
+ *
+ * @param key
+ * The property key.
+ *
+ * @result
+ * Returns the property on success.
+ */
+CF_EXPORT
+CFTypeRef _Nullable IOHIDUserDeviceCopyProperty(IOHIDUserDeviceRef device,
+ CFStringRef key)
+__OSX_AVAILABLE(10.15) __IOS_AVAILABLE(13.0) __TVOS_AVAILABLE(13.0) __WATCHOS_AVAILABLE(6.0);
+
+/*!
+ * @function IOHIDUserDeviceSetProperty
+ *
+ * @abstract
+ * Sets a property on the device.
+ *
+ * @param key
+ * The property key.
+ *
+ * @param value
+ * The value of the property.
+ *
+ * @result
+ * Returns true on success.
+ */
+CF_EXPORT
+Boolean IOHIDUserDeviceSetProperty(IOHIDUserDeviceRef device,
+ CFStringRef key,
+ CFTypeRef property)
+__OSX_AVAILABLE(10.15) __IOS_AVAILABLE(13.0) __TVOS_AVAILABLE(13.0) __WATCHOS_AVAILABLE(6.0);
+
+/*!
+ * @function IOHIDUserDeviceHandleReportWithTimeStamp
+ *
+ * @abstract
+ * Dispatches a report on behalf of the device.
+ *
+ * @param device
+ * Reference to a IOHIDUserDeviceRef.
+ *
+ * @param timestamp
+ * mach_absolute_time() based timestamp.
+ *
+ * @param report
+ * Buffer containing a HID report.
+ *
+ * @param reportLength
+ * The report buffer length.
+ *
+ * @result
+ * Returns kIOReturnSuccess on success.
+ */
+CF_EXPORT
+IOReturn IOHIDUserDeviceHandleReportWithTimeStamp(IOHIDUserDeviceRef device,
+ uint64_t timestamp,
+ const uint8_t *report,
+ CFIndex reportLength)
+__OSX_AVAILABLE(10.15) __IOS_AVAILABLE(13.0) __TVOS_AVAILABLE(13.0) __WATCHOS_AVAILABLE(6.0);
+
+CF_IMPLICIT_BRIDGING_DISABLED
+CF_ASSUME_NONNULL_END
+
+__END_DECLS
+
+#endif /* _IOKIT_HID_IOHIDUSERDEVICE_H */
diff --git a/include/IOKit/hidsystem/IOLLEvent.h b/include/IOKit/hidsystem/IOLLEvent.h
new file mode 100644
index 0000000..0a72a4e
--- /dev/null
+++ b/include/IOKit/hidsystem/IOLLEvent.h
@@ -0,0 +1,586 @@
+/*
+ * @APPLE_LICENSE_HEADER_START@
+ *
+ * Copyright (c) 1999-2009 Apple Computer, Inc. All Rights Reserved.
+ *
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * @APPLE_LICENSE_HEADER_END@
+ */
+/******************************************************************************
+ event.h (PostScript side version)
+
+ CONFIDENTIAL
+ Copyright (c) 1988 NeXT, Inc. as an unpublished work.
+ All Rights Reserved.
+
+ Created Leo 01Mar88
+
+ Modified:
+ 04May88 Leo Final event types and record
+ 22Aug88 Leo Change short -> int for window, add reserved
+ 26May90 Ted Added NX_UNDIMMASK to correct triggering of UndoAutoDim
+ 12Dec91 Mike Brought into sync with dpsclient/event.h, and fixed
+ the #ifndef interlock with dpsclient/event.h that was
+ broken during the Great Header Revision.
+
+ The PostScript version of this file differs from the
+ Window Kit version in that the coordinates here are
+ ints instead of floats.
+******************************************************************************/
+
+#ifndef _DEV_EVENT_H
+#define _DEV_EVENT_H
+
+#include
+#include
+#include
+
+#ifdef EVENT_H /* Interlock with dpsclient/event.h */
+#if !defined(_NXSIZE_) /* Work around patch for old event.h in Phase 3 projs*/
+#define _NXSIZE_ 1 /* NXCoord, NXPoint, NXSize decl seen */
+#define _NXSize_ NXSize
+#endif /* _NXSIZE_ */
+#else /* EVENT_H */ /* Haven't seen dpsclient/event.h, so define away */
+#define EVENT_H
+
+#ifdef KERNEL
+#else /* KERNEL */
+
+#if !defined(_NXSIZE_) /* Work around patch for old event.h in Phase 3 projs*/
+#define _NXSIZE_ 1 /* NXCoord, NXPoint, NXSize decl seen */
+typedef float NXCoord;
+
+typedef struct _NXPoint { /* point */
+ NXCoord x, y;
+} NXPoint;
+
+typedef struct _NXSize { /* size */
+ NXCoord width, height;
+} NXSize;
+#define _NXSize_ NXSize /* Correct usage in event_status_driver.h */
+#endif /* _NXSIZE_ */
+
+#endif /* KERNEL */
+
+/* Event types */
+
+#define NX_NULLEVENT 0 /* internal use */
+
+/* mouse events */
+
+#define NX_LMOUSEDOWN 1 /* left mouse-down event */
+#define NX_LMOUSEUP 2 /* left mouse-up event */
+#define NX_RMOUSEDOWN 3 /* right mouse-down event */
+#define NX_RMOUSEUP 4 /* right mouse-up event */
+#define NX_MOUSEMOVED 5 /* mouse-moved event */
+#define NX_LMOUSEDRAGGED 6 /* left mouse-dragged event */
+#define NX_RMOUSEDRAGGED 7 /* right mouse-dragged event */
+#define NX_MOUSEENTERED 8 /* mouse-entered event */
+#define NX_MOUSEEXITED 9 /* mouse-exited event */
+
+/* other mouse events
+ *
+ * event.data.mouse.buttonNumber should contain the
+ * button number (2-31) changing state.
+ */
+#define NX_OMOUSEDOWN 25 /* other mouse-down event */
+#define NX_OMOUSEUP 26 /* other mouse-up event */
+#define NX_OMOUSEDRAGGED 27 /* other mouse-dragged event */
+
+/* keyboard events */
+
+#define NX_KEYDOWN 10 /* key-down event */
+#define NX_KEYUP 11 /* key-up event */
+#define NX_FLAGSCHANGED 12 /* flags-changed event */
+
+/* composite events */
+
+#define NX_KITDEFINED 13 /* application-kit-defined event */
+#define NX_SYSDEFINED 14 /* system-defined event */
+#define NX_APPDEFINED 15 /* application-defined event */
+/* There are additional DPS client defined events past this point. */
+
+/* Scroll wheel events */
+
+#define NX_SCROLLWHEELMOVED 22
+
+/* Zoom events */
+#define NX_ZOOM 28
+
+/* tablet events */
+
+#define NX_TABLETPOINTER 23 /* for non-mousing transducers */
+#define NX_TABLETPROXIMITY 24 /* for non-mousing transducers */
+
+/* event range */
+
+#define NX_FIRSTEVENT 0
+#define NX_LASTEVENT 28
+#define NX_NUMPROCS (NX_LASTEVENT-NX_FIRSTEVENT+1)
+
+/* Event masks */
+#define NX_NULLEVENTMASK (1 << NX_NULLEVENT) /* NULL event */
+#define NX_LMOUSEDOWNMASK (1 << NX_LMOUSEDOWN) /* left mouse-down */
+#define NX_LMOUSEUPMASK (1 << NX_LMOUSEUP) /* left mouse-up */
+#define NX_RMOUSEDOWNMASK (1 << NX_RMOUSEDOWN) /* right mouse-down */
+#define NX_RMOUSEUPMASK (1 << NX_RMOUSEUP) /* right mouse-up */
+#define NX_OMOUSEDOWNMASK (1 << NX_OMOUSEDOWN) /* other mouse-down */
+#define NX_OMOUSEUPMASK (1 << NX_OMOUSEUP) /* other mouse-up */
+#define NX_MOUSEMOVEDMASK (1 << NX_MOUSEMOVED) /* mouse-moved */
+#define NX_LMOUSEDRAGGEDMASK (1 << NX_LMOUSEDRAGGED) /* left-dragged */
+#define NX_RMOUSEDRAGGEDMASK (1 << NX_RMOUSEDRAGGED) /* right-dragged */
+#define NX_OMOUSEDRAGGEDMASK (1 << NX_OMOUSEDRAGGED) /* other-dragged */
+#define NX_MOUSEENTEREDMASK (1 << NX_MOUSEENTERED) /* mouse-entered */
+#define NX_MOUSEEXITEDMASK (1 << NX_MOUSEEXITED) /* mouse-exited */
+#define NX_KEYDOWNMASK (1 << NX_KEYDOWN) /* key-down */
+#define NX_KEYUPMASK (1 << NX_KEYUP) /* key-up */
+#define NX_FLAGSCHANGEDMASK (1 << NX_FLAGSCHANGED) /* flags-changed */
+#define NX_KITDEFINEDMASK (1 << NX_KITDEFINED) /* kit-defined */
+#define NX_SYSDEFINEDMASK (1 << NX_SYSDEFINED) /* system-defined */
+#define NX_APPDEFINEDMASK (1 << NX_APPDEFINED) /* app-defined */
+#define NX_SCROLLWHEELMOVEDMASK (1 << NX_SCROLLWHEELMOVED) /* scroll wheel moved */
+#define NX_ZOOMMASK (1 << NX_ZOOM) /* Zoom */
+#define NX_TABLETPOINTERMASK (1 << NX_TABLETPOINTER) /* tablet pointer moved */
+#define NX_TABLETPROXIMITYMASK (1 << NX_TABLETPROXIMITY) /* tablet pointer proximity */
+
+#define EventCodeMask(type) (1 << (type))
+#define NX_ALLEVENTS -1 /* Check for all events */
+
+/* sub types for mouse and move events */
+
+#define NX_SUBTYPE_DEFAULT 0
+#define NX_SUBTYPE_TABLET_POINT 1
+#define NX_SUBTYPE_TABLET_PROXIMITY 2
+#define NX_SUBTYPE_MOUSE_TOUCH 3
+
+/* sub types for system defined events */
+
+#define NX_SUBTYPE_POWER_KEY 1
+#define NX_SUBTYPE_AUX_MOUSE_BUTTONS 7
+
+/*
+ * NX_SUBTYPE_AUX_CONTROL_BUTTONS usage
+ *
+ * The incoming NXEvent for other mouse button down/up has event.type
+ * NX_SYSDEFINED and event.data.compound.subtype NX_SUBTYPE_AUX_MOUSE_BUTTONS.
+ * Within the event.data.compound.misc.L[0] contains bits for all the buttons
+ * that have changed state, and event.data.compound.misc.L[1] contains the
+ * current button state as a bitmask, with 1 representing down, and 0
+ * representing up. Bit 0 is the left button, bit one is the right button,
+ * bit 2 is the center button and so forth.
+ */
+#define NX_SUBTYPE_AUX_CONTROL_BUTTONS 8
+
+#define NX_SUBTYPE_EJECT_KEY 10
+#define NX_SUBTYPE_SLEEP_EVENT 11
+#define NX_SUBTYPE_RESTART_EVENT 12
+#define NX_SUBTYPE_SHUTDOWN_EVENT 13
+#define NX_SUBTYPE_MENU 16
+#define NX_SUBTYPE_ACCESSIBILITY 17
+
+
+
+#define NX_SUBTYPE_STICKYKEYS_ON 100
+#define NX_SUBTYPE_STICKYKEYS_OFF 101
+#define NX_SUBTYPE_STICKYKEYS_SHIFT 102
+#define NX_SUBTYPE_STICKYKEYS_CONTROL 103
+#define NX_SUBTYPE_STICKYKEYS_ALTERNATE 104
+#define NX_SUBTYPE_STICKYKEYS_COMMAND 105
+#define NX_SUBTYPE_STICKYKEYS_RELEASE 106
+#define NX_SUBTYPE_STICKYKEYS_TOGGLEMOUSEDRIVING 107
+
+// New stickykeys key events
+// These were created to send an event describing the
+// different state of the modifiers
+#define NX_SUBTYPE_STICKYKEYS_SHIFT_DOWN 110
+#define NX_SUBTYPE_STICKYKEYS_CONTROL_DOWN 111
+#define NX_SUBTYPE_STICKYKEYS_ALTERNATE_DOWN 112
+#define NX_SUBTYPE_STICKYKEYS_COMMAND_DOWN 113
+#define NX_SUBTYPE_STICKYKEYS_FN_DOWN 114
+
+#define NX_SUBTYPE_STICKYKEYS_SHIFT_LOCK 120
+#define NX_SUBTYPE_STICKYKEYS_CONTROL_LOCK 121
+#define NX_SUBTYPE_STICKYKEYS_ALTERNATE_LOCK 122
+#define NX_SUBTYPE_STICKYKEYS_COMMAND_LOCK 123
+#define NX_SUBTYPE_STICKYKEYS_FN_LOCK 124
+
+#define NX_SUBTYPE_STICKYKEYS_SHIFT_UP 130
+#define NX_SUBTYPE_STICKYKEYS_CONTROL_UP 131
+#define NX_SUBTYPE_STICKYKEYS_ALTERNATE_UP 132
+#define NX_SUBTYPE_STICKYKEYS_COMMAND_UP 133
+#define NX_SUBTYPE_STICKYKEYS_FN_UP 134
+
+
+
+// SlowKeys
+#define NX_SUBTYPE_SLOWKEYS_START 200
+#define NX_SUBTYPE_SLOWKEYS_ABORT 201
+#define NX_SUBTYPE_SLOWKEYS_END 202
+
+// HID Parameter Property Modified
+#define NX_SUBTYPE_HIDPARAMETER_MODIFIED 210
+
+/* Masks for the bits in event.flags */
+
+/* device-independent */
+
+#define NX_ALPHASHIFTMASK 0x00010000
+#define NX_SHIFTMASK 0x00020000
+#define NX_CONTROLMASK 0x00040000
+#define NX_ALTERNATEMASK 0x00080000
+#define NX_COMMANDMASK 0x00100000
+#define NX_NUMERICPADMASK 0x00200000
+#define NX_HELPMASK 0x00400000
+#define NX_SECONDARYFNMASK 0x00800000
+#define NX_ALPHASHIFT_STATELESS_MASK 0x01000000
+
+/* device-dependent (really?) */
+
+#define NX_DEVICELCTLKEYMASK 0x00000001
+#define NX_DEVICELSHIFTKEYMASK 0x00000002
+#define NX_DEVICERSHIFTKEYMASK 0x00000004
+#define NX_DEVICELCMDKEYMASK 0x00000008
+#define NX_DEVICERCMDKEYMASK 0x00000010
+#define NX_DEVICELALTKEYMASK 0x00000020
+#define NX_DEVICERALTKEYMASK 0x00000040
+#define NX_DEVICE_ALPHASHIFT_STATELESS_MASK 0x00000080
+#define NX_DEVICERCTLKEYMASK 0x00002000
+
+/*
+ * Additional reserved bits in event.flags
+ */
+
+#define NX_STYLUSPROXIMITYMASK 0x00000080 /* deprecated */
+#define NX_NONCOALSESCEDMASK 0x00000100
+
+/* click state values
+ * If you have the following events in close succession, the click
+ * field has the indicated value:
+ *
+ * Event Click Value Comments
+ * mouse-down 1 Not part of any click yet
+ * mouse-up 1 Aha! A click!
+ * mouse-down 2 Doing a double-click
+ * mouse-up 2 It's finished
+ * mouse-down 3 A triple
+ * mouse-up 3
+ */
+
+/* Values for the character set in event.data.key.charSet */
+
+#define NX_ASCIISET 0
+#define NX_SYMBOLSET 1
+#define NX_DINGBATSSET 2
+
+/* tablet button masks
+ * Mask bits for the tablet barrel buttons placed in tablet.buttons.
+ * The buttons field uses adopts the following convention:
+ *
+ * Bit Comments
+ * 0 Left Mouse Button ( kHIDUsage_Button_1 )
+ * 1 Right Mouse Button ( kHIDUsage_Button_2 )
+ * 2 Middle Mouse Button ( kHIDUsage_Button_3 )
+ * 3 4th Mouse Button ( kHIDUsage_Button_4 )
+ * ...
+ * 15 15th Mouse Button
+ *
+ * For your convenience, the following mask bits have been defined
+ * for tablet specific application:
+ */
+
+#define NX_TABLET_BUTTON_PENTIPMASK 0x0001
+#define NX_TABLET_BUTTON_PENLOWERSIDEMASK 0x0002
+#define NX_TABLET_BUTTON_PENUPPERSIDEMASK 0x0004
+
+
+/* tablet capability masks
+ * Mask bits for the tablet capabilities field. Use these
+ * masks with the capabilities field of a proximity event to
+ * determine what fields in a Tablet Event are valid for this
+ * device.
+ */
+#define NX_TABLET_CAPABILITY_DEVICEIDMASK 0x0001
+#define NX_TABLET_CAPABILITY_ABSXMASK 0x0002
+#define NX_TABLET_CAPABILITY_ABSYMASK 0x0004
+#define NX_TABLET_CAPABILITY_VENDOR1MASK 0x0008
+#define NX_TABLET_CAPABILITY_VENDOR2MASK 0x0010
+#define NX_TABLET_CAPABILITY_VENDOR3MASK 0x0020
+#define NX_TABLET_CAPABILITY_BUTTONSMASK 0x0040
+#define NX_TABLET_CAPABILITY_TILTXMASK 0x0080
+#define NX_TABLET_CAPABILITY_TILTYMASK 0x0100
+#define NX_TABLET_CAPABILITY_ABSZMASK 0x0200
+#define NX_TABLET_CAPABILITY_PRESSUREMASK 0x0400
+#define NX_TABLET_CAPABILITY_TANGENTIALPRESSUREMASK 0x0800
+#define NX_TABLET_CAPABILITY_ORIENTINFOMASK 0x1000
+#define NX_TABLET_CAPABILITY_ROTATIONMASK 0x2000
+
+/* proximity pointer types
+ * Value that describes the type of pointing device placed in
+ * proximity.pointerType.
+ */
+
+#define NX_TABLET_POINTER_UNKNOWN 0
+#define NX_TABLET_POINTER_PEN 1
+#define NX_TABLET_POINTER_CURSOR 2
+#define NX_TABLET_POINTER_ERASER 3
+
+/* TabletPointData type: defines the tablet data for points included
+ * in mouse events created by a tablet driver.
+ */
+
+typedef struct _NXTabletPointData {
+ SInt32 x; /* absolute x coordinate in tablet space at full tablet resolution */
+ SInt32 y; /* absolute y coordinate in tablet space at full tablet resolution */
+ SInt32 z; /* absolute z coordinate in tablet space at full tablet resolution */
+ UInt16 buttons; /* one bit per button - bit 0 is first button - 1 = closed */
+ UInt16 pressure; /* scaled pressure value; MAX=(2^16)-1, MIN=0 */
+ struct { /* tilt range is -((2^15)-1) to (2^15)-1 (-32767 to 32767) */
+ SInt16 x; /* scaled tilt x value */
+ SInt16 y; /* scaled tilt y value */
+ } tilt;
+ UInt16 rotation; /* Fixed-point representation of device rotation in a 10.6 format */
+ SInt16 tangentialPressure; /* tangential pressure on the device; same range as tilt */
+ UInt16 deviceID; /* system-assigned unique device ID */
+ SInt16 vendor1; /* vendor-defined signed 16-bit integer */
+ SInt16 vendor2; /* vendor-defined signed 16-bit integer */
+ SInt16 vendor3; /* vendor-defined signed 16-bit integer */
+} NXTabletPointData, *NXTabletPointDataPtr;
+
+/* TabletProximityData type: defines the tablet data for proximity
+ * events included in mouse events created by a tablet driver.
+ */
+
+typedef struct _NXTabletProximityData {
+ UInt16 vendorID; /* vendor-defined ID - typically the USB vendor ID */
+ UInt16 tabletID; /* vendor-defined tablet ID - typically the USB product ID */
+ UInt16 pointerID; /* vendor-defined ID of the specific pointing device */
+ UInt16 deviceID; /* system-assigned unique device ID */
+ UInt16 systemTabletID; /* system-assigned unique tablet ID */
+ UInt16 vendorPointerType; /* vendor-defined pointer type */
+ UInt32 pointerSerialNumber; /* vendor-defined serial number */
+ UInt64 uniqueID __attribute__ ((packed)); /* vendor-defined unique ID */
+ UInt32 capabilityMask; /* capabilities mask of the device */
+ UInt8 pointerType; /* type of pointing device */
+ UInt8 enterProximity; /* non-zero = entering; zero = leaving */
+ SInt16 reserved1;
+} NXTabletProximityData, *NXTabletProximityDataPtr;
+
+/* EventData type: defines the data field of an event */
+
+typedef union {
+ struct { /* For mouse-down and mouse-up events */
+ UInt8 subx; /* sub-pixel position for x */
+ UInt8 suby; /* sub-pixel position for y */
+ SInt16 eventNum; /* unique identifier for this button */
+ SInt32 click; /* click state of this event */
+ UInt8 pressure; /* pressure value: 0=none, 255=full */
+ UInt8 buttonNumber;/* button generating other button event (0-31) */
+ UInt8 subType;
+ UInt8 reserved2;
+ SInt32 reserved3;
+ union {
+ NXTabletPointData point; /* tablet point data */
+ NXTabletProximityData proximity; /* tablet proximity data */
+ } tablet;
+ } mouse;
+ struct {
+ SInt32 dx;
+ SInt32 dy;
+ UInt8 subx;
+ UInt8 suby;
+ UInt8 subType;
+ UInt8 reserved1;
+ SInt32 reserved2;
+ union {
+ NXTabletPointData point; /* tablet point data */
+ NXTabletProximityData proximity; /* tablet proximity data */
+ } tablet;
+ } mouseMove;
+ struct { /* For key-down and key-up events */
+ UInt16 origCharSet; /* unmodified character set code */
+ SInt16 repeat; /* for key-down: nonzero if really a repeat */
+ UInt16 charSet; /* character set code */
+ UInt16 charCode; /* character code in that set */
+ UInt16 keyCode; /* device-dependent key number */
+ UInt16 origCharCode; /* unmodified character code */
+ SInt32 reserved1;
+ UInt32 keyboardType;
+ SInt32 reserved2;
+ SInt32 reserved3;
+ SInt32 reserved4;
+ SInt32 reserved5[4];
+ } key;
+ struct { /* For mouse-entered and mouse-exited events */
+ SInt16 reserved;
+ SInt16 eventNum; /* unique identifier from mouse down event */
+ SInt32 trackingNum; /* unique identifier from settrackingrect */
+ SInt32 userData; /* uninterpreted integer from settrackingrect */
+ SInt32 reserved1;
+ SInt32 reserved2;
+ SInt32 reserved3;
+ SInt32 reserved4;
+ SInt32 reserved5;
+ SInt32 reserved6[4];
+ } tracking;
+ struct {
+ SInt16 deltaAxis1;
+ SInt16 deltaAxis2;
+ SInt16 deltaAxis3;
+ SInt16 reserved1;
+ SInt32 fixedDeltaAxis1;
+ SInt32 fixedDeltaAxis2;
+ SInt32 fixedDeltaAxis3;
+ SInt32 pointDeltaAxis1;
+ SInt32 pointDeltaAxis2;
+ SInt32 pointDeltaAxis3;
+ SInt32 reserved8[4];
+ } scrollWheel, zoom;
+ struct { /* For window-changed, sys-defined, and app-defined events */
+ SInt16 reserved;
+ SInt16 subType; /* event subtype for compound events */
+ union {
+ float F[11]; /* for use in compound events */
+ SInt32 L[11]; /* for use in compound events */
+ SInt16 S[22]; /* for use in compound events */
+ char C[44]; /* for use in compound events */
+ } misc;
+ } compound;
+ struct {
+ SInt32 x; /* absolute x coordinate in tablet space at full tablet resolution */
+ SInt32 y; /* absolute y coordinate in tablet space at full tablet resolution */
+ SInt32 z; /* absolute z coordinate in tablet space at full tablet resolution */
+ UInt16 buttons; /* one bit per button - bit 0 is first button - 1 = closed */
+ UInt16 pressure; /* scaled pressure value; MAX=(2^16)-1, MIN=0 */
+ struct { /* tilt range is -((2^15)-1) to (2^15)-1 (-32767 to 32767) */
+ SInt16 x; /* scaled tilt x value */
+ SInt16 y; /* scaled tilt y value */
+ } tilt;
+ UInt16 rotation; /* Fixed-point representation of device rotation in a 10.6 format */
+ SInt16 tangentialPressure; /* tangential pressure on the device; same range as tilt */
+ UInt16 deviceID; /* system-assigned unique device ID */
+ SInt16 vendor1; /* vendor-defined signed 16-bit integer */
+ SInt16 vendor2; /* vendor-defined signed 16-bit integer */
+ SInt16 vendor3; /* vendor-defined signed 16-bit integer */
+ SInt32 reserved[4];
+ } tablet;
+ struct {
+ UInt16 vendorID; /* vendor-defined ID - typically the USB vendor ID */
+ UInt16 tabletID; /* vendor-defined tablet ID - typically the USB product ID */
+ UInt16 pointerID; /* vendor-defined ID of the specific pointing device */
+ UInt16 deviceID; /* system-assigned unique device ID */
+ UInt16 systemTabletID; /* system-assigned unique tablet ID */
+ UInt16 vendorPointerType; /* vendor-defined pointer type */
+ UInt32 pointerSerialNumber; /* vendor-defined serial number */
+ UInt64 uniqueID __attribute__ ((packed)); /* vendor-defined unique ID */
+ UInt32 capabilityMask; /* capabilities mask of the device */
+ UInt8 pointerType; /* type of pointing device */
+ UInt8 enterProximity; /* non-zero = entering; zero = leaving */
+ SInt16 reserved1;
+ SInt32 reserved2[4];
+ } proximity;
+} NXEventData;
+
+/* The current version number of the NXEventData structure. */
+
+#define kNXEventDataVersion 2
+
+/* Finally! The event record! */
+#ifndef __ppc__
+typedef struct _NXEvent {
+ SInt32 type; /* An event type from above */
+ struct {
+ SInt32 x, y; /* Base coordinates in window, */
+ } location; /* from bottom left */
+ UInt64 time __attribute__ ((packed)); /* time since launch */
+ SInt32 flags; /* key state flags */
+ UInt32 window; /* window number of assigned window */
+ UInt64 service_id __attribute__ ((packed)); /* service id */
+ SInt32 ext_pid; /* external pid */
+ NXEventData data; /* type-dependent data */
+} NXEvent, *NXEventPtr;
+
+#else
+
+typedef struct _NXEvent {
+ SInt32 type; /* An event type from above */
+ struct {
+ SInt32 x, y; /* Base coordinates in window, */
+ } location; /* from bottom left */
+ UInt64 time __attribute__ ((packed)); /* time since launch */
+ SInt32 flags; /* key state flags */
+ UInt32 window; /* window number of assigned window */
+ NXEventData data; /* type-dependent data */
+ UInt64 service_id __attribute__ ((packed)); /* service id */
+ SInt32 ext_pid; /* external pid */
+} NXEvent, *NXEventPtr;
+
+#endif
+
+/* The current version number of the NXEvent structure. */
+
+#define kNXEventVersion 2
+
+/* How to pick window(s) for event (for PostEvent) */
+#define NX_NOWINDOW -1
+#define NX_BYTYPE 0
+#define NX_BROADCAST 1
+#define NX_TOPWINDOW 2
+#define NX_FIRSTWINDOW 3
+#define NX_MOUSEWINDOW 4
+#define NX_NEXTWINDOW 5
+#define NX_LASTLEFT 6
+#define NX_LASTRIGHT 7
+#define NX_LASTKEY 8
+#define NX_EXPLICIT 9
+#define NX_TRANSMIT 10
+#define NX_BYPSCONTEXT 11
+
+#endif /* EVENT_H */ /* End of defs common with dpsclient/event.h */
+
+/* Mask of events that cause the screen to wake up */
+#define NX_WAKEMASK ( NX_KEYDOWNMASK | NX_FLAGSCHANGEDMASK | \
+ NX_LMOUSEDOWNMASK | NX_LMOUSEUPMASK | \
+ NX_RMOUSEDOWNMASK | NX_RMOUSEUPMASK | \
+ NX_OMOUSEDOWNMASK | NX_OMOUSEUPMASK \
+ )
+
+/* Mask of events that cause screen to undim */
+#define NX_UNDIMMASK ( NX_WAKEMASK | NX_KEYUPMASK | NX_SCROLLWHEELMOVEDMASK | \
+ NX_LMOUSEDRAGGEDMASK | NX_RMOUSEDRAGGEDMASK | NX_OMOUSEDRAGGEDMASK | \
+ NX_MOUSEMOVEDMASK | NX_MOUSEENTEREDMASK | NX_MOUSEEXITEDMASK | \
+ NX_TABLETPOINTERMASK | NX_TABLETPROXIMITYMASK \
+ )
+
+
+#define NX_EVENT_EXTENSION_LOCATION_INVALID 0x1
+#define NX_EVENT_EXTENSION_LOCATION_TYPE_FLOAT 0x2
+#define NX_EVENT_EXTENSION_LOCATION_DEVICE_SCALED 0x4
+#define NX_EVENT_EXTENSION_MOUSE_DELTA_TYPE_FLOAT 0x8
+#define NX_EVENT_EXTENSION_AUDIT_TOKEN 0x10
+
+typedef struct _NXEventExtension {
+ UInt32 flags;
+ audit_token_t audit;
+} NXEventExtension;
+
+typedef struct _NXEventExt {
+ NXEvent payload;
+ NXEventExtension extension;
+} NXEventExt;
+
+#endif /* !_DEV_EVENT_H */
+
diff --git a/include/IOKit/hidsystem/ev_keymap.h b/include/IOKit/hidsystem/ev_keymap.h
new file mode 100644
index 0000000..e6db930
--- /dev/null
+++ b/include/IOKit/hidsystem/ev_keymap.h
@@ -0,0 +1,171 @@
+/*
+ * @APPLE_LICENSE_HEADER_START@
+ *
+ * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
+ *
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * @APPLE_LICENSE_HEADER_END@
+ */
+/* Copyright (c) 1992 NeXT Computer, Inc. All rights reserved.
+ *
+ * ev_keymap.h
+ * Defines the structure used for parsing keymappings. These structures
+ * and definitions are used by event sources in the kernel and by
+ * applications and utilities which manipulate keymaps.
+ *
+ * HISTORY
+ * 02-Jun-1992 Mike Paquette at NeXT
+ * Created.
+ */
+
+#ifndef _DEV_EV_KEYMAP_H
+#define _DEV_EV_KEYMAP_H
+
+#define NX_NUMKEYCODES 256 /* Highest key code is 0xff. ADB used to use 0x80 for keydown state, but who the heck uses adb anymore. */
+#define NX_NUMSEQUENCES 128 /* Maximum possible number of sequences */
+#define NX_NUMMODIFIERS 16 /* Maximum number of modifier bits */
+#define NX_BYTE_CODES 0 /* If first short 0, all are bytes (else shorts) */
+
+#define NX_WHICHMODMASK 0x0f /* bits out of keyBits for bucky bits */
+#define NX_MODMASK 0x10 /* Bit out of keyBits indicates modifier bit */
+#define NX_CHARGENMASK 0x20 /* bit out of keyBits for char gen */
+#define NX_SPECIALKEYMASK 0x40 /* bit out of keyBits for specialty key */
+#define NX_KEYSTATEMASK 0x80 /* OBSOLETE - DO NOT USE IN NEW DESIGNS */
+
+/*
+ * Special keys currently known to and understood by the system.
+ * If new specialty keys are invented, extend this list as appropriate.
+ * The presence of these keys in a particular implementation is not
+ * guaranteed.
+ */
+#define NX_NOSPECIALKEY 0xFFFF
+#define NX_KEYTYPE_SOUND_UP 0
+#define NX_KEYTYPE_SOUND_DOWN 1
+#define NX_KEYTYPE_BRIGHTNESS_UP 2
+#define NX_KEYTYPE_BRIGHTNESS_DOWN 3
+#define NX_KEYTYPE_CAPS_LOCK 4
+#define NX_KEYTYPE_HELP 5
+#define NX_POWER_KEY 6
+#define NX_KEYTYPE_MUTE 7
+#define NX_UP_ARROW_KEY 8
+#define NX_DOWN_ARROW_KEY 9
+#define NX_KEYTYPE_NUM_LOCK 10
+
+#define NX_KEYTYPE_CONTRAST_UP 11
+#define NX_KEYTYPE_CONTRAST_DOWN 12
+#define NX_KEYTYPE_LAUNCH_PANEL 13
+#define NX_KEYTYPE_EJECT 14
+#define NX_KEYTYPE_VIDMIRROR 15
+
+#define NX_KEYTYPE_PLAY 16
+#define NX_KEYTYPE_NEXT 17
+#define NX_KEYTYPE_PREVIOUS 18
+#define NX_KEYTYPE_FAST 19
+#define NX_KEYTYPE_REWIND 20
+
+#define NX_KEYTYPE_ILLUMINATION_UP 21
+#define NX_KEYTYPE_ILLUMINATION_DOWN 22
+#define NX_KEYTYPE_ILLUMINATION_TOGGLE 23
+
+#define NX_NUMSPECIALKEYS 24 /* Maximum number of special keys */
+#define NX_NUM_SCANNED_SPECIALKEYS 24 /* First 24 special keys are */
+ /* actively scanned in kernel */
+
+#define NX_KEYTYPE_MENU 25
+
+/* Mask of special keys that are posted as events */
+
+#define NX_SPECIALKEY_POST_MASK \
+ ((1 << NX_KEYTYPE_SOUND_UP) | (1 << NX_KEYTYPE_SOUND_DOWN) | \
+ (1 << NX_POWER_KEY) | (1 << NX_KEYTYPE_MUTE) | \
+ (1 << NX_KEYTYPE_BRIGHTNESS_UP) | (1 << NX_KEYTYPE_BRIGHTNESS_DOWN) | \
+ (1 << NX_KEYTYPE_CONTRAST_UP) | (1 << NX_KEYTYPE_CONTRAST_UP) | \
+ (1 << NX_KEYTYPE_LAUNCH_PANEL) | (1 << NX_KEYTYPE_EJECT) | \
+ (1 << NX_KEYTYPE_VIDMIRROR) | (1 << NX_KEYTYPE_PLAY) | \
+ (1 << NX_KEYTYPE_NEXT) | (1 << NX_KEYTYPE_PREVIOUS) | \
+ (1 << NX_KEYTYPE_FAST) | (1 << NX_KEYTYPE_REWIND) | \
+ (1 << NX_KEYTYPE_ILLUMINATION_UP) | \
+ (1 << NX_KEYTYPE_ILLUMINATION_DOWN) | \
+ (1 << NX_KEYTYPE_ILLUMINATION_TOGGLE) | 0)
+
+/* Modifier key indices into modDefs[] */
+#define NX_MODIFIERKEY_ALPHALOCK 0
+#define NX_MODIFIERKEY_SHIFT 1
+#define NX_MODIFIERKEY_CONTROL 2
+#define NX_MODIFIERKEY_ALTERNATE 3
+#define NX_MODIFIERKEY_COMMAND 4
+#define NX_MODIFIERKEY_NUMERICPAD 5
+#define NX_MODIFIERKEY_HELP 6
+#define NX_MODIFIERKEY_SECONDARYFN 7
+#define NX_MODIFIERKEY_NUMLOCK 8
+
+/* support for right hand modifier */
+#define NX_MODIFIERKEY_RSHIFT 9
+#define NX_MODIFIERKEY_RCONTROL 10
+#define NX_MODIFIERKEY_RALTERNATE 11
+#define NX_MODIFIERKEY_RCOMMAND 12
+
+#define NX_MODIFIERKEY_ALPHALOCK_STATELESS 13
+#define NX_MODIFIERKEY_LAST_KEY 13
+
+
+typedef struct _NXParsedKeyMapping_ {
+ /* If nonzero, all numbers are shorts; if zero, all numbers are bytes*/
+ short shorts;
+
+ /*
+ * For each keycode, low order bit says if the key
+ * generates characters.
+ * High order bit says if the key is assigned to a modifier bit.
+ * The second to low order bit gives the current state of the key.
+ */
+ char keyBits[NX_NUMKEYCODES];
+
+ /* Bit number of highest numbered modifier bit */
+ int maxMod;
+
+ /* Pointers to where the list of keys for each modifiers bit begins,
+ * or NULL.
+ */
+ unsigned char *modDefs[NX_NUMMODIFIERS];
+
+ /* Key code of highest key deinfed to generate characters */
+ int numDefs;
+
+ /* Pointer into the keyMapping where this key's definitions begin */
+ unsigned char *keyDefs[NX_NUMKEYCODES];
+
+ /* number of sequence definitions */
+ int numSeqs;
+
+ /* pointers to sequences */
+ unsigned char *seqDefs[NX_NUMSEQUENCES];
+
+ /* Special key definitions */
+ int numSpecialKeys;
+
+ /* Special key values, or 0xFFFF if none */
+ unsigned short specialKeys[NX_NUMSPECIALKEYS];
+
+ /* Pointer to the original keymapping string */
+ const unsigned char *mapping;
+
+ /* Length of the original string */
+ int mappingLen;
+} NXParsedKeyMapping;
+
+#endif /* !_DEV_EV_KEYMAP_H */
diff --git a/include/IOKit/hidsystem/event_status_driver.h b/include/IOKit/hidsystem/event_status_driver.h
new file mode 100644
index 0000000..a586018
--- /dev/null
+++ b/include/IOKit/hidsystem/event_status_driver.h
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_LICENSE_HEADER_START@
+ *
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * @APPLE_LICENSE_HEADER_END@
+ */
+/******************************************************************************
+ event_status_driver.h
+ API for the events status driver.
+ This file contains public API.
+ mpaque 11Oct91
+
+ Copyright 1991 NeXT Computer, Inc.
+
+ Modified:
+
+******************************************************************************/
+
+#ifndef _DRIVERS_EVENT_STATUS_DRIVER_
+#define _DRIVERS_EVENT_STATUS_DRIVER_
+
+__BEGIN_DECLS
+
+#include
+#include
+#include
+#include
+#include
+
+/*
+ * Event System Handle:
+ *
+ * Information used by the system between calls to NXOpenEventSystem and
+ * NXCloseEventSystem. The application should not
+ * access any of the elements of this structure.
+ */
+typedef mach_port_t NXEventHandle;
+
+/* Open and Close */
+NXEventHandle NXOpenEventStatus(void) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_12, __IPHONE_NA, __IPHONE_NA);
+void NXCloseEventStatus(NXEventHandle handle) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_12, __IPHONE_NA, __IPHONE_NA);
+
+/* Status */
+extern NXEventSystemInfoType NXEventSystemInfo(NXEventHandle handle,
+ char *flavor,
+ int *evs_info,
+ unsigned int *evs_info_cnt) __deprecated;
+/* Keyboard */
+extern void NXSetKeyRepeatInterval(NXEventHandle handle, double seconds) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_12, __IPHONE_NA, __IPHONE_NA);
+extern double NXKeyRepeatInterval(NXEventHandle handle) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_12, __IPHONE_NA, __IPHONE_NA);
+extern void NXSetKeyRepeatThreshold(NXEventHandle handle, double threshold) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_12, __IPHONE_NA, __IPHONE_NA);
+extern double NXKeyRepeatThreshold(NXEventHandle handle) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_12, __IPHONE_NA, __IPHONE_NA);
+extern void NXResetKeyboard(NXEventHandle handle) __deprecated;
+
+/* Mouse */
+extern void NXSetClickTime(NXEventHandle handle, double seconds)__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_12, __IPHONE_NA, __IPHONE_NA);
+extern double NXClickTime(NXEventHandle handle) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_12, __IPHONE_NA, __IPHONE_NA);
+extern void NXSetClickSpace(NXEventHandle handle, _NXSize_ *area) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_12, __IPHONE_NA, __IPHONE_NA);
+extern void NXGetClickSpace(NXEventHandle handle, _NXSize_ *area) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_12, __IPHONE_NA, __IPHONE_NA);
+extern void NXResetMouse(NXEventHandle handle) __deprecated;
+
+/*
+* The following functions have been removed.
+*
+* NXIdleTime
+* ÊÊÊÊSee CGEventSourceSecondsSinceLastEventType.
+*
+* NXSetKeyMapping
+* NXKeyMappingLength
+* NXGetKeyMapping
+* ÊÊÊÊThese do not have a drop in replacement. ÊSee UCKeyTranslate.
+*
+* NXSetMouseScaling
+* ÊÊÊÊSee IOHIDSetAccelerationWithKey and IOHIDSetMouseAcceleration.
+*
+* NXGetMouseScaling
+* ÊÊÊÊSee IOHIDGetAccelerationWithKey and IOHIDGetMouseAcceleration.
+*
+* NXSetAutoDimThreshold
+* NXSetAutoDimState
+* ÊÊÊÊSee IOPMSetAggressiveness and kPMMinutesToDim.
+*
+* NXAutoDimThreshold
+* NXAutoDimTime
+* NXAutoDimState
+* ÊÊÊÊSee IOPMGetAggressiveness and kPMMinutesToDim.
+*
+* NXSetAutoDimBrightness
+* NXAutoDimBrightness
+* NXSetScreenBrightness
+* NXScreenBrightness
+* ÊÊÊÊThis functionality is unsupported.
+*/
+
+__END_DECLS
+
+#endif /*_DRIVERS_EVENT_STATUS_DRIVER_ */
+
diff --git a/include/IOKit/ps/IOPSKeys.h b/include/IOKit/ps/IOPSKeys.h
new file mode 100644
index 0000000..571951c
--- /dev/null
+++ b/include/IOKit/ps/IOPSKeys.h
@@ -0,0 +1,773 @@
+/*
+ * Copyright (c) 2002-2010 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_LICENSE_HEADER_START@
+ *
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * @APPLE_LICENSE_HEADER_END@
+ */
+
+/*!
+ * @header IOPSKeys.h
+ *
+ * @discussion
+ * IOPSKeys.h defines C strings for use accessing power source data in IOPowerSource
+ * CFDictionaries, as returned by @link //apple_ref/c/func/IOPSGetPowerSourceDescription IOPSGetPowerSourceDescription @/link
+ * Note that all of these C strings must be converted to CFStrings before use. You can wrap
+ * them with the CFSTR() macro, or create a CFStringRef (that you must later CFRelease()) using CFStringCreateWithCString().
+ */
+
+#ifndef _IOPSKEYS_H_
+#define _IOPSKEYS_H_
+
+/*!
+ * @group IOPSPowerAdapter Keys
+ *
+ * @discussion
+ * Use these kIOPSPowerAdapter keys to decipher the dictionary returned
+ * by @link //apple_ref/c/func/IOPSCopyExternalPowerAdapterDetails IOPSCopyExternalPowerAdapterDetails @/link
+ */
+
+/*!
+ * @define kIOPSPowerAdapterIDKey
+ *
+ * @abstract This key refers to the attached external AC power adapter's ID.
+ * The value associated with this key is a CFNumberRef kCFNumberIntType integer.
+ *
+ * @discussion This key may be present in the dictionary returned from
+ * @link //apple_ref/c/func/IOPSCopyExternalPowerAdapterDetails IOPSCopyExternalPowerAdapterDetails @/link
+ * This key might not be defined in the adapter details dictionary.
+ */
+#define kIOPSPowerAdapterIDKey "AdapterID"
+
+/*!
+ * @define kIOPSPowerAdapterWattsKey
+ *
+ * @abstract This key refers to the wattage of the external AC power adapter attached to a portable.
+ * The value associated with this key is a CFNumberRef kCFNumberIntType integer value, in units of watts.
+ *
+ * @discussion This key may be present in the dictionary returned from
+ * @link //apple_ref/c/func/IOPSCopyExternalPowerAdapterDetails IOPSCopyExternalPowerAdapterDetails @/link
+ * This key might not be defined in the adapter details dictionary.
+ */
+#define kIOPSPowerAdapterWattsKey "Watts"
+
+/*!
+ * @define kIOPSPowerAdapterRevisionKey
+ *
+ * @abstract The power adapter's revision.
+ * The value associated with this key is a CFNumberRef kCFNumberIntType integer value
+ *
+ * @discussion This key may be present in the dictionary returned from
+ * @link //apple_ref/c/func/IOPSCopyExternalPowerAdapterDetails IOPSCopyExternalPowerAdapterDetails @/link
+ * This key might not be defined in the adapter details dictionary.
+ */
+#define kIOPSPowerAdapterRevisionKey "AdapterRevision"
+
+/*!
+ * @define kIOPSPowerAdapterSerialNumberKey
+ *
+ * @abstract The power adapter's serial number.
+ * The value associated with this key is a CFNumberRef kCFNumberIntType integer value
+ *
+ * @discussion This key may be present in the dictionary returned from
+ * @link //apple_ref/c/func/IOPSCopyExternalPowerAdapterDetails IOPSCopyExternalPowerAdapterDetails @/link
+ * This key might not be defined in the adapter details dictionary.
+ */
+#define kIOPSPowerAdapterSerialNumberKey "SerialNumber"
+
+/*!
+ * @define kIOPSPowerAdapterFamilyKey
+ *
+ * @abstract The power adapter's family code.
+ * The value associated with this key is a CFNumberRef kCFNumberIntType integer value
+ *
+ * @discussion This key may be present in the dictionary returned from
+ * @link //apple_ref/c/func/IOPSCopyExternalPowerAdapterDetails IOPSCopyExternalPowerAdapterDetails @/link
+ * This key might not be defined in the adapter details dictionary.
+ */
+#define kIOPSPowerAdapterFamilyKey "FamilyCode"
+
+
+
+
+/*!
+ * @group Internal Keys
+ *
+ */
+
+/*!
+ * @define kIOPSUPSManagementClaimed
+ *
+ * @abstract Claims UPS management for a third-party driver.
+ * @discussion kIOPSUPSManagementClaimed is obsolete. Do not use.
+ * @deprecated Unsupported in OS X 10.5 and later.
+ */
+#define kIOPSUPSManagementClaimed "/IOKit/UPSPowerManagementClaimed"
+
+/*!
+ * @define kIOPSLowWarnLevelKey
+ *
+ * @abstract Key for the "Warning" UPS low power trigger-level. Default is 50%.
+*/
+#define kIOPSLowWarnLevelKey "Low Warn Level"
+
+/*!
+ * @define kIOPSDeadWarnLevelKey
+ *
+ * @abstract Key for the "Shutdown System" low power trigger-level. Default is 20%.
+ */
+#define kIOPSDeadWarnLevelKey "Shutdown Level"
+
+
+/*!
+ * @define kIOPSDynamicStorePath
+ *
+ * @abstract This is only used for internal bookkeeping, and should be ignored.
+ */
+#define kIOPSDynamicStorePath "/IOKit/PowerSources"
+
+
+/*!
+ * @group Power Source Commands (UPS)
+ *
+ */
+
+/*!
+ * @define kIOPSCommandDelayedRemovePowerKey
+ *
+ * @abstract Command to give a UPS when it should remove power from its AC plugs in a specified amount of time
+ * @discussion
+ *
+ *
The matching argument should be a CFNumber of kCFNumberIntType specifying when the UPS should
+ *
remove power from its AC power ports.
+ *
+ */
+#define kIOPSCommandDelayedRemovePowerKey "Delayed Remove Power"
+
+/*!
+ * @define kIOPSCommandEnableAudibleAlarmKey
+ *
+ * @abstract Command to give a UPS when it should either enable or disable the audible alarm.
+ * @discussion
+ *
+ *
The matching argument should be a CFBooleanRef where kCFBooleanTrue enables the alarm and
+ *
kCFBooleanFalse diables the alarm
+ *
+ */
+
+#define kIOPSCommandEnableAudibleAlarmKey "Enable Audible Alarm"
+
+/*!
+ * @define kIOPSCommandStartupDelayKey
+ *
+ * @abstract Tell UPS how long it should wait for
+ * @discussion
+ *
+ *
The matching argument should be a CFNumber of kCFNumberIntType specifying when the UPS should
+ *
remove power from its AC power ports.
+ *
+ */
+#define kIOPSCommandStartupDelayKey "Startup Delay"
+
+
+/*!
+ * @group Power Source data keys
+ *
+ */
+
+/* These keys specify the values in a dictionary of PowerSource details.
+ * Use these keys in conjunction with the dictionary returned by
+ * @link //apple_ref/c/func/IOPSGetPowerSourceDescription IOPSGetPowerSourceDescription @/link
+ *
+ * Clients of @link //apple_ref/c/func/IOPSCreatePowerSource IOPSCreatePowerSource @/link
+ * must specify these keys in their power source dictionaries.
+ * Each key is labelled with one of these labels that indicate what information is REQUIRED. to
+ * represent a power source in OS X.
+ *
+ *
+ *
For power source creators: Providing this key is REQUIRED.
+ *
For power source creators: Providing this key is RECOMMENDED.
+ *
For power source creators: Providing this key is OPTIONAL.
+ *
Apple UPS power sources will publish this key.
+ *
Callers should not set this key; OS X power management will publish this key for UPS's.
+ *
Type CFNumber, kCFNumberIntType, uniquely identifying an attached UPS.
+ *
+ */
+
+#define kIOPSPowerSourceIDKey "Power Source ID"
+
+
+/*!
+ * @define kIOPSPowerSourceStateKey
+ *
+ * @abstract CFDictionary key for the current source of power.
+ *
+ * @discussion
+ *
+ *
Apple-defined power sources will publish this key.
+ *
For power source creators: Providing this key is REQUIRED.
+ *
@link kIOPSBatteryPowerValue @/link indicates power source is drawing internal power;
+ * @link kIOPSACPowerValue@/link indicates power source is connected to an external power source.
+ *
Type CFString, value is @link kIOPSACPowerValue@/link, @link kIOPSBatteryPowerValue@/link, or @link kIOPSOffLineValue@/link.
+ *
+ */
+
+#define kIOPSPowerSourceStateKey "Power Source State"
+
+/*!
+ * @define kIOPSCurrentCapacityKey
+ * @abstract CFDictionary key for the current power source's capacity.
+ *
+ * @discussion
+ *
+ *
Apple-defined power sources will publish this key in units of percent.
+ *
The power source's software may specify the units for this key.
+ * The units must be consistent for all capacities reported by this power source.
+ * The power source will usually define this number in units of percent, or mAh.
+ *
Clients may derive a percentage of power source battery remaining by dividing "Current Capacity" by "Max Capacity"
+ *
For power source creators: Providing this key is REQUIRED.
+ *
Type CFNumber kCFNumberIntType (signed integer)
+ *
+ */
+
+#define kIOPSCurrentCapacityKey "Current Capacity"
+
+/*!
+ * @define kIOPSMaxCapacityKey
+ * @abstract CFDictionary key for the current power source's maximum or "Full Charge Capacity"
+ * @discussion
+ *
+ *
Apple-defined power sources will publish this key in units of percent. The value is usually 100%.
+ *
The power source's software may specify the units for this key. The units must be consistent for all capacities reported by this power source.
+ *
For power source creators: Providing this key is REQUIRED.
+ *
Type CFNumber kCFNumberIntType (signed integer)
+ *
+ */
+
+#define kIOPSMaxCapacityKey "Max Capacity"
+
+/*!
+ * @define kIOPSDesignCapacityKey
+ * @abstract CFDictionary key for the current power source's design capacity
+ * @discussion
+ *
+ *
Apple-defined power sources might not publish this key.
+ *
The power source's software may specify the units for this key. The units must be consistent for all capacities reported by this power source.
+ *
For power source creators: Providing this key is RECOMMENDED.
+ *
Type CFNumber kCFNumberIntType (signed integer)
+ *
+ */
+
+#define kIOPSDesignCapacityKey "DesignCapacity"
+
+/*!
+ * @define kIOPSTimeToEmptyKey
+ * @abstract CFDictionary key for the current power source's time remaining until empty.
+ * @discussion
+ * Only valid if the power source is running off its own power. That's when the
+ * @link kIOPSPowerSourceStateKey @/link has value @link kIOPSBatteryPowerValue @/link
+ * and the value of @link kIOPSIsChargingKey @/link is kCFBooleanFalse.
+ *
+ *
Apple-defined power sources will publish this key.
+ *
For power source creators: Providing this key is RECOMMENDED.
+ *
Type CFNumber kCFNumberIntType (signed integer), units are minutes
+ *
A value of -1 indicates "Still Calculating the Time", otherwise estimated minutes left on the battery.
+ *
+ */
+
+
+#define kIOPSTimeToEmptyKey "Time to Empty"
+
+/*!
+ * @define kIOPSTimeToFullChargeKey
+ * @abstract CFDictionary key for the current power source's time remaining until empty.
+ * @discussion
+ * Only valid if the value of @link kIOPSIsChargingKey @/link is kCFBooleanTrue.
+ *
+ *
Apple-defined power sources will publish this key.
+ *
For power source creators: Providing this key is RECOMMENDED.
+ *
Type CFNumber kCFNumberIntType (signed integer), units are minutes
+ *
A value of -1 indicates "Still Calculating the Time", otherwise estimated minutes until fully charged.
+ *
+ */
+
+#define kIOPSTimeToFullChargeKey "Time to Full Charge"
+
+/*!
+ * @define kIOPSIsChargingKey
+ * @abstract CFDictionary key for the current power source's charging state
+ * @discussion
+ *
+ *
Apple-defined power sources will publish this key.
+ *
For power source creators: Providing this key is REQUIRED.
+ *
Type CFBoolean - kCFBooleanTrue or kCFBooleanFalse
+ *
+ */
+
+#define kIOPSIsChargingKey "Is Charging"
+
+/*!
+ * @define kIOPSIsPresentKey
+ * @abstract CFDictionary key for the current power source's presence.
+ * @discussion
+ *
+ *
Apple-defined power sources will publish this key.
+ *
For instance, a portable with the capacity for two batteries but
+ * with only one present would show two power source dictionaries,
+ * but kIOPSIsPresentKey would have the value kCFBooleanFalse in one of them.
+ *
For power source creators: Providing this key is REQUIRED.
+ *
Type CFBoolean - kCFBooleanTrue or kCFBooleanFalse
+ *
+ */
+
+#define kIOPSIsPresentKey "Is Present"
+
+/*!
+ * @define kIOPSVoltageKey
+ * @abstract CFDictionary key for the current power source's electrical voltage.
+ * @discussion
+ *
+ *
Apple-defined power sources will publish this key.
+ *
For power source creators: Providing this key is RECOMMENDED.
+ *
Type CFNumber kCFNumberIntType (signed integer) - units are mV
+ *
+ */
+
+#define kIOPSVoltageKey "Voltage"
+
+/*!
+ * @define kIOPSCurrentKey
+ * @abstract CFDictionary key for the current power source's electrical current.
+ * @discussion
+ *
+ *
Apple-defined power sources will publish this key.
+ *
For power source creators: Providing this key is RECOMMENDED.
+ *
Type CFNumber kCFNumberIntType (signed integer) - units are mA
+ *
+ */
+
+#define kIOPSCurrentKey "Current"
+
+/*!
+ * @define kIOPSNameKey
+ * @abstract CFDictionary key for the current power source's name.
+ * @discussion
+ *
+ *
Apple-defined power sources will publish this key.
+ *
For power source creators: Providing this key is REQUIRED.
+ *
Type CFStringRef
+ *
+ */
+
+#define kIOPSNameKey "Name"
+
+
+/*!
+ * @define kIOPSTypeKey
+ * @abstract CFDictionary key for the type of the power source
+ * @discussion
+ *
+ *
Apple-defined power sources will publish this key.
+ *
For power source creators: Providing this key is REQUIRED.
+ *
Type CFStringRef. Valid transport types are kIOPSUPSType or kIOPSInternalBatteryType.
+ *
+ */
+
+#define kIOPSTypeKey "Type"
+
+
+/*!
+ * @define kIOPSTransportTypeKey
+ * @abstract CFDictionary key for the current power source's data transport type (e.g. the means that the power source conveys power source data to the OS X machine).
+ * @discussion
+ *
+ *
Apple-defined power sources will publish this key.
+ *
A value of @link kIOPSInternalType @/link describes an internal power source.
+ *
@link kIOPSUSBTransportType @/link, @link kIOPSNetworkTransportType @/link, and @link kIOPSSerialTransportType @/link usually describe UPS's.
+ *
For power source creators: Providing this key is REQUIRED.
+ *
Type CFStringRef. Valid transport types are kIOPSSerialTransportType,
+ * kIOPSUSBTransportType, kIOPSNetworkTransportType, kIOPSInternalType
+ *
Apple-defined power sources will publish this key.
+ *
Value is one of the "Battery Health Condition Values" strings described in this file.
+ *
For power source creators: Providing this key is OPTIONAL - these keys have values only used by Apple power sources.
+ *
Type CFStringRef
+ *
+ */
+
+#define kIOPSBatteryHealthConditionKey "BatteryHealthCondition"
+
+/*!
+ * @define kIOPSBatteryFailureModesKey
+ * @abstract Enumerates a battery's failures and error conditions.
+ * @discussion
+ * Various battery failures will be listed here. A battery may suffer from more than one
+ * type of failure simultaneously, so this key has a CFArray value.
+ *
+ * If BatteryFailureModesKey is not defined (or is set to an empty dictionary),
+ * then the battery has no detectable failures.
+ *
+ * Each entry in the array should be a short descriptive string describing the error.
+ *
Apple-defined power sources will publish this key if any battery errors exist.
+ *
For power source creators: Providing this key is RECOMMENDED.
+ *
Type CFArrayRef
+ *
+ */
+#define kIOPSBatteryFailureModesKey "BatteryFailureModes"
+
+/*!
+ * @define kIOPSHealthConfidenceKey
+ * @abstract CFDictionary key for our confidence in the accuracy of our
+ * power source's "health" estimate.
+ * @deprecated In OS X 10.6 and later.
+ * @discussion
+ *
+ *
Apple-defined power sources will no longer publish this key.
+ *
Power source creators should not publish this key.
+ *
For power source creators: This key is DEPRECATED, do not implement it.
+ *
Type CFStringRef
+ *
+ */
+
+#define kIOPSHealthConfidenceKey "HealthConfidence"
+
+
+/*!
+ * @define kIOPSMaxErrKey
+ * @abstract CFDictionary key for the current power source's percentage error in capacity reporting.
+ * @discussion
+ * In internal batteries, this refers to the battery pack's estimated percentage error.
+ *
+ *
Apple-defined battery power sources will publish this key, but only if it's defined for the battery.
+ *
For power source creators: Providing this key is OPTIONAL.
+ *
Type CFNumberRef kCFNumberIntType, non-negative integer
+ *
+ */
+
+#define kIOPSMaxErrKey "MaxErr"
+
+/*!
+ * @define kIOPSIsChargedKey
+ * @abstract CFDictionary key indicates whether the battery is charged.
+ * @discussion
+ * A battery must be plugged in to an external power source in order to be fully charged.
+ * Note that a battery may validly be plugged in, not charging, and <100% charge.
+ * e.g. A battery with capacity >= 95% and not charging, is defined as charged.
+ *
+ *
Apple-defined power sources will publish this key.
+ *
For power source creators: Providing this key is REQUIRED.
+ *
Type CFBoolean - kCFBooleanTrue or kCFBooleanFalse
+ *
+ */
+
+#define kIOPSIsChargedKey "Is Charged"
+
+/*!
+ * @define kIOPSIsFinishingChargeKey
+ * @abstract CFDictionary key indicates whether the battery is finishing off its charge.
+ * @discussion
+ * When this is true, the system UI should indicate that the battery is "Finishing Charge."
+ * Some batteries may continue charging after they report 100% capacity.
+ *
+ *
Apple-defined battery power sources will publish this key.
+ *
For power source creators: Providing this key is RECOMMENDED.
+ *
Type CFBoolean - kCFBooleanTrue or kCFBooleanFalse
+ *
+ */
+
+#define kIOPSIsFinishingChargeKey "Is Finishing Charge"
+
+/*!
+ * @define kIOPSHardwareSerialNumberKey
+ * @abstract A unique serial number that identifies the power source.
+ * @discussion For Apple-manufactured batteries, this is an alphanumeric string generated
+ * during the battery manufacturing process.
+ *
+ *
Apple-defined power sources will publish this key if the hardware provides the serial number.
+ *
For power source creators: Providing this key is RECOMMENDED.
+ *
Type CFStringRef
+ *
+ */
+
+
+#define kIOPSHardwareSerialNumberKey "Hardware Serial Number"
+
+
+
+/*
+ * @group Transport types
+ * @abstract Possible values for @link kIOPSTransportTypeKey @/link
+ */
+/*!
+ * @define kIOPSSerialTransportType
+ * @abstract Value for key @link kIOPSTransportTypeKey @/link.
+ * @discussion Indicates the power source is a UPS attached over a serial connection.
+ */
+#define kIOPSSerialTransportType "Serial"
+
+/*!
+ * @define kIOPSUSBTransportType
+ * @abstract Value for key @link kIOPSTransportTypeKey @/link.
+ * @discussion Indicates the power source is a UPS attached over a USB connection.
+ */
+#define kIOPSUSBTransportType "USB"
+
+/*!
+ * @define kIOPSNetworkTransportType
+ * @abstract Value for key @link kIOPSTransportTypeKey @/link.
+ * @discussion Indicates the power source is a UPS attached over a network connection (and it may be managing several computers).
+ */
+#define kIOPSNetworkTransportType "Ethernet"
+
+/*!
+ * @define kIOPSInternalType
+ * @abstract Value for key @link kIOPSTransportTypeKey @/link. Indicates the power source is an internal battery.
+*/
+#define kIOPSInternalType "Internal"
+
+
+/*
+ * @group PowerSource Types
+ * @discussion
+ * A string that broadly describes the type of power source. One of these strings must be passed
+ * as an argument to IOPSCreatePowerSource() when defining a new system power source.
+ */
+
+/*!
+ * @define kIOPSInternalBatteryType
+ *
+ * @abstract Represents a battery residing inside a Mac.
+ */
+#define kIOPSInternalBatteryType "InternalBattery"
+
+/*!
+ * @define kIOPSUPSType
+ *
+ * @abstract Represents an external attached UPS.
+ */
+#define kIOPSUPSType "UPS"
+
+/*
+ * PS state
+ */
+/*!
+ * @define kIOPSOffLineValue
+ * @abstract Value for key kIOPSPowerSourceStateKey. Power source is off-line or no longer connected.
+*/
+#define kIOPSOffLineValue "Off Line"
+
+/*!
+ * @define kIOPSACPowerValue
+ * @abstract Value for key kIOPSPowerSourceStateKey. Power source is connected to external or AC power, and is not draining the internal battery.
+*/
+#define kIOPSACPowerValue "AC Power"
+
+/*!
+ * @define kIOPSBatteryPowerValue
+ * @abstract Value for key kIOPSPowerSourceStateKey. Power source is currently using the internal battery.
+*/
+#define kIOPSBatteryPowerValue "Battery Power"
+
+
+
+/*!
+ * @group Battery Health values
+ */
+/*!
+ * @define kIOPSPoorValue
+ * @abstract Value for key @link kIOPSBatteryHealthKey @/link.
+*/
+#define kIOPSPoorValue "Poor"
+
+/*!
+ * @define kIOPSFairValue
+ * @abstract Value for key @link kIOPSBatteryHealthKey @/link.
+*/
+#define kIOPSFairValue "Fair"
+
+/*!
+ * @define kIOPSGoodValue
+ * @abstract Value for key @link kIOPSBatteryHealthKey @/link.
+*/
+#define kIOPSGoodValue "Good"
+
+
+
+/*
+ * @group Battery Health Condition values
+ */
+/*!
+ * @define kIOPSCheckBatteryValue
+ *
+ * @abstract Value for key @link kIOPSBatteryHealthConditionKey @/link
+ *
+ * @discussion This value indicates that the battery should be checked out by a licensed Mac repair service.
+ */
+#define kIOPSCheckBatteryValue "Check Battery"
+
+/*!
+ * @define kIOPSPermanentFailureValue
+ *
+ * @abstract Value for key @link kIOPSBatteryHealthConditionKey @/link
+ *
+ * @discussion Indicates the battery needs replacement.
+ */
+#define kIOPSPermanentFailureValue "Permanent Battery Failure"
+
+
+/*!
+ * @group Battery Failure Mode values
+ */
+
+/*!
+ * @define kIOPSFailureExternalInput
+ *
+ * @abstract Value for key @link kIOPSBatteryFailureModesKey@/link
+ */
+#define kIOPSFailureExternalInput "Externally Indicated Failure"
+/*!
+ * @define kIOPSFailureSafetyOverVoltage
+ *
+ * @abstract Potential value for key @link kIOPSBatteryFailureModesKey@/link
+ */
+#define kIOPSFailureSafetyOverVoltage "Safety Over-Voltage"
+/*!
+ * @define kIOPSFailureChargeOverTemp
+ *
+ * @abstract Potential value for key @link kIOPSBatteryFailureModesKey@/link
+ */
+#define kIOPSFailureChargeOverTemp "Charge Over-Temperature"
+/*!
+ * @define kIOPSFailureDischargeOverTemp
+ *
+ * @abstract Potential value for key @link kIOPSBatteryFailureModesKey@/link
+ */
+#define kIOPSFailureDischargeOverTemp "Discharge Over-Temperature"
+/*!
+ * @define kIOPSFailureCellImbalance
+ *
+ * @abstract Potential value for key @link kIOPSBatteryFailureModesKey@/link
+ */
+#define kIOPSFailureCellImbalance "Cell Imbalance"
+/*!
+ * @define kIOPSFailureChargeFET
+ *
+ * @abstract Potential value for key @link kIOPSBatteryFailureModesKey@/link
+ */
+#define kIOPSFailureChargeFET "Charge FET"
+/*!
+ * @define kIOPSFailureDischargeFET
+ *
+ * @abstract Potential value for key @link kIOPSBatteryFailureModesKey@/link
+ */
+#define kIOPSFailureDischargeFET "Discharge FET"
+/*!
+ * @define kIOPSFailureDataFlushFault
+ *
+ * @abstract Potential value for key @link kIOPSBatteryFailureModesKey@/link
+ */
+#define kIOPSFailureDataFlushFault "Data Flush Fault"
+/*!
+ * @define kIOPSFailurePermanentAFEComms
+ *
+ * @abstract Potential value for key @link kIOPSBatteryFailureModesKey@/link
+ */
+#define kIOPSFailurePermanentAFEComms "Permanent AFE Comms"
+/*!
+ * @define kIOPSFailurePeriodicAFEComms
+ *
+ * @abstract Potential value for key @link kIOPSBatteryFailureModesKey@/link
+ */
+#define kIOPSFailurePeriodicAFEComms "Periodic AFE Comms"
+/*!
+ * @define kIOPSFailureChargeOverCurrent
+ *
+ * @abstract Potential value for key @link kIOPSBatteryFailureModesKey@/link
+ */
+#define kIOPSFailureChargeOverCurrent "Charge Over-Current"
+/*!
+ * @define kIOPSFailureDischargeOverCurrent
+ *
+ * @abstract Potential value for key @link kIOPSBatteryFailureModesKey@/link
+ */
+#define kIOPSFailureDischargeOverCurrent "Discharge Over-Current"
+/*!
+ * @define kIOPSFailureOpenThermistor
+ *
+ * @abstract Potential value for key @link kIOPSBatteryFailureModesKey@/link
+ */
+#define kIOPSFailureOpenThermistor "Open Thermistor"
+/*!
+ * @define kIOPSFailureFuseBlown
+ *
+ * @abstract Potential value for key @link kIOPSBatteryFailureModesKey@/link
+ */
+#define kIOPSFailureFuseBlown "Fuse Blown"
+
+
+#endif
diff --git a/include/IOKit/ps/IOPowerSources.h b/include/IOKit/ps/IOPowerSources.h
new file mode 100644
index 0000000..8ca1729
--- /dev/null
+++ b/include/IOKit/ps/IOPowerSources.h
@@ -0,0 +1,276 @@
+/*
+ * Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_LICENSE_HEADER_START@
+ *
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * @APPLE_LICENSE_HEADER_END@
+ */
+/*
+ * HISTORY
+ *
+ */
+
+#ifndef _IOKIT_IOPOWERSOURCES_H
+#define _IOKIT_IOPOWERSOURCES_H
+
+#include
+__BEGIN_DECLS
+
+
+/*!
+ * @header IOPowerSources.h
+ *
+ * @discussion IOPowerSources provides uniform access to the state of power sources attached to the system.
+ * You can receive a change notification when any power source data changes.
+ * "Power sources" currently include batteries and UPS devices.
+ *
+ * The header follows CF semantics in that it is the caller's responsibility to
+ * CFRelease() anything returned by a "Copy" function, and the caller should not
+ * CFRelease() anything returned by a "Get" function.
+ */
+
+/*!
+ * @functiongroup Low Power Warnings
+ */
+
+/*! @constant kIOPSNotifyLowBattery
+ *
+ * @abstract Notify(3) key. The system delivers notifications on this key when the
+ * battery time remaining drops into a warnable level.
+ */
+#define kIOPSNotifyLowBattery "com.apple.system.powersources.lowbattery"
+
+/*!
+ * @enum IOPSLowBatteryWarningLevel
+ *
+ * @discussion Possible return values from @link IOPSGetBatteryWarningLevel@/link
+ */
+typedef enum {
+/*! @constant kIOPSLowBatteryWarningNone
+ *
+ * @abstract The system is not in a low battery situation, or is on drawing from an external power source.
+ *
+ * @discussion The system displays no low power warnings; neither should application clients of this
+ * API.
+ */
+ kIOPSLowBatteryWarningNone = 1,
+
+/*! @constant kIOPSLowBatteryWarningEarly
+ *
+ * @abstract The system is in an early low battery situation.
+ *
+ * @discussion Per Apple's definition, the battery has dropped below 22% remaining power.
+ * OS X alerts the user by changing the color of BatteryMonitor to red.
+ * Warning the user is optional for full screen apps.
+ */
+ kIOPSLowBatteryWarningEarly = 2,
+
+/*! @constant kIOPSLowBatteryWarningFinal
+ *
+ * @abstract The battery can provide no more than 10 minutes of runtime.
+ *
+ * @discussion OS X makes no guarantees that the system shall remain in Final Warning for 10 minutes.
+ * Batteries are frequently calibrated differently and may provide runtime
+ * for more, or less, than the estimated 10 minutes.
+ */
+ kIOPSLowBatteryWarningFinal = 3
+} IOPSLowBatteryWarningLevel;
+
+/*! @function IOPSGetBatteryWarningLevel
+ *
+ * @abstract Indicates whether the system is at a low battery warning level.
+ *
+ * @discussion If your app runs in full screen mode and occludes OS X's battery monitor's low
+ * battery warnings, you should alert the user at least when the system
+ * is in kIOPSLowBatteryWarnFinal.
+ */
+IOPSLowBatteryWarningLevel IOPSGetBatteryWarningLevel(void);
+
+/*!
+ * @functiongroup Quick Power Source Info
+ */
+
+/*!
+ * @define kIOPSTimeRemainingNotificationKey
+ *
+ * @abstract C-string key for a notification that fires when the power source(s) time remaining changes.
+ *
+ * @discussion Use notify(3) API to register for notifications.
+ */
+#define kIOPSTimeRemainingNotificationKey "com.apple.system.powersources.timeremaining"
+
+/*!
+ * @constant kIOPSTimeRemainingUnknown
+ *
+ * @abstract Possible return value from @link IOPSGetTimeRemainingEstimate@/link
+ *
+ * @discussion Indicates the system is connected to a limited power source, but the system is still
+ * calculating a time remaining estimate. Check for a valid estimate again when the notification
+ * @link kIOPSPowerSourcesNotificationKey@/link fires.
+ */
+
+#define kIOPSTimeRemainingUnknown ((CFTimeInterval)-1.0)
+
+/*!
+ * @constant kIOPSTimeRemainingUnlimited
+ *
+ * @abstract Possible return value from @link IOPSGetTimeRemainingEstimate@/link
+ *
+ * @discussion Indicates the system is connected to an external power source, without a time limit.
+ */
+
+#define kIOPSTimeRemainingUnlimited ((CFTimeInterval)-2.0)
+
+/*!
+ * @function IOPSGetTimeRemainingEstimate
+ *
+ * @abstract Returns the estimated minutes remaining until all power sources
+ * (battery and/or UPS's) are empty, or returns @link kIOPSTimeRemainingUnlimited@/link
+ * if attached to an unlimited power source.
+ *
+ * @discussion
+ * If attached to an "Unlimited" power source, like AC power or any external source, the
+ * return value is @link kIOPSTimeRemainingUnlimited@/link
+ *
+ * If the system is on "Limited" power, like a battery or UPS,
+ * but is still calculating the time remaining, which may
+ * take several seconds after each system power event
+ * (e.g. waking from sleep, or unplugging AC Power), the return value is
+ * @link kIOPSTimeRemainingUnknown@/link
+ *
+ * Otherwise, if the system is on "Limited" power and the system has an accurate time
+ * remaining estimate, the system returns a CFTimeInterval estimate of the time
+ * remaining until the system is out of battery power.
+ *
+ * If you require more detailed battery information, use
+ * @link IOPSCopyPowerSourcesInfo @/link>
+ * and @link IOPSGetPowerSourceDescription @/link>.
+ *
+ * @result
+ * Returns @link kIOPSTimeRemainingUnknown@/link if the
+ * OS cannot determine the time remaining.
+ *
+ * Returns @link kIOPSTimeRemainingUnlimited@/link if the
+ * system has an unlimited power source.
+ *
+ * Otherwise returns a positive number of type CFTimeInterval, indicating the time
+ * remaining in seconds until all power sources are depleted.
+ */
+CFTimeInterval IOPSGetTimeRemainingEstimate(void);
+
+
+/*!
+ * @functiongroup Power Source Descriptions
+ */
+
+typedef void (*IOPowerSourceCallbackType)(void *context);
+
+/*! @function IOPSCopyPowerSourcesInfo
+ *
+ * @abstract Returns a blob of Power Source information in an opaque CFTypeRef.
+ *
+ * @discussion Clients should not directly access data in the returned CFTypeRef -
+ * they should use the accessor functions IOPSCopyPowerSourcesList and
+ * IOPSGetPowerSourceDescription, instead.
+ *
+ * @result NULL if errors were encountered, a CFTypeRef otherwise.
+ * Caller must CFRelease() the return value when done accessing it.
+ */
+CFTypeRef IOPSCopyPowerSourcesInfo(void);
+
+/*!
+ * @function IOPSGetProvidingPowerSourceType
+ *
+ * @abstract Indicates the power source the computer is currently drawing from.
+ *
+ * @discussion Determines which power source is providing power.
+ *
+ * @param snapshot The CFTypeRef returned by IOPSCopyPowerSourcesInfo(); caller may pass NULL.
+ *
+ * @result One of: CFSTR(kIOPMACPowerKey), CFSTR(kIOPMBatteryPowerKey), CFSTR(kIOPMUPSPowerKey)
+ */
+CFStringRef IOPSGetProvidingPowerSourceType(CFTypeRef snapshot);
+
+/*! @function IOPSCopyPowerSourcesList
+ *
+ * @abstract Returns a CFArray of Power Source handles, each of type CFTypeRef.
+ *
+ * @discussion The caller shouldn't directly access the CFTypeRefs, but should use
+ * IOPSGetPowerSourceDescription on each member of the CFArrayRef.
+ *
+ * @param blob Takes the CFTypeRef returned by IOPSCopyPowerSourcesInfo()
+ *
+ * @result Returns NULL if errors were encountered, otherwise a CFArray of CFTypeRefs.
+ * Caller must CFRelease() the returned CFArrayRef.
+ */
+CFArrayRef IOPSCopyPowerSourcesList(CFTypeRef blob);
+
+/*! @function IOPSGetPowerSourceDescription
+ *
+ * @abstract Returns a CFDictionary with readable information about the specific power source.
+ *
+ * @discussion See the C-strings defined in IOPSKeys.h for specific keys into the dictionary.
+ * Don't expect all keys to be present in any dictionary. Some power sources, for example,
+ * may not support the "Time Remaining To Empty" key and it will not be present in their dictionaries.
+ *
+ * @param blob The CFTypeRef returned by IOPSCopyPowerSourcesInfo()
+ *
+ * @param ps One of the CFTypeRefs in the CFArray returned by IOPSCopyPowerSourcesList()
+ *
+ * @result Returns NULL if an error was encountered, otherwise a CFDictionary. Caller should
+ * NOT release the returned CFDictionary - it will be released as part of the CFTypeRef returned by
+ * IOPSCopyPowerSourcesInfo().
+ */
+CFDictionaryRef IOPSGetPowerSourceDescription(CFTypeRef blob, CFTypeRef ps);
+
+/*! @function IOPSNotificationCreateRunLoopSource
+ *
+ * @abstract Returns a CFRunLoopSourceRef that notifies the caller when power source
+ * information changes.
+ *
+ * @discussion Returns a CFRunLoopSourceRef for scheduling with your CFRunLoop.
+ * If your project does not use a CFRunLoop, you can alternatively
+ * receive notifications via mach port, dispatch, or signal, via notify.h
+ * using the name @link kIOPSTimeRemainingNotificationKey @/link
+ *
+ * @param callback A function to be called whenever any power source is added, removed, or changes.
+ *
+ * @param context Any user-defined pointer, passed to the IOPowerSource callback.
+ *
+ * @result Returns NULL if an error was encountered, otherwise a CFRunLoopSource. Caller must
+ * release the CFRunLoopSource.
+ */
+CFRunLoopSourceRef IOPSNotificationCreateRunLoopSource(IOPowerSourceCallbackType callback, void *context);
+
+
+/*! @function IOPSCopyExternalPowerAdapterDetails
+ *
+ * @abstract Returns a CFDictionary that describes the attached (AC) external
+ * power adapter (if any external power adapter is attached.
+ *
+ * @discussion Use the kIOPSPowerAdapter... keys described in IOPSKeys.h
+ * to interpret the returned CFDictionary.
+ *
+ * @result Returns a CFDictionary on success. Caller must release the returned
+ * dictionary. If no adapter is attached, or if there's an error, returns NULL.
+ */
+CFDictionaryRef IOPSCopyExternalPowerAdapterDetails(void);
+
+__END_DECLS
+
+#endif /* _IOKIT_IOPOWERSOURCES_H */
diff --git a/include/IOKit/ps/IOUPSPlugIn.h b/include/IOKit/ps/IOUPSPlugIn.h
new file mode 100644
index 0000000..10f8dd6
--- /dev/null
+++ b/include/IOKit/ps/IOUPSPlugIn.h
@@ -0,0 +1,256 @@
+/*
+ *
+ * @APPLE_LICENSE_HEADER_START@
+ *
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * @APPLE_LICENSE_HEADER_END@
+ */
+
+/*!
+ @header IOUPSPlugIn.h
+
+ IOUPSPlugIn.h is the header that defines the software used by ioupsd in user-space to communicate with
+ UPS devices.
+
+ NOTE:
+ Kernel extensions should have the following key/value pair in their personality in order to be
+ recognized by ioupsd:
+
+ UPSDevice
+
+
+
+
+ To communicate with a UPS device, an instance of IOUPSPlugInInterface (a struct which is defined below)
+ is created. The methods of IOUPSPlugInInterface allow ioupsd to communicate with the device.
+
+
+ To obtain an IOUPSPlugInInterface for a UPS device, use the function IOCreatePlugInInterfaceForService()
+ defined in IOKit/IOCFPlugIn.h. (Note the "i" in "PlugIn" is
+ always upper-case.) Quick usage reference:
+
+
'service' is a reference to the IOKit registry entry of the kernel object
+ (usually of type IOHIDDevice) representing the device
+ of interest. This reference can be obtained using the functions defined in
+ IOKit/IOKitLib.h.
+
'plugInType' should be CFUUIDGetUUIDBytes(kIOCFPlugInInterfaceID)
+
'interfaceType' should be CFUUIDGetUUIDBytes(kIOUPSPlugInTypeID) when using IOUPSPlugIn
+
+ The interface returned by IOCreatePlugInInterfaceForService() should be deallocated using
+ IODestroyPlugInInterface(). Do not call Release() on it.
+
+*/
+
+#ifndef _IOKIT_PM_IOUPSPLUGIN_H
+#define _IOKIT_PM_IOUPSPLUGIN_H
+
+#include
+#include
+
+
+/* 40A57A4E-26A0-11D8-9295-000A958A2C78 */
+/*!
+ @define kIOUPSPlugInTypeID
+ @discussion Type ID for the IOUPSPlugInInterface. Corresponds to an
+ available UPS device.
+*/
+#define kIOUPSPlugInTypeID CFUUIDGetConstantUUIDWithBytes(NULL, \
+ 0x40, 0xa5, 0x7a, 0x4e, 0x26, 0xa0, 0x11, 0xd8, \
+ 0x92, 0x95, 0x00, 0x0a, 0x95, 0x8a, 0x2c, 0x78)
+
+/* 63F8BFC4-26A0-11D8-88B4-000A958A2C78 */
+/*!
+ @define kIOUPSPlugInInterfaceID
+ @discussion Interface ID for the IOUPSPlugInInterface. Corresponds to an
+ available UPS device.
+*/
+#define kIOUPSPlugInInterfaceID CFUUIDGetConstantUUIDWithBytes(NULL, \
+ 0x63, 0xf8, 0xbf, 0xc4, 0x26, 0xa0, 0x11, 0xd8, \
+ 0x88, 0xb4, 0x0, 0xa, 0x95, 0x8a, 0x2c, 0x78)
+
+/* E60E0799-9AA6-49DF-B55B-A5C94BA07A4A */
+/*!
+ @define kIOUPSPlugInInterfaceID_v140
+ @discussion Interface ID for the IOUPSPlugInInterface. Corresponds to an
+ available UPS device.
+*/
+#define kIOUPSPlugInInterfaceID_v140 CFUUIDGetConstantUUIDWithBytes(NULL, \
+ 0xe6, 0xe, 0x7, 0x99, 0x9a, 0xa6, 0x49, 0xdf, \
+ 0xb5, 0x5b, 0xa5, 0xc9, 0x4b, 0xa0, 0x7a, 0x4a)
+
+
+/*!
+ @typedef IOUPSEventCallbackFunction
+ @discussion Type and arguments of callout C function that is used when a
+ completion routine is called. This function pointer is set
+ via setEventCallback and is called when an event is available
+ from the UPS.
+ @param target void * pointer to your data, often a pointer to an object.
+ @param result Completion result of desired operation.
+ @param refcon void * pointer to more data.
+ @param sender Interface instance sending the completion routine.
+ @param event CFDictionaryRef containing event data.
+*/
+typedef void (*IOUPSEventCallbackFunction)
+ (void * target,
+ IOReturn result,
+ void * refcon,
+ void * sender,
+ CFDictionaryRef event);
+
+#define IOUPSPLUGINBASE \
+ IOReturn (*getProperties)( void * thisPointer, \
+ CFDictionaryRef * properties); \
+ IOReturn (*getCapabilities)(void * thisPointer, \
+ CFSetRef * capabilities); \
+ IOReturn (*getEvent)( void * thisPointer, \
+ CFDictionaryRef * event); \
+ IOReturn (*setEventCallback)(void * thisPointer, \
+ IOUPSEventCallbackFunction callback, \
+ void * callbackTarget, \
+ void * callbackRefcon); \
+ IOReturn (*sendCommand)( void * thisPointer, \
+ CFDictionaryRef command)
+
+#define IOUPSPLUGIN_V140 \
+ IOReturn (*createAsyncEventSource)(void * thisPointer, \
+ CFTypeRef * source)
+
+
+typedef struct IOUPSPlugInInterface {
+ IUNKNOWN_C_GUTS;
+ IOUPSPLUGINBASE;
+} IOUPSPlugInInterface;
+
+typedef struct IOUPSPlugInInterface_v140 {
+ IUNKNOWN_C_GUTS;
+ IOUPSPLUGINBASE;
+ IOUPSPLUGIN_V140;
+} IOUPSPlugInInterface_v140;
+
+//
+// BEGIN READABLE STRUCTURE DEFINITIONS
+//
+// This portion of uncompiled code provides a more reader friendly representation of
+// the CFPlugin methods defined above.
+
+#if 0
+/*!
+ @interface IOUPSPlugInInterface
+ @discussion Represents and provides management functions for a UPS device.
+*/
+
+typedef struct IOUPSPlugInInterface {
+ IUNKNOWN_C_GUTS;
+
+ /*!
+ @function getProperties
+ @abstract Used to obtain the properties of the UPS device such as the
+ name and transport.
+ @discussion Property keys are defined in IOPSKeys.h. This is not an
+ allocation method. Thus the caller does not release the
+ CFDictionary that is returned.
+ @param thisPointer The UPS Interface to use.
+ @param properties Pointer to a CFDictionaryRef that contains
+ the properties.
+ @result An IOReturn error code.
+ */
+ IOReturn (*getProperties)( void * thisPointer,
+ CFDictionaryRef * properties);
+
+ /*!
+ @function getCapabilities
+ @abstract Used to obtain the capabilities of the UPS device.
+ @discussion Keys are defined in IOPSKeys.h and begin with kIOPS. This
+ is not an allocation method. Thus the caller does not
+ release the CFSet that is returned.
+ @param thisPointer The UPS Interface to use.
+ @param capabilities Pointer to a CFSetRef that contains the
+ capabilities.
+ @result An IOReturn error code.
+ */
+ IOReturn (*getCapabilities)(void * thisPointer,
+ CFSetRef * capabilities);
+
+ /*!
+ @function getEvent
+ @abstract Used to poll the current state of the UPS.
+ @discussion Keys are defined in IOPSKeys.h and begin with kIOPS. This
+ is not an allocation method. Thus the caller does not
+ release the CFDictionary that is returned.
+ @param thisPointer The UPS Interface to use.
+ @param event Pointer to a CFDictionaryRef that contains
+ the current event state.
+ @result An IOReturn error code.
+ */
+ IOReturn (*getEvent)( void * thisPointer,
+ CFDictionaryRef * event);
+
+ /*!
+ @function setEventCallback
+ @abstract Set the callback that should be called to handle an event
+ from the UPS.
+ @discussion The proivided callback method should be called whenever there
+ is a change of state in the UPS. This should be used in
+ conjunction with createAsyncEventSource.
+ @param thisPointer The UPS Interface to use.
+ @param callback A callback handler of type
+ IOUPSEventCallbackFunction.
+ @param callbackTarget The address to be targeted by this callback.
+ @param callbackRefcon A user specified reference value. This will
+ be passed to all callback functions.
+ @result An IOReturn error code.
+ */
+ IOReturn (*setEventCallback)(void * thisPointer,
+ IOUPSEventCallbackFunction callback,
+ void * callbackTarget,
+ void * callbackRefcon);
+
+ /*!
+ @function sendCommand
+ @abstract Send a command to the UPS.
+ @discussion Command keys are defined in IOPSKeys.h and begin with
+ kIOPSCommand. An error should be returned if your device does
+ not know how to respond to a command.
+ @param thisPointer The UPS Interface to use.
+ @param command CFDictionaryRef that contains the command.
+ @result An IOReturn error code.
+ */
+ IOReturn (*sendCommand)( void * thisPointer,
+ CFDictionaryRef command);
+
+ /*!
+ @function createAsyncEventSource
+ @abstract Used to create an async run loop event source of the plugin.
+ @discussion This is an allocation method. Thus the caller must
+ release the object that is returned.
+ @param thisPointer The UPS Interface to use.
+ @param source Pointer to a CFTypeRef. It is expected that this
+ point to either a CFRunLoopSourceRef or a
+ CFRunLoopTimerRef.
+ @result An IOReturn error code.
+ */
+ IOReturn (*createAsyncEventSource)( void * thisPointer,
+ CFTypeRef * source);
+
+
+} IOUPSPlugInInterface;
+#endif
+
+// END READABLE STRUCTURE DEFINITIONS
+
+#endif /* !_IOKIT_PM_IOUPSPLUGIN_H */
diff --git a/include/IOKit/pwr_mgt/IOPM.h b/include/IOKit/pwr_mgt/IOPM.h
new file mode 100644
index 0000000..f0002d5
--- /dev/null
+++ b/include/IOKit/pwr_mgt/IOPM.h
@@ -0,0 +1,823 @@
+/*
+ * Copyright (c) 1998-2005 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ *
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ *
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+#ifndef _IOKIT_IOPM_H
+#define _IOKIT_IOPM_H
+
+#include
+#include
+#include
+
+/*! @header IOPM.h
+ @abstract Defines power management constants and keys used by both in-kernel and user space power management.
+ @discussion IOPM.h defines a range of power management constants used in several in-kernel and user space APIs. Most significantly, the IOPMPowerFlags used to specify the fields of an IOPMPowerState struct are defined here.
+
+ Most of the constants defined in IOPM.h are deprecated or for Apple internal use only, and are not elaborated on in headerdoc.
+*/
+
+enum {
+ kIOPMMaxPowerStates = 10,
+ IOPMMaxPowerStates = kIOPMMaxPowerStates
+};
+
+/*! @enum IOPMPowerFlags
+ @abstract Bits are used in defining capabilityFlags, inputPowerRequirements, and outputPowerCharacter in the IOPMPowerState structure.
+ @discussion These bits may be bitwise-OR'd together in the IOPMPowerState capabilityFlags field, the outputPowerCharacter field, and/or the inputPowerRequirement field.
+
+ The comments clearly mark whether each flag should be used in the capabilityFlags field, outputPowerCharacter field, and inputPowerRequirement field, or all three.
+
+ The value of capabilityFlags, inputPowerRequirement or outputPowerCharacter may be 0. Most drivers implement their 'OFF' state, used when asleep, by defininf each of the 3 fields as 0.
+
+ The bits listed below are only the most common bits used to define a device's power states. Your device's IO family may require that your device specify other input or output power flags to interact properly. Consult family-specific documentation to determine if your IOPower plane parents or children require other power flags; they probably don't.
+
+ @constant kIOPMPowerOn Indicates the device is on, requires power, and provides power. Useful as a: Capability, InputPowerRequirement, OutputPowerCharacter
+
+ @constant kIOPMDeviceUsable Indicates the device is usable in this state. Useful only as a Capability
+
+ @constant kIOPMLowPower
+ Indicates device is in a low power state. May be bitwis-OR'd together
+ with kIOPMDeviceUsable flag, to indicate the device is still usable.
+
+ A device with a capability of kIOPMLowPower may:
+ Require either 0 or kIOPMPowerOn from its power parent
+ Offer either kIOPMLowPower, kIOPMPowerOn, or 0 (no power at all)
+ to its power plane children.
+
+ Useful only as a Capability, although USB drivers should consult USB family documentation for other valid circumstances to use the kIOPMLowPower bit.
+
+ @constant kIOPMPreventIdleSleep
+ In the capability field of a power state, disallows idle system sleep while the device is in that state.
+
+ For example, displays and disks set this capability for their ON power state; since the system may not idle sleep while the display (and thus keyboard or mouse) or the disk is active.
+
+ Useful only as a Capability.
+
+ @constant kIOPMSleepCapability
+ Used only by certain IOKit Families (USB). Not defined or used by generic Power Management. Read your family documentation to see if you should define a powerstate using these capabilities.
+
+ @constant kIOPMRestartCapability
+ Used only by certain IOKit Families (USB). Not defined or used by generic Power Management. Read your family documentation to see if you should define a powerstate using these capabilities.
+
+ @constant kIOPMSleep
+ Used only by certain IOKit Families (USB). Not defined or used by generic Power Management. Read your family documentation to see if you should define a powerstate using these capabilities.
+
+ @constant kIOPMRestart
+ Used only by certain IOKit Families (USB). Not defined or used by generic Power Management. Read your family documentation to see if you should define a powerstate using these capabilities.
+
+ @constant kIOPMInitialDeviceState
+ Indicates the initial power state for the device. If initialPowerStateForDomainState() returns a power state with this flag set in the capability field, then the initial power change is performed without calling the driver's setPowerState().
+*/
+typedef unsigned long IOPMPowerFlags;
+enum {
+ kIOPMPowerOn = 0x00000002,
+ kIOPMDeviceUsable = 0x00008000,
+ kIOPMLowPower = 0x00010000,
+ kIOPMPreventIdleSleep = 0x00000040,
+ kIOPMSleepCapability = 0x00000004,
+ kIOPMRestartCapability = 0x00000080,
+ kIOPMSleep = 0x00000001,
+ kIOPMRestart = 0x00000080,
+ kIOPMInitialDeviceState = 0x00000100
+};
+
+/*
+ * Private IOPMPowerFlags
+ *
+ * For Apple use only
+ * Not for use with non-Apple drivers
+ * Their behavior is undefined
+ */
+enum {
+ kIOPMClockNormal = 0x0004,
+ kIOPMClockRunning = 0x0008,
+ kIOPMPreventSystemSleep = 0x0010,
+ kIOPMDoze = 0x0400,
+ kIOPMChildClamp = 0x0080,
+ kIOPMChildClamp2 = 0x0200,
+ kIOPMNotPowerManaged = 0x0800
+};
+
+/*
+ * Deprecated IOPMPowerFlags
+ * Their behavior is undefined when used in IOPMPowerState
+ * Capability, InputPowerRequirement, or OutputPowerCharacter fields.
+ */
+enum {
+ kIOPMMaxPerformance = 0x4000,
+ kIOPMPassThrough = 0x0100,
+ kIOPMAuxPowerOn = 0x0020,
+ kIOPMNotAttainable = 0x0001,
+ kIOPMContextRetained = 0x2000,
+ kIOPMConfigRetained = 0x1000,
+ kIOPMStaticPowerValid = 0x0800,
+ kIOPMSoftSleep = 0x0400,
+ kIOPMCapabilitiesMask = kIOPMPowerOn | kIOPMDeviceUsable |
+ kIOPMMaxPerformance | kIOPMContextRetained |
+ kIOPMConfigRetained | kIOPMSleepCapability |
+ kIOPMRestartCapability
+};
+
+/*
+ * Support for old names of IOPMPowerFlag constants
+ */
+enum {
+ IOPMNotAttainable = kIOPMNotAttainable,
+ IOPMPowerOn = kIOPMPowerOn,
+ IOPMClockNormal = kIOPMClockNormal,
+ IOPMClockRunning = kIOPMClockRunning,
+ IOPMAuxPowerOn = kIOPMAuxPowerOn,
+ IOPMDeviceUsable = kIOPMDeviceUsable,
+ IOPMMaxPerformance = kIOPMMaxPerformance,
+ IOPMContextRetained = kIOPMContextRetained,
+ IOPMConfigRetained = kIOPMConfigRetained,
+ IOPMNotPowerManaged = kIOPMNotPowerManaged,
+ IOPMSoftSleep = kIOPMSoftSleep
+};
+
+
+enum {
+ kIOPMNextHigherState = 1,
+ kIOPMHighestState = 2,
+ kIOPMNextLowerState = 3,
+ kIOPMLowestState = 4
+};
+
+enum {
+ IOPMNextHigherState = kIOPMNextHigherState,
+ IOPMHighestState = kIOPMHighestState,
+ IOPMNextLowerState = kIOPMNextLowerState,
+ IOPMLowestState = kIOPMLowestState
+};
+
+// Internal commands used by power managment command queue
+enum {
+ kIOPMBroadcastAggressiveness = 1,
+ kIOPMUnidleDevice
+};
+
+// Power consumption unknown value
+enum {
+ kIOPMUnknown = 0xFFFF
+};
+
+/*******************************************************************************
+ *
+ * Root Domain property keys of interest
+ *
+ ******************************************************************************/
+
+/* AppleClamshellState
+ * reflects the state of the clamshell (lid) on a portable.
+ * It has a boolean value.
+ * true == clamshell is closed
+ * false == clamshell is open
+ * not present == no clamshell on this hardware
+ */
+#define kAppleClamshellStateKey "AppleClamshellState"
+
+/* AppleClamshellCausesSleep
+ * reflects the clamshell close behavior on a portable.
+ * It has a boolean value.
+ * true == system will sleep when clamshell is closed
+ * false == system will not sleep on clamshell close
+ * (typically external display mode)
+ * not present == no clamshell on this hardware
+ */
+#define kAppleClamshellCausesSleepKey "AppleClamshellCausesSleep"
+
+/* kIOPMSleepWakeUUIDKey
+ * Key refers to a CFStringRef that will uniquely identify
+ * a sleep/wake cycle for logging & tracking.
+ * The key becomes valid at the beginning of a sleep cycle - before we
+ * initiate any sleep/wake notifications.
+ * The key becomes invalid at the completion of a system wakeup. The
+ * property will not be present in the IOPMrootDomain's registry entry
+ * when it is invalid.
+ *
+ * See IOPMrootDomain notification kIOPMMessageSleepWakeUUIDChange
+ */
+ #define kIOPMSleepWakeUUIDKey "SleepWakeUUID"
+
+/* kIOPMDeepSleepEnabledKey
+ * Indicates the Deep Sleep enable state.
+ * It has a boolean value.
+ * true == Deep Sleep is enabled
+ * false == Deep Sleep is disabled
+ * not present == Deep Sleep is not supported on this hardware
+ */
+#define kIOPMDeepSleepEnabledKey "Standby Enabled"
+
+/* kIOPMDeepSleepDelayKey
+ * Key refers to a CFNumberRef that represents the delay in seconds before
+ * entering Deep Sleep state. The property is not present if Deep Sleep is
+ * unsupported.
+ */
+#define kIOPMDeepSleepDelayKey "Standby Delay"
+
+/* kIOPMDestroyFVKeyOnStandbyKey
+ * Specifies if FileVault key can be stored when going to standby mode
+ * It has a boolean value,
+ * true == Destroy FV key when going to standby mode
+ * false == Retain FV key when going to standby mode
+ * not present == Retain FV key when going to standby mode
+ */
+#define kIOPMDestroyFVKeyOnStandbyKey "DestroyFVKeyOnStandby"
+
+/*******************************************************************************
+ *
+ * Driver PM Assertions
+ *
+ ******************************************************************************/
+
+/* Driver Assertion bitfield description
+ * Driver PM assertions are defined by these bits.
+ */
+enum {
+ /*! kIOPMDriverAssertionCPUBit
+ * When set, PM kernel will prefer to leave the CPU and core hardware
+ * running in "Dark Wake" state, instead of sleeping.
+ */
+ kIOPMDriverAssertionCPUBit = 0x01,
+
+ /*! kIOPMDriverAssertionUSBExternalDeviceBit
+ * When set, driver is informing PM that an external USB device is attached.
+ */
+ kIOPMDriverAssertionUSBExternalDeviceBit = 0x04,
+
+ /*! kIOPMDriverAssertionBluetoothHIDDevicePairedBit
+ * When set, driver is informing PM that a Bluetooth HID device is paired.
+ */
+ kIOPMDriverAssertionBluetoothHIDDevicePairedBit = 0x08,
+
+ /*! kIOPMDriverAssertionExternalMediaMountedBit
+ * When set, driver is informing PM that an external media is mounted.
+ */
+ kIOPMDriverAssertionExternalMediaMountedBit = 0x10,
+
+ /*! kIOPMDriverAssertionReservedBit5
+ * Reserved for Thunderbolt.
+ */
+ kIOPMDriverAssertionReservedBit5 = 0x20,
+
+ /*! kIOPMDriverAssertionPreventDisplaySleepBit
+ * When set, the display should remain powered on while the system's awake.
+ */
+ kIOPMDriverAssertionPreventDisplaySleepBit = 0x40,
+
+ kIOPMDriverAssertionReservedBit7 = 0x80
+};
+
+ /* kIOPMAssertionsDriverKey
+ * This kIOPMrootDomain key refers to a CFNumberRef property, containing
+ * a bitfield describing the aggregate PM assertion levels.
+ * Example: A value of 0 indicates that no driver has asserted anything.
+ * Or, a value of kIOPMDriverAssertionCPUBit
+ * indicates that a driver (or drivers) have asserted a need fro CPU and video.
+ */
+#define kIOPMAssertionsDriverKey "DriverPMAssertions"
+
+ /* kIOPMAssertionsDriverKey
+ * This kIOPMrootDomain key refers to a CFNumberRef property, containing
+ * a bitfield describing the aggregate PM assertion levels.
+ * Example: A value of 0 indicates that no driver has asserted anything.
+ * Or, a value of kIOPMDriverAssertionCPUBit
+ * indicates that a driver (or drivers) have asserted a need fro CPU and video.
+ */
+#define kIOPMAssertionsDriverDetailedKey "DriverPMAssertionsDetailed"
+
+/*******************************************************************************
+ *
+ * Kernel Driver assertion detailed dictionary keys
+ *
+ * Keys decode the Array & dictionary data structure under IOPMrootDomain property
+ * kIOPMAssertionsDriverKey.
+ *
+ */
+#define kIOPMDriverAssertionIDKey "ID"
+#define kIOPMDriverAssertionCreatedTimeKey "CreatedTime"
+#define kIOPMDriverAssertionModifiedTimeKey "ModifiedTime"
+#define kIOPMDriverAssertionOwnerStringKey "Owner"
+#define kIOPMDriverAssertionOwnerServiceKey "ServicePtr"
+#define kIOPMDriverAssertionLevelKey "Level"
+#define kIOPMDriverAssertionAssertedKey "Assertions"
+
+/*******************************************************************************
+ *
+ * Root Domain general interest messages
+ *
+ * Available by registering for interest type 'gIOGeneralInterest'
+ * on IOPMrootDomain.
+ *
+ ******************************************************************************/
+
+/* kIOPMMessageClamshellStateChange
+ * Delivered as a general interest notification on the IOPMrootDomain
+ * IOPMrootDomain sends this message when state of either AppleClamshellState
+ * or AppleClamshellCausesSleep changes. If this clamshell change results in
+ * a sleep, the sleep will initiate soon AFTER delivery of this message.
+ * The state of both variables is encoded in a bitfield argument sent with
+ * the message. Check bits 0 and 1 using kClamshellStateBit & kClamshellSleepBit
+ */
+enum {
+ kClamshellStateBit = (1 << 0),
+ kClamshellSleepBit = (1 << 1)
+};
+
+#define kIOPMMessageClamshellStateChange \
+ iokit_family_msg(sub_iokit_powermanagement, 0x100)
+
+/* kIOPMMessageFeatureChange
+ * Delivered when the set of supported features ("Supported Features" dictionary
+ * under IOPMrootDomain registry) changes in some way. Typically addition or
+ * removal of a supported feature.
+ * RootDomain passes no argument with this message.
+ */
+#define kIOPMMessageFeatureChange \
+ iokit_family_msg(sub_iokit_powermanagement, 0x110)
+
+/* kIOPMMessageInflowDisableCancelled
+ * The battery has drained completely to its "Fully Discharged" state.
+ * If a user process has disabled battery inflow for battery
+ * calibration, we forcibly re-enable Inflow at this point.
+ * If inflow HAS been forcibly re-enabled, bit 0
+ * (kInflowForciblyEnabledBit) will be set.
+ */
+enum {
+ kInflowForciblyEnabledBit = (1 << 0)
+};
+
+/* kIOPMMessageInternalBatteryFullyDischarged
+ * The battery has drained completely to its "Fully Discharged" state.
+ */
+#define kIOPMMessageInternalBatteryFullyDischarged \
+ iokit_family_msg(sub_iokit_powermanagement, 0x120)
+
+/* kIOPMMessageSystemPowerEventOccurred
+ * Some major system thermal property has changed, and interested clients may
+ * modify their behavior.
+ */
+#define kIOPMMessageSystemPowerEventOccurred \
+ iokit_family_msg(sub_iokit_powermanagement, 0x130)
+
+/* kIOPMMessageSleepWakeUUIDChange
+ * Either a new SleepWakeUUID has been specified at the beginning of a sleep,
+ * or we're removing the existing property upon completion of a wakeup.
+ */
+#define kIOPMMessageSleepWakeUUIDChange \
+ iokit_family_msg(sub_iokit_powermanagement, 0x140)
+
+/* kIOPMMessageSleepWakeUUIDSet
+ * Argument accompanying the kIOPMMessageSleepWakeUUIDChange notification when
+ * a new UUID has been specified.
+ */
+#define kIOPMMessageSleepWakeUUIDSet ((void *)1)
+
+/* kIOPMMessageSleepWakeUUIDCleared
+ * Argument accompanying the kIOPMMessageSleepWakeUUIDChange notification when
+ * the current UUID has been removed.
+ */
+#define kIOPMMessageSleepWakeUUIDCleared ((void *)0)
+
+/*! kIOPMMessageDriverAssertionsChanged
+ * Sent when kernel PM driver assertions have changed.
+ */
+#define kIOPMMessageDriverAssertionsChanged \
+ iokit_family_msg(sub_iokit_powermanagement, 0x150)
+
+/*******************************************************************************
+ *
+ * Power commands issued to root domain
+ * Use with IOPMrootDomain::receivePowerNotification()
+ *
+ * These commands are issued from system drivers only:
+ * ApplePMU, AppleSMU, IOGraphics, AppleACPIFamily
+ *
+ * TODO: deprecate kIOPMAllowSleep and kIOPMPreventSleep
+ ******************************************************************************/
+enum {
+ kIOPMSleepNow = (1<<0), // put machine to sleep now
+ kIOPMAllowSleep = (1<<1), // allow idle sleep
+ kIOPMPreventSleep = (1<<2), // do not allow idle sleep
+ kIOPMPowerButton = (1<<3), // power button was pressed
+ kIOPMClamshellClosed = (1<<4), // clamshell was closed
+ kIOPMPowerEmergency = (1<<5), // battery dangerously low
+ kIOPMDisableClamshell = (1<<6), // do not sleep on clamshell closure
+ kIOPMEnableClamshell = (1<<7), // sleep on clamshell closure
+ kIOPMProcessorSpeedChange = (1<<8), // change the processor speed
+ kIOPMOverTemp = (1<<9), // system dangerously hot
+ kIOPMClamshellOpened = (1<<10) // clamshell was opened
+};
+
+
+/*******************************************************************************
+ *
+ * Power Management Return Codes
+ *
+ ******************************************************************************/
+enum {
+ kIOPMNoErr = 0,
+
+ // Returned by driver's setPowerState(), powerStateWillChangeTo(),
+ // powerStateDidChangeTo(), or acknowledgeSetPowerState() to
+ // implicitly acknowledge power change upon function return.
+ kIOPMAckImplied = 0,
+
+ // Deprecated
+ kIOPMWillAckLater = 1,
+
+ // Returned by requestPowerDomainState() to indicate
+ // unrecognized specification parameter.
+ kIOPMBadSpecification = 4,
+
+ // Returned by requestPowerDomainState() to indicate
+ // no power state matches search specification.
+ kIOPMNoSuchState = 5,
+
+ // Deprecated
+ kIOPMCannotRaisePower = 6,
+
+ // Deprecated
+ kIOPMParameterError = 7,
+
+ // Returned when power management state is accessed
+ // before driver has called PMinit().
+ kIOPMNotYetInitialized = 8,
+
+ // And the old constants; deprecated
+ IOPMNoErr = kIOPMNoErr,
+ IOPMAckImplied = kIOPMAckImplied,
+ IOPMWillAckLater = kIOPMWillAckLater,
+ IOPMBadSpecification = kIOPMBadSpecification,
+ IOPMNoSuchState = kIOPMNoSuchState,
+ IOPMCannotRaisePower = kIOPMCannotRaisePower,
+ IOPMParameterError = kIOPMParameterError,
+ IOPMNotYetInitialized = kIOPMNotYetInitialized
+};
+
+
+// IOPMPowerSource class descriptive strings
+// Power Source state is published as properties to the IORegistry under these
+// keys.
+#define kIOPMPSExternalConnectedKey "ExternalConnected"
+#define kIOPMPSExternalChargeCapableKey "ExternalChargeCapable"
+#define kIOPMPSBatteryInstalledKey "BatteryInstalled"
+#define kIOPMPSIsChargingKey "IsCharging"
+#define kIOPMFullyChargedKey "FullyCharged"
+#define kIOPMPSAtWarnLevelKey "AtWarnLevel"
+#define kIOPMPSAtCriticalLevelKey "AtCriticalLevel"
+#define kIOPMPSCurrentCapacityKey "CurrentCapacity"
+#define kIOPMPSMaxCapacityKey "MaxCapacity"
+#define kIOPMPSDesignCapacityKey "DesignCapacity"
+#define kIOPMPSTimeRemainingKey "TimeRemaining"
+#define kIOPMPSAmperageKey "Amperage"
+#define kIOPMPSVoltageKey "Voltage"
+#define kIOPMPSCycleCountKey "CycleCount"
+#define kIOPMPSMaxErrKey "MaxErr"
+#define kIOPMPSAdapterInfoKey "AdapterInfo"
+#define kIOPMPSLocationKey "Location"
+#define kIOPMPSErrorConditionKey "ErrorCondition"
+#define kIOPMPSManufacturerKey "Manufacturer"
+#define kIOPMPSManufactureDateKey "ManufactureDate"
+#define kIOPMPSModelKey "Model"
+#define kIOPMPSSerialKey "Serial"
+#define kIOPMDeviceNameKey "DeviceName"
+#define kIOPMPSLegacyBatteryInfoKey "LegacyBatteryInfo"
+#define kIOPMPSBatteryHealthKey "BatteryHealth"
+#define kIOPMPSHealthConfidenceKey "HealthConfidence"
+#define kIOPMPSCapacityEstimatedKey "CapacityEstimated"
+#define kIOPMPSBatteryChargeStatusKey "ChargeStatus"
+#define kIOPMPSBatteryTemperatureKey "Temperature"
+#define kIOPMPSAdapterDetailsKey "AdapterDetails"
+#define kIOPMPSChargerConfigurationKey "ChargerConfiguration"
+
+// kIOPMPSBatteryChargeStatusKey may have one of the following values, or may have
+// no value. If kIOPMBatteryChargeStatusKey has a NULL value (or no value) associated with it
+// then charge is proceeding normally. If one of these battery charge status reasons is listed,
+// then the charge may have been interrupted.
+#define kIOPMBatteryChargeStatusTooHot "HighTemperature"
+#define kIOPMBatteryChargeStatusTooCold "LowTemperature"
+#define kIOPMBatteryChargeStatusTooHotOrCold "HighOrLowTemperature"
+#define kIOPMBatteryChargeStatusGradient "BatteryTemperatureGradient"
+
+// Definitions for battery location, in case of multiple batteries.
+// A location of 0 is unspecified
+// Location is undefined for single battery systems
+enum {
+ kIOPMPSLocationLeft = 1001,
+ kIOPMPSLocationRight = 1002
+};
+
+// Battery quality health types, specified by BatteryHealth and HealthConfidence
+// properties in an IOPMPowerSource battery kext.
+enum {
+ kIOPMUndefinedValue = 0,
+ kIOPMPoorValue = 1,
+ kIOPMFairValue = 2,
+ kIOPMGoodValue = 3
+};
+
+// Keys for kIOPMPSAdapterDetailsKey dictionary
+#define kIOPMPSAdapterDetailsIDKey "AdapterID"
+#define kIOPMPSAdapterDetailsWattsKey "Watts"
+#define kIOPMPSAdapterDetailsRevisionKey "AdapterRevision"
+#define kIOPMPSAdapterDetailsSerialNumberKey "SerialNumber"
+#define kIOPMPSAdapterDetailsFamilyKey "FamilyCode"
+#define kIOPMPSAdapterDetailsAmperageKey "Amperage"
+#define kIOPMPSAdapterDetailsDescriptionKey "Description"
+#define kIOPMPSAdapterDetailsPMUConfigurationKey "PMUConfiguration"
+
+// Battery's time remaining estimate is invalid this long (seconds) after a wake
+#define kIOPMPSInvalidWakeSecondsKey "BatteryInvalidWakeSeconds"
+
+// Battery must wait this long (seconds) after being completely charged before
+// the battery is settled.
+#define kIOPMPSPostChargeWaitSecondsKey "PostChargeWaitSeconds"
+
+// Battery must wait this long (seconds) after being completely discharged
+// before the battery is settled.
+#define kIOPMPSPostDishargeWaitSecondsKey "PostDischargeWaitSeconds"
+
+
+/* CPU Power Management status keys
+ * Pass as arguments to IOPMrootDomain::systemPowerEventOccurred
+ * Or as arguments to IOPMSystemPowerEventOccurred()
+ * Or to decode the dictionary obtained from IOPMCopyCPUPowerStatus()
+ * These keys reflect restrictions placed on the CPU by the system
+ * to bring the CPU's power consumption within allowable thermal and
+ * power constraints.
+ */
+
+
+/* kIOPMGraphicsPowerLimitsKey
+ * The key representing the dictionary of graphics power limits.
+ * The dictionary contains the other kIOPMCPUPower keys & their associated
+ * values (e.g. Speed limit, Processor Count, and Schedule limits).
+ */
+#define kIOPMGraphicsPowerLimitsKey "Graphics_Power_Limits"
+
+/* kIOPMGraphicsPowerLimitPerformanceKey
+ * The key representing the percent of overall performance made available
+ * by the graphics chip as a percentage (integer 0 - 100).
+ */
+#define kIOPMGraphicsPowerLimitPerformanceKey "Graphics_Power_Performance"
+
+
+
+/* kIOPMCPUPowerLimitsKey
+ * The key representing the dictionary of CPU Power Limits.
+ * The dictionary contains the other kIOPMCPUPower keys & their associated
+ * values (e.g. Speed limit, Processor Count, and Schedule limits).
+ */
+#define kIOPMCPUPowerLimitsKey "CPU_Power_Limits"
+
+/* kIOPMCPUPowerLimitProcessorSpeedKey defines the speed & voltage limits placed
+ * on the CPU.
+ * Represented as a percentage (0-100) of maximum CPU speed.
+ */
+#define kIOPMCPUPowerLimitProcessorSpeedKey "CPU_Speed_Limit"
+
+/* kIOPMCPUPowerLimitProcessorCountKey reflects how many, if any, CPUs have been
+ * taken offline. Represented as an integer number of CPUs (0 - Max CPUs).
+ */
+#define kIOPMCPUPowerLimitProcessorCountKey "CPU_Available_CPUs"
+
+/* kIOPMCPUPowerLimitSchedulerTimeKey represents the percentage (0-100) of CPU time
+ * available. 100% at normal operation. The OS may limit this time for a percentage
+ * less than 100%.
+ */
+#define kIOPMCPUPowerLimitSchedulerTimeKey "CPU_Scheduler_Limit"
+
+
+/* Thermal Level Warning Key
+ * Indicates the thermal constraints placed on the system. This value may
+ * cause clients to action to consume fewer system resources.
+ * The value associated with this warning is defined by the platform.
+ */
+#define kIOPMThermalLevelWarningKey "Thermal_Level_Warning"
+
+/* Thermal Warning Level values
+ * kIOPMThermalWarningLevelNormal - under normal operating conditions
+ * kIOPMThermalWarningLevelDanger - thermal pressure may cause system slowdown
+ * kIOPMThermalWarningLevelCrisis - thermal conditions may cause imminent shutdown
+ *
+ * The platform may define additional thermal levels if necessary.
+ */
+enum {
+ kIOPMThermalWarningLevelNormal = 0,
+ kIOPMThermalWarningLevelDanger = 5,
+ kIOPMThermalWarningLevelCrisis = 10
+};
+
+
+// PM Settings Controller setting types
+// Settings types used primarily with:
+// IOPMrootDomain::registerPMSettingController
+// The values are identical to the similarly named keys for use in user space
+// PM settings work. Those keys are defined in IOPMLibPrivate.h.
+#define kIOPMSettingWakeOnRingKey "Wake On Modem Ring"
+#define kIOPMSettingRestartOnPowerLossKey "Automatic Restart On Power Loss"
+#define kIOPMSettingWakeOnACChangeKey "Wake On AC Change"
+#define kIOPMSettingSleepOnPowerButtonKey "Sleep On Power Button"
+#define kIOPMSettingWakeOnClamshellKey "Wake On Clamshell Open"
+#define kIOPMSettingReduceBrightnessKey "ReduceBrightness"
+#define kIOPMSettingDisplaySleepUsesDimKey "Display Sleep Uses Dim"
+#define kIOPMSettingTimeZoneOffsetKey "TimeZoneOffsetSeconds"
+#define kIOPMSettingMobileMotionModuleKey "MobileMotionModule"
+#define kIOPMSettingGraphicsSwitchKey "GPUSwitch"
+
+// Setting controlling drivers can register to receive scheduled wake data
+// Either in "CF seconds" type, or structured calendar data in a formatted
+// IOPMCalendarStruct defined below.
+#define kIOPMSettingAutoWakeSecondsKey "wake"
+#define kIOPMSettingAutoWakeCalendarKey "WakeByCalendarDate"
+#define kIOPMSettingAutoPowerSecondsKey "poweron"
+#define kIOPMSettingAutoPowerCalendarKey "PowerByCalendarDate"
+
+// Debug seconds auto wake
+// Used by sleep cycling debug tools
+#define kIOPMSettingDebugWakeRelativeKey "WakeRelativeToSleep"
+#define kIOPMSettingDebugPowerRelativeKey "PowerRelativeToShutdown"
+
+// Maintenance wake calendar.
+#define kIOPMSettingMaintenanceWakeCalendarKey "MaintenanceWakeCalendarDate"
+
+struct IOPMCalendarStruct {
+ UInt32 year;
+ UInt8 month;
+ UInt8 day;
+ UInt8 hour;
+ UInt8 minute;
+ UInt8 second;
+};
+typedef struct IOPMCalendarStruct IOPMCalendarStruct;
+
+// SetAggressiveness types
+enum {
+ kPMGeneralAggressiveness = 0,
+ kPMMinutesToDim,
+ kPMMinutesToSpinDown,
+ kPMMinutesToSleep,
+ kPMEthernetWakeOnLANSettings,
+ kPMSetProcessorSpeed,
+ kPMPowerSource,
+ kPMMotionSensor,
+ kPMLastAggressivenessType
+};
+#define kMaxType (kPMLastAggressivenessType-1)
+
+// SetAggressiveness values for the kPMPowerSource aggressiveness type
+enum {
+ kIOPMInternalPower = 1,
+ kIOPMExternalPower
+};
+
+#define kIOREMSleepEnabledKey "REMSleepEnabled"
+
+// Strings for deciphering the dictionary returned from IOPMCopyBatteryInfo
+#define kIOBatteryInfoKey "IOBatteryInfo"
+#define kIOBatteryCurrentChargeKey "Current"
+#define kIOBatteryCapacityKey "Capacity"
+#define kIOBatteryFlagsKey "Flags"
+#define kIOBatteryVoltageKey "Voltage"
+#define kIOBatteryAmperageKey "Amperage"
+#define kIOBatteryCycleCountKey "Cycle Count"
+
+enum {
+ kIOBatteryInstalled = (1 << 2),
+ kIOBatteryCharge = (1 << 1),
+ kIOBatteryChargerConnect = (1 << 0)
+};
+
+// Private power management message indicating battery data has changed
+// Indicates new data resides in the IORegistry
+#define kIOPMMessageBatteryStatusHasChanged iokit_family_msg(sub_iokit_pmu, 0x100)
+
+// Apple private Legacy messages for re-routing AutoWake and AutoPower messages to the PMU
+// through newer user space IOPMSchedulePowerEvent API
+#define kIOPMUMessageLegacyAutoWake iokit_family_msg(sub_iokit_pmu, 0x200)
+#define kIOPMUMessageLegacyAutoPower iokit_family_msg(sub_iokit_pmu, 0x210)
+
+// For use with IOPMPowerSource bFlags
+#define IOPM_POWER_SOURCE_REV 2
+enum {
+ kIOPMACInstalled = kIOBatteryChargerConnect,
+ kIOPMBatteryCharging = kIOBatteryCharge,
+ kIOPMBatteryInstalled = kIOBatteryInstalled,
+ kIOPMUPSInstalled = (1<<3),
+ kIOPMBatteryAtWarn = (1<<4),
+ kIOPMBatteryDepleted = (1<<5),
+ kIOPMACnoChargeCapability = (1<<6), // AC adapter cannot charge battery
+ kIOPMRawLowBattery = (1<<7), // used only by Platform Expert
+ kIOPMForceLowSpeed = (1<<8), // set by Platfm Expert, chk'd by Pwr Plugin
+ kIOPMClosedClamshell = (1<<9), // set by PMU - reflects state of the clamshell
+ kIOPMClamshellStateOnWake = (1<<10) // used only by Platform Expert
+};
+
+// **********************************************
+// Internal power management data structures
+// **********************************************
+
+#if KERNEL && __cplusplus
+class IOService;
+
+enum {
+ kIOPowerEmergencyLevel = 1000
+};
+
+enum {
+ kIOPMSubclassPolicy,
+ kIOPMSuperclassPolicy1
+};
+
+struct stateChangeNote {
+ IOPMPowerFlags stateFlags;
+ unsigned long stateNum;
+ void * powerRef;
+};
+typedef struct stateChangeNote stateChangeNote;
+
+struct IOPowerStateChangeNotification {
+ void * powerRef;
+ unsigned long returnValue;
+ unsigned long stateNumber;
+ IOPMPowerFlags stateFlags;
+};
+typedef struct IOPowerStateChangeNotification IOPowerStateChangeNotification;
+typedef IOPowerStateChangeNotification sleepWakeNote;
+#endif /* KERNEL && __cplusplus */
+
+/*! @struct IOPMSystemCapabilityChangeParameters
+ @abstract A structure describing a system capability change.
+ @discussion A system capability change is a system level transition from a set
+ of system capabilities to a new set of system capabilities. Power management
+ sends a kIOMessageSystemCapabilityChange message and provides
+ this structure as the message data (by reference) to
+ gIOPriorityPowerStateInterest clients when system capability
+ changes.
+ @field notifyRef An identifier for this message notification. Clients with pending
+ I/O can signal completion by calling allowPowerChange() with this
+ value as the argument. Clients that are able to process the notification
+ synchronously should ignore this field.
+ @field maxWaitForReply A return value to the caller indicating the maximum time in
+ microseconds to wait for the allowPowerChange() call. The default
+ value is zero, which indicates the client processing has finished, and power
+ management should not wait for an allowPowerChange() call.
+ @field changeFlags Flags will be set to indicate whether the notification precedes
+ the capability change (kIOPMSystemCapabilityWillChange), or after
+ the capability change has occurred (kIOPMSystemCapabilityDidChange).
+ @field __reserved1 Set to zero.
+ @field fromCapabilities The system capabilities at the start of the transition.
+ @field toCapabilities The system capabilities at the end of the transition.
+ @field __reserved2 Set to zero.
+ */
+struct IOPMSystemCapabilityChangeParameters {
+ uint32_t notifyRef;
+ uint32_t maxWaitForReply;
+ uint32_t changeFlags;
+ uint32_t __reserved1;
+ uint32_t fromCapabilities;
+ uint32_t toCapabilities;
+ uint32_t __reserved2[4];
+};
+
+/*! @enum IOPMSystemCapabilityChangeFlags
+ @constant kIOPMSystemCapabilityWillChange Indicates the system capability will change.
+ @constant kIOPMSystemCapabilityDidChange Indicates the system capability has changed.
+*/
+enum {
+ kIOPMSystemCapabilityWillChange = 0x01,
+ kIOPMSystemCapabilityDidChange = 0x02
+};
+
+enum {
+ kIOPMSystemCapabilityCPU = 0x01,
+ kIOPMSystemCapabilityGraphics = 0x02,
+ kIOPMSystemCapabilityAudio = 0x04,
+ kIOPMSystemCapabilityNetwork = 0x08
+};
+
+#endif /* ! _IOKIT_IOPM_H */
diff --git a/include/IOKit/pwr_mgt/IOPMKeys.h b/include/IOKit/pwr_mgt/IOPMKeys.h
new file mode 100644
index 0000000..906c128
--- /dev/null
+++ b/include/IOKit/pwr_mgt/IOPMKeys.h
@@ -0,0 +1,100 @@
+/*
+ * Copyright (c) 2006 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_LICENSE_HEADER_START@
+ *
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * @APPLE_LICENSE_HEADER_END@
+ */
+
+/*!
+ @header IOPMKeys.h
+
+ IOPMKeys.h defines C strings for use accessing power management data.
+ Note that all of these C strings must be converted to CFStrings before use. You can wrap
+ them with the CFSTR() macro, or create a CFStringRef (that you must later CFRelease()) using CFStringCreateWithCString()
+ */
+
+#ifndef _IOPMKEYS_H_
+#define _IOPMKEYS_H_
+
+/*
+ * Types of power event
+ * These are potential arguments to IOPMSchedulePowerEvent().
+ * These are all potential values of the kIOPMPowerEventTypeKey in the CFDictionaries
+ * returned by IOPMCopyScheduledPowerEvents().
+ */
+/*!
+ @define kIOPMAutoWake
+ @abstract Value for scheduled wake from sleep.
+*/
+#define kIOPMAutoWake "wake"
+
+/*!
+ @define kIOPMAutoPowerOn
+ @abstract Value for scheduled power on from off state.
+*/
+#define kIOPMAutoPowerOn "poweron"
+
+/*!
+ @define kIOPMAutoWakeOrPowerOn
+ @abstract Value for scheduled wake from sleep, or power on. The system will either wake OR
+ power on, whichever is necessary.
+*/
+
+#define kIOPMAutoWakeOrPowerOn "wakepoweron"
+/*!
+ @define kIOPMAutoSleep
+ @abstract Value for scheduled sleep.
+*/
+
+#define kIOPMAutoSleep "sleep"
+/*!
+ @define kIOPMAutoShutdown
+ @abstract Value for scheduled shutdown.
+*/
+
+#define kIOPMAutoShutdown "shutdown"
+/*!
+ @define kIOPMAutoRestart
+ @abstract Value for scheduled restart.
+*/
+
+#define kIOPMAutoRestart "restart"
+
+/*
+ * Keys for evaluating the CFDictionaries returned by IOPMCopyScheduledPowerEvents()
+ */
+/*!
+ @define kIOPMPowerEventTimeKey
+ @abstract Key for the time of the scheduled power event. Value is a CFDateRef.
+*/
+#define kIOPMPowerEventTimeKey "time"
+
+/*!
+ @define kIOPMPowerEventAppNameKey
+ @abstract Key for the CFBundleIdentifier of the app that scheduled the power event. Value is a CFStringRef.
+*/
+#define kIOPMPowerEventAppNameKey "scheduledby"
+
+/*!
+ @define kIOPMPowerEventTypeKey
+ @abstract Key for the type of power event. Value is a CFStringRef, with the c-string value of one of the "kIOPMAuto" strings.
+*/
+#define kIOPMPowerEventTypeKey "eventtype"
+
+#endif
diff --git a/include/IOKit/pwr_mgt/IOPMLib.h b/include/IOKit/pwr_mgt/IOPMLib.h
new file mode 100644
index 0000000..06a15f8
--- /dev/null
+++ b/include/IOKit/pwr_mgt/IOPMLib.h
@@ -0,0 +1,1021 @@
+/*
+ * Copyright (c) 1998-2005 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_LICENSE_HEADER_START@
+ *
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * @APPLE_LICENSE_HEADER_END@
+ */
+
+#include
+#include
+#include
+#include
+#include
+
+#ifndef _IOKIT_PWRMGT_IOPMLIB_
+#define _IOKIT_PWRMGT_IOPMLIB_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*!
+@header IOPMLib.h
+ IOPMLib provides access to common power management facilities, like initiating
+ system sleep, getting current idle timer values, registering for sleep/wake notifications,
+ and preventing system sleep.
+*/
+
+/*! @function IOPMFindPowerManagement
+ @abstract Finds the Root Power Domain IOService.
+ @param master_device_port Just pass in MACH_PORT_NULL for master device port.
+ @result Returns a io_connect_t handle on the root domain. Must be released with IOServiceClose() when done.
+ */
+io_connect_t IOPMFindPowerManagement( mach_port_t master_device_port )
+ AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER;
+
+/*! @function IOPMSetAggressiveness
+ @abstract Sets one of the aggressiveness factors in IOKit Power Management.
+ @param fb Representation of the Root Power Domain from IOPMFindPowerManagement.
+ @param type Specifies which aggressiveness factor is being set.
+ @param aggressiveness New value of the aggressiveness factor.
+ @result Returns kIOReturnSuccess or an error condition if request failed.
+*/
+IOReturn IOPMSetAggressiveness (io_connect_t fb, unsigned long type, unsigned long aggressiveness )
+ AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER;
+
+/*! @function IOPMGetAggressiveness
+ @abstract Retrieves the current value of one of the aggressiveness factors in IOKit Power Management.
+ @param fb Representation of the Root Power Domain from IOPMFindPowerManagement.
+ @param type Specifies which aggressiveness factor is being retrieved.
+ @param aggressiveness Points to where to store the retrieved value of the aggressiveness factor.
+ @result Returns kIOReturnSuccess or an error condition if request failed.
+ */
+IOReturn IOPMGetAggressiveness ( io_connect_t fb, unsigned long type, unsigned long * aggressiveness )
+ AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER;
+
+/*! @function IOPMSleepEnabled
+ @abstract Tells whether the system supports full sleep, or just doze
+ @result Returns true if the system supports sleep, false if some hardware prevents full sleep.
+ */
+boolean_t IOPMSleepEnabled ( void ) AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER;
+
+/*! @function IOPMSleepSystem
+ @abstract Request that the system initiate sleep.
+ @discussion For security purposes, caller must be root or the console user.
+ @param fb Port used to communicate to the kernel, from IOPMFindPowerManagement.
+ @result Returns kIOReturnSuccess or an error condition if request failed.
+ */
+IOReturn IOPMSleepSystem ( io_connect_t fb ) AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER;
+
+/*! @function IOPMCopyBatteryInfo
+ @abstract Request raw battery data from the system.
+ @discussion WARNING! IOPMCoyBatteryInfo is unsupported on ALL Intel CPU based systems. For PPC CPU based systems, it remains not recommended. For almost all purposes, developers should use the richer IOPowerSources API (with change notifications) instead of using IOPMCopyBatteryInfo. Keys to decipher IOPMCopyBatteryInfo's return CFArray exist in IOPM.h.
+ @param masterPort The master port obtained from IOMasterPort(). Just pass MACH_PORT_NULL.
+ @param info A CFArray of CFDictionaries containing raw battery data.
+ @result Returns kIOReturnSuccess or an error condition if request failed.
+ */
+IOReturn IOPMCopyBatteryInfo( mach_port_t masterPort, CFArrayRef * info )
+ AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER;
+
+
+
+/*!
+ @functiongroup Notifications
+*/
+
+
+/*! @function IORegisterApp
+ @abstract Connects the caller to an IOService for the purpose of receiving power state change notifications for the device controlled by the IOService.
+ @discussion IORegisterApp requires that the IOService of interest implement an IOUserClient. In addition, that IOUserClient must implement the allowPowerChange and cancelPowerChange methods defined in IOPMLibDefs.h. If you're interested in receiving power state notifications from a device without an IOUserClient, try using IOServiceAddInterestNotification with interest type gIOGeneralInterest instead.
+ @param refcon Data returned on power state change notifications and not used by the kernel.
+ @param theDriver Representation of the IOService, probably from IOServiceGetMatchingService.
+ @param thePortRef Pointer to a port on which the caller will receive power state change notifications. The port is allocated by the calling application.
+ @param callback A c-function which is called during the notification.
+ @param notifier Pointer to a notifier which caller must keep and pass to subsequent call to IODeregisterApp.
+ @result Returns a io_connect_t session for the IOService or MACH_PORT_NULL if request failed. Caller must close return value via IOServiceClose() after calling IODeregisterApp on the notifier argument.
+*/
+io_connect_t IORegisterApp( void * refcon,
+ io_service_t theDriver,
+ IONotificationPortRef * thePortRef,
+ IOServiceInterestCallback callback,
+ io_object_t * notifier )
+ AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER;
+
+/*! @function IORegisterForSystemPower
+ @abstract Connects the caller to the Root Power Domain IOService for the purpose of receiving sleep & wake notifications for the system.
+ Does not provide system shutdown and restart notifications.
+ @discussion Provides sleep/wake notifications to applications. Requires that applications acknowledge
+ some, but not all notifications. Register for sleep/wake notifications will deliver these messages
+ over the sleep/wake lifecycle:
+
+ - kIOMessageSystemWillSleep is delivered at the point the system is initiating a
+ non-abortable sleep.
+ Callers MUST acknowledge this event by calling @link IOAllowPowerChange @/link.
+ If a caller does not acknowledge the sleep notification, the sleep will continue anyway after
+ a 30 second timeout (resulting in bad user experience).
+ Delivered before any hardware is powered off.
+
+ - kIOMessageSystemWillPowerOn is delivered at early wakeup time, before most hardware has been
+ powered on. Be aware that any attempts to access disk, network, the display, etc. may result
+ in errors or blocking your process until those resources become available.
+ Caller must NOT acknowledge kIOMessageSystemWillPowerOn; the caller must simply return from its handler.
+
+ - kIOMessageSystemHasPoweredOn is delivered at wakeup completion time, after all device drivers and
+ hardware have handled the wakeup event. Expect this event 1-5 or more seconds after initiating
+ system wakeup.
+ Caller must NOT acknowledge kIOMessageSystemHasPoweredOn; the caller must simply return from its handler.
+
+ - kIOMessageCanSystemSleep indicates the system is pondering an idle sleep, but gives apps the
+ chance to veto that sleep attempt.
+ Caller must acknowledge kIOMessageCanSystemSleep by calling @link IOAllowPowerChange @/link
+ or @link IOCancelPowerChange @/link. Calling IOAllowPowerChange will not veto the sleep; any
+ app that calls IOCancelPowerChange will veto the idle sleep. A kIOMessageCanSystemSleep
+ notification will be followed up to 30 seconds later by a kIOMessageSystemWillSleep message.
+ or a kIOMessageSystemWillNotSleep message.
+
+ - kIOMessageSystemWillNotSleep is delivered when some app client has vetoed an idle sleep
+ request. kIOMessageSystemWillNotSleep may follow a kIOMessageCanSystemSleep notification,
+ but will not otherwise be sent.
+ Caller must NOT acknowledge kIOMessageSystemWillNotSleep; the caller must simply return from its handler.
+
+ To deregister for sleep/wake notifications, the caller must make two calls, in this order:
+ - Call IODeregisterForSystemPower with the 'notifier' argument returned here.
+ - Then call IONotificationPortDestroy passing the 'thePortRef' argument
+ returned here.
+
+ @param refcon Caller may provide data to receive s an argument to 'callback' on power state changes.
+ @param thePortRef On return, thePortRef is a pointer to an IONotificationPortRef, which will deliver the power notifications.
+ The port is allocated by this function and must be later released by the caller (after calling @link IODeregisterForSystemPower @/link).
+ The caller should also enable IONotificationPortRef by calling @link IONotificationPortGetRunLoopSource @/link, or
+ @link IONotificationPortGetMachPort @/link, or @link IONotificationPortSetDispatchQueue @/link.
+ @param callback A c-function which is called during the notification.
+ @param notifier On success, returns a pointer to a unique notifier which caller must keep and pass to a subsequent call to IODeregisterForSystemPower.
+ @result Returns a io_connect_t session for the IOPMrootDomain or MACH_PORT_NULL if request failed.
+ Caller must close return value via IOServiceClose() after calling IODeregisterForSystemPower on the notifier argument.
+ */
+io_connect_t IORegisterForSystemPower ( void * refcon,
+ IONotificationPortRef * thePortRef,
+ IOServiceInterestCallback callback,
+ io_object_t * notifier )
+ AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER;
+/*! @function IODeregisterApp
+ @abstract Disconnects the caller from an IOService after receiving power state change notifications from the IOService. (Caller must also release IORegisterApp's return io_connect_t and returned IONotificationPortRef for complete clean-up).
+ @param notifier An object from IORegisterApp.
+ @result Returns kIOReturnSuccess or an error condition if request failed.
+ */
+IOReturn IODeregisterApp ( io_object_t * notifier ) AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER;
+
+/*! @function IODeregisterForSystemPower
+ @abstract Disconnects the caller from the Root Power Domain IOService after receiving system power state change notifications. (Caller must also destroy the IONotificationPortRef returned from IORegisterForSystemPower.)
+ @param notifier The object returned from IORegisterForSystemPower.
+ @result Returns kIOReturnSuccess or an error condition if request failed.
+*/
+IOReturn IODeregisterForSystemPower ( io_object_t * notifier )
+ AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER;
+
+/*! @function IOAllowPowerChange
+ @abstract The caller acknowledges notification of a power state change on a device it has registered for notifications for via IORegisterForSystemPower or IORegisterApp.
+ @discussion Must be used when handling kIOMessageCanSystemSleep and kIOMessageSystemWillSleep messages from IOPMrootDomain system power. The caller should not call IOAllowPowerChange in response to any messages
+ except for these two.
+ @param kernelPort Port used to communicate to the kernel, from IORegisterApp or IORegisterForSystemPower.
+ @param notificationID A copy of the notification ID which came as part of the power state change notification being acknowledged.
+ @result Returns kIOReturnSuccess or an error condition if request failed.
+*/
+IOReturn IOAllowPowerChange ( io_connect_t kernelPort, long notificationID )
+ AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER;
+
+/*! @function IOCancelPowerChange
+ @abstract The caller denies an idle system sleep power state change.
+ @discussion Should only called in response to kIOMessageCanSystemSleep messages from IOPMrootDomain. IOCancelPowerChange has no meaning for responding to kIOMessageSystemWillSleep (which is non-abortable) or any other messages.
+
+ When an app responds to a kIOMessageCanSystemSleep message by calling IOCancelPowerChange, the app
+ vetoes the idle sleep request. The system will stay awake.
+ The idle timer will elapse again after a period of inactivity, and the system will
+ send out the same kIOMessageCanSystemSleep message, and interested applications will respond gain.
+
+ @param kernelPort Port used to communicate to the kernel, from IORegisterApp or IORegisterForSystemPower.
+ @param notificationID A copy of the notification ID which came as part of the power state change notification being acknowledged.
+ @result Returns kIOReturnSuccess or an error condition if request failed.
+ */
+IOReturn IOCancelPowerChange ( io_connect_t kernelPort, long notificationID )
+ AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER;
+
+/*!
+ @functiongroup ScheduledEvents
+*/
+
+/*! @function IOPMSchedulePowerEvent
+ @abstract Schedule the machine to wake from sleep, power on, go to sleep, or shutdown.
+ @discussion This event will be added to the system's queue of power events and stored persistently on disk. The sleep and shutdown events present a graphical warning and allow a console user to cancel the event. Must be called as root.
+ @param time_to_wake Date and time that the system will power on/off.
+ @param my_id A CFStringRef identifying the calling app by CFBundleIdentifier. May be NULL.
+ @param type The type of power on you desire, either wake from sleep or power on. Choose from:
+ CFSTR(kIOPMAutoWake) == wake machine,
+ CFSTR(kIOPMAutoPowerOn) == power on machine,
+ CFSTR(kIOPMAutoWakeOrPowerOn) == wake or power on,
+ CFSTR(kIOPMAutoSleep) == sleep machine,
+ CFSTR(kIOPMAutoShutdown) == power off machine,
+ CFSTR(kIOPMAutoRestart) == restart the machine.
+ @result kIOReturnSuccess on success, otherwise on failure
+*/
+IOReturn IOPMSchedulePowerEvent(CFDateRef time_to_wake, CFStringRef my_id, CFStringRef type);
+
+/*! @function IOPMCancelScheduledPowerEvent
+ @abstract Cancel a previously scheduled power event.
+ @discussion Arguments mirror those to IOPMSchedulePowerEvent. All arguments must match the original arguments from when the power on was scheduled. Must be called as root.
+ @param time_to_wake Cancel entry with this date and time.
+ @param my_id Cancel entry with this name.
+ @param type Type to cancel
+ @result kIOReturnSuccess on success, otherwise on failure
+*/
+IOReturn IOPMCancelScheduledPowerEvent(CFDateRef time_to_wake, CFStringRef my_id, CFStringRef type);
+
+/*! @function IOPMCopyScheduledPowerEvents
+ @abstract List all scheduled system power events
+ @discussion Returns a CFArray of CFDictionaries of power events. Each CFDictionary contains keys for CFSTR(kIOPMPowerEventTimeKey), CFSTR(kIOPMPowerEventAppNameKey), and CFSTR(kIOPMPowerEventTypeKey).
+ @result A CFArray of CFDictionaries of power events. The CFArray must be released by the caller. NULL if there are no scheduled events.
+*/
+CFArrayRef IOPMCopyScheduledPowerEvents(void);
+
+
+
+/*!
+ * @defineblock IOPMAssertionDictionaryKeys
+ *
+ * @discussion Keys into dictionaries describing assertions.
+ */
+
+/*!
+ * @define kIOPMAssertionTimeoutKey
+ * @abstract kIOPMAssertionTimeoutKey specifies an outer bound, in seconds, that this assertion should be asserted.
+ *
+ * @discussion If your application hangs, or is unable to complete its assertion task in a reasonable amount of time,
+ * specifying a timeout allows PM to disable your assertion so the system can resume normal activity.
+ * Once a timeout with the @link kIOPMAssertionTimeoutActionTurnOff@/link assertion fires, the level
+ * will be set to @link kIOPMAssertionTimeoutActionTurnOff@/link. The assertion may be re-armed by calling
+ * @link IOPMAssertionSetLevel@/link.
+ *
+ *
+ * This key may be specified in the dictionary passed to @link IOPMAssertionCreateWithProperties@/link.
+ *
+ * This key may be present in the dictionary returned from @link IOPMAssertionCopyProperties@/link.
+ */
+#define kIOPMAssertionTimeoutKey CFSTR("TimeoutSeconds")
+
+
+/*!
+ * @define kIOPMAssertionTimeoutActionKey
+ *
+ * @abstract Specifies the action to take upon timeout expiration.
+ *
+ * @discussion Specifying the timeout action only has meaning if you also specify an @link kIOPMAssertionTimeoutKey@/link
+ * If the caller does not specify a timeout action, the default action is @link kIOPMAssertionTimeoutActionTurnOff@/link
+ *
+ * This key may be specified in the dictionary passed to @link IOPMAssertionCreateWithProperties@/link.
+ *
+ * This key may be present in the dictionary returned from @link IOPMAssertionCopyProperties@/link.
+ */
+#define kIOPMAssertionTimeoutActionKey CFSTR("TimeoutAction")
+
+/*!
+ * @define kIOPMAssertionTimeoutActionLog
+ *
+ * @abstract A potential value for @link kIOPMAssertionTimeoutActionKey@/link
+ *
+ * @discussion When this timeout action is specified, PM will log the timeout event
+ * but will not turn off or affect the setting of the assertion in any way.
+ *
+ */
+#define kIOPMAssertionTimeoutActionLog CFSTR("TimeoutActionLog")
+
+/*!
+ * @define kIOPMAssertionTimeoutActionTurnOff
+ *
+ * @discussion When a timeout expires with this action, Power Management will log the timeout event,
+ * and will set the assertion's level to @link kIOPMAssertionLevelOff@/link.
+ */
+#define kIOPMAssertionTimeoutActionTurnOff CFSTR("TimeoutActionTurnOff")
+
+/*!
+ * @define kIOPMAssertionTimeoutActionRelease
+ *
+ * @discussion When a timeout expires with this action, Power Management will log the timeout event,
+ * and will release the assertion.
+ */
+#define kIOPMAssertionTimeoutActionRelease CFSTR("TimeoutActionRelease")
+
+/*!
+ * @define kIOPMAssertionRetainCountKey
+ *
+ * @discussion kIOPMAssertionRetainCountKey reflects the CoreFoundation-style retain count on this assertion.
+ * Creating or retaining an assertion increments its retain count.
+ * Release an assertion decrements its retain count.
+ * When the retain count decrements to zero, the OS will destroy the object.
+ *
+ * This key can be found in the dictionary returned from @link IOPMAssertionCopyProperties@/link.
+ */
+#define kIOPMAssertionRetainCountKey CFSTR("RetainCount")
+
+/*!
+ * @define kIOPMAssertionNameKey
+ *
+ * @abstract The CFDictionary key for assertion name. Setting this key is required when you're creating an assertion.
+ *
+ * @discussion kIOPMAssertionNameKey describes the the activity the assertion is protecting. The creator should
+ * specify a CFString value for this key in the dictionary passed to @link IOPMAssertionCreateWithProperties@/link
+ *
+ * The assertion name is separate from the assertion type's behavior - specify a CFString
+ * like "Checking mail" or "Compiling" that describes the task that this assertion protects.
+ *
+ * The CFString you associate with this key does not have to be localizable (OS X will not attempt to localize it.)
+ *
+ * Describe your assertion as thoroughly as possible. See these other keys that can you can also set to add explanation
+ * to an assertion:
+ * OPTIONAL @link kIOPMAssertionDetailsKey@/link
+ * OPTIONAL @link kIOPMAssertionHumanReadableReasonKey @/link
+ * OPTIONAL @link kIOPMAssertionLocalizationBundlePathKey@/link
+ */
+#define kIOPMAssertionNameKey CFSTR("AssertName")
+
+/*!
+ * @define kIOPMAssertionDetailsKey
+ *
+ * @abstract You may provide extra, contextual information about an assertion for admins and for debugging
+ * in this key. Setting this key in an assertion dictionary is optional.
+ *
+ @discussion Please name your assertion something unique with @link kIOPMAssertionNameKey@/link first.
+ * If you have more data to describe this assertion, put it here as a CFString.
+ *
+ * ' EXAMPLE: OS X creates an assertion named com.apple.powermanagement.tty to prevent sleep for
+ * remote-logged in users. To identify the cause for these assertions, OS X sets kIOPMAssertionDetailsKey
+ * to the CFString device path of the active remote session(s), e.g. "/dev/ttys000 /dev/ttys004"
+ *
+ * The CFString you associate with this key does not have to be localizable (OS X will not attempt to localize it.)
+ *
+ * Describe your assertion as thoroughly as possible. See these other keys that can you can set to add explanation
+ * to an assertion:
+ * REQUIRED @link kIOPMAssertionNameKey@/link
+ * OPTIONAL @link kIOPMAssertionHumanReadableReasonKey @/link
+ * OPTIONAL @link kIOPMAssertionLocalizationBundlePathKey@/link
+ */
+#define kIOPMAssertionDetailsKey CFSTR("Details")
+
+/*!
+ * @define kIOPMAssertionHumanReadableReasonKey
+ *
+ * @abstract Optional key that provides a localizable string for OS X to display PM Assertions in the GUI.
+ *
+ * @discussion The caller should specify this string in @link IOPMAssertionCreateWithProperties@/link.
+ * If present, OS X may display this string, localized to the user's language, to explain changes in system
+ * behavior caused by the assertion.
+ *
+ * If set, the caller must also specify a bundle path for the key
+ * @link kIOPMAssertionLocalizationBundlePathKey@/link
+ * The bundle at that path should contain localization info for the specified string.
+ *
+ * This key may be specified in the dictionary passed to @link IOPMAssertionCreateWithProperties@/link.
+ *
+ * This key may be present in the dictionary returned from @link IOPMAssertionCopyProperties@/link.
+ *
+ * Describe your assertion as thoroughly as possible. See these other keys that can you can set to add explanation
+ * to an assertion:
+ * REQUIRED @link kIOPMAssertionNameKey@/link
+ * OPTIONAL @link kIOPMAssertionDetailsKey @/link
+ */
+#define kIOPMAssertionHumanReadableReasonKey CFSTR("HumanReadableReason")
+
+/*!
+ * @define kIOPMAssertionLocalizationBundlePathKey
+ *
+ * @abstract Refers to a CFURL, as a CFString, identifying the path to the caller's
+ * bundle, which contains localization info.
+ *
+ * @discussion The bundle must contain localizations for
+ * @link kIOPMAssertionHumanReadableReasonKey@/link
+ *
+ * This key may be specified in the dictionary passed to @link IOPMAssertionCreateWithProperties@/link.
+ *
+ * This key may be present in the dictionary returned from @link IOPMAssertionCopyProperties@/link.
+ */
+#define kIOPMAssertionLocalizationBundlePathKey CFSTR("BundlePath")
+
+/*!
+ * @define kIOPMAssertionFrameworkIDKey
+ *
+ * @abstract Specify if the assertion creator is a framework.
+ *
+ * @discussion If the code that creates the assertion resides in a framework or library, the caller
+ * should specify a CFBundleIdentifier, as a CFString, identifying that bundle here.
+ * This info helps developers and administrators determine the source of an assertion.
+ *
+ * This key may be specified in the dictionary passed to @link IOPMAssertionCreateWithProperties@/link.
+ *
+ * This key may be present in the dictionary returned from @link IOPMAssertionCopyProperties@/link.
+ */
+#define kIOPMAssertionFrameworkIDKey CFSTR("FrameworkBundleID")
+
+/*!
+ * @define kIOPMAssertionPlugInIDKey
+ *
+ * @abstract Specify if the assertion creator is a plugin.
+ *
+ * @discussion If the code that creates the assertion resides in a plugin, the caller
+ * should specify a CFBundleIdentifier, as a CFString, identifying the plugin's bundle here.
+ * This info helps developers and administrators determine the source of an assertion.
+ *
+ * This key may be specified in the dictionary passed to @link IOPMAssertionCreateWithProperties@/link.
+ *
+ * This key may be present in the dictionary returned from @link IOPMAssertionCopyProperties@/link.
+ */
+#define kIOPMAssertionPlugInIDKey CFSTR("PlugInBundleID")
+
+/*!
+ * @define kIOPMAssertionTypeKey
+ *
+ * @abstract The CFDictionary key for assertion type in an assertion info dictionary.
+ *
+ * @discussion The value for this key will be a CFStringRef, with the value of the assertion
+ * type specified at creation time.
+ * Note that OS X may substitute a support assertion type string if the caller
+ * specifies a deprecated assertion type; in that case the value for this key could
+ * differ from the caller-provided assertion type.
+ */
+#define kIOPMAssertionTypeKey CFSTR("AssertType")
+
+/*!
+ * @define kIOPMAssertionLevelKey
+ *
+ * @abstract The CFDictionary key for assertion level in an assertion info dictionary.
+ *
+ * @discussion The value for this key will be a CFNumber, kCFNumberIntType with value
+ * kIOPMAssertionLevelOff or kIOPMAssertionLevelOn.
+ * The level reflects the assertion's level set at creation, or adjusted via
+ * @link IOPMAssertionSetLevel@/link
+ */
+#define kIOPMAssertionLevelKey CFSTR("AssertLevel")
+
+/*! @/defineblock IOPMAssertionDictionary Keys*/
+
+/*!
+ * @typedef IOPMAssertionID
+ *
+ * @abstract Type for AssertionID arguments to @link IOPMAssertionCreateWithProperties@/link
+ * and @link IOPMAssertionRelease@/link
+ */
+typedef uint32_t IOPMAssertionID;
+
+
+
+/*!
+ * @defineblock IOPMAssertionTypes
+ */
+
+
+/*!
+ * @define kIOPMAssertionTypePreventUserIdleSystemSleep
+ *
+ * @abstract Prevents the system from sleeping automatically due to a lack of user activity.
+ *
+ * @discussion When asserted and set to level @link kIOPMAssertionLevelOn@/link,
+ * will prevent the system from sleeping due to a period of idle user activity.
+ *
+ * The display may dim and idle sleep while kIOPMAssertionTypePreventUserIdleSystemSleep is
+ * enabled, but the system may not idle sleep.
+ *
+ * The system may still sleep for lid close, Apple menu, low battery, or other sleep reasons.
+ *
+ * This assertion does not put the system into Dark Wake.
+ *
+ * A caller publish the AssertionType in its assertion properties dictionary.
+ * The AssertionType should be a key in the properties dictionary, with a value
+ * of a CFNumber containing the kCFNumberIntegerType value
+ * @link kIOPMAssertionLevelOff@/link or @link kIOPMAssertionLevelOn@/link.
+ */
+
+#define kIOPMAssertionTypePreventUserIdleSystemSleep CFSTR("PreventUserIdleSystemSleep")
+
+
+/*!
+ * @define kIOPMAssertionTypePreventUserIdleDisplaySleep
+ *
+ * @abstract Prevents the display from dimming automatically.
+ *
+ * @discussion When asserted and set to level @link kIOPMAssertionLevelOn@/link,
+ * will prevent the display from turning off due to a period of idle user activity.
+ * Note that the display may still sleep from other reasons, like a user closing a
+ * portable's lid or the machine sleeping.
+ *
+ * While the display is prevented from dimming, the system cannot go into idle sleep.
+ *
+ * This assertion does not put the system into Dark Wake.
+ *
+ * A caller publish the AssertionType in its assertion properties dictionary.
+ * The AssertionType should be a key in the properties dictionary, with a value
+ * of a CFNumber containing the kCFNumberIntegerType value
+ * @link kIOPMAssertionLevelOff@/link or @link kIOPMAssertionLevelOn@/link.
+ */
+
+#define kIOPMAssertionTypePreventUserIdleDisplaySleep CFSTR("PreventUserIdleDisplaySleep")
+
+
+/*!
+ * @define kIOPMAssertionTypePreventSystemSleep
+ *
+ * @abstract Prevents the system from sleeping and allows the system to reside in Dark Wake
+ * for an arbitrary length of time.
+ *
+ * @discussion When asserted and set to level @link kIOPMAssertionLevelOn@/link,
+ * the system will prefer to enter the Dark Wake state, or remain in Dark Wake if
+ * already there, rather than go to sleep.
+ *
+ * Assertions are just suggestions to the OS, and the OS can only honor them
+ * to the best of its ability. In the case of low power or a thermal emergency,
+ * the system may sleep anyway despite the assertion.
+ *
+ * An assertion must publish the AssertionType in its assertion properties dictionary.
+ * The AssertionType should be a key in the properties dictionary, with a value
+ * of a CFNumber containing the kCFNumberIntegerType value
+ * @link kIOPMAssertionLevelOff@/link or @link kIOPMAssertionLevelOn@/link.
+ */
+
+#define kIOPMAssertionTypePreventSystemSleep CFSTR("PreventSystemSleep")
+
+
+/*!
+ * @define kIOPMAssertionTypeNoIdleSleep
+ *
+ * @deprecated Deprecated in 10.7; Please use assertion type @link kIOPMAssertionTypePreventUserIdleSystemSleep@/link instead.
+ *
+ * @abstract Pass as the AssertionType argument to @link IOPMAssertionCreate@/link.
+ * The system will not idle sleep when enabled (display may sleep). Note that the system may sleep
+ * for other reasons.
+ *
+ */
+#define kIOPMAssertionTypeNoIdleSleep CFSTR("NoIdleSleepAssertion")
+
+/*!
+ * @define kIOPMAssertionTypeNoDisplaySleep
+ *
+ * @deprecated Deprecated in 10.7; Please use assertion type @link kIOPMAssertionTypePreventUserIdleDisplaySleep@/link.
+ *
+ * @abstract Use as AssertionType argument to @link IOPMAssertionCreate@/link.
+ * The idle display will not sleep when enabled, and consequently the system will not idle sleep.
+ */
+#define kIOPMAssertionTypeNoDisplaySleep CFSTR("NoDisplaySleepAssertion")
+
+
+/*!
+ * @enum kIOPMNullAssertionID
+ *
+ * @abstract This value represents a non-initialized assertion ID
+ *
+ * @constant kIOPMNullAssertionID
+ * This value represents a non-initialized assertion ID.
+ *
+ */
+enum {
+ kIOPMNullAssertionID = 0
+};
+
+/*!
+ * @typedef IOPMAssertionLevel
+ *
+ * @abstract Type for AssertionLevel argument to IOPMAssertionCreate
+ *
+ * @discussion Possible values for IOPMAssertionLevel are
+ * @link kIOPMAssertionLevelOff@/link
+ * and @link kIOPMAssertionLevelOn@/link
+ */
+typedef uint32_t IOPMAssertionLevel;
+
+/*!
+ * @enum Assertion Levels
+ */
+enum {
+ /*!
+ * @constant kIOPMAssertionLevelOff
+ * @abstract Level for a disabled assertion, passed as an argument to IOPMAssertionCreate.
+ */
+ kIOPMAssertionLevelOff = 0,
+
+ /*!
+ * @constant kIOPMAssertionLevelOn
+ * @abstract Level for an enabled assertion, passed as an argument to IOPMAssertionCreate.
+ */
+ kIOPMAssertionLevelOn = 255
+ };
+
+
+/*!
+ * @functiongroup Assertions
+ */
+
+
+/*! @function IOPMAssertionCreateWithDescription
+ *
+ * @description Creates an IOPMAssertion. This is the preferred API to call to create an assertion.
+ * It allows the caller to specify the Name, Details, and HumanReadableReason at creation time.
+ * There are other keys that can further describe an assertion, but most developers don't need
+ * to use them. Use @link IOPMAssertionSetProperties @/link or
+ * @link IOPMAssertionCreateWithProperties @/link if you need to specify properties
+ * that aren't avilable here.
+ *
+ * @param AssertionType An assertion type constant.
+ * Caller must specify this argument.
+ *
+ * @param Name A CFString value to correspond to key @link kIOPMAssertionNameKey@/link.
+ * Caller must specify this argument.
+ *
+ * @param Details A CFString value to correspond to key @link kIOPMAssertionDetailsKey@/link.
+ * Caller my pass NULL, but it helps power users and administrators identify the
+ * reasons for this assertion.
+ *
+ * @param HumanReadableReason
+ * A CFString value to correspond to key @link kIOPMAssertionHumanReadableReasonKey@/link.
+ * Caller may pass NULL, but if it's specified OS X may display it to users
+ * to describe the active assertions on their sysstem.
+ *
+ * @param LocalizationBundlePath
+ * A CFString value to correspond to key @link kIOPMAssertionLocalizationBundlePathKey@/link.
+ * This bundle path should include a localization for the string HumanReadableReason
+ * Caller may pass NULL, but this argument is required if caller specifies HumanReadableReason
+ *
+ * @param Timeout Specifies a timeout for this assertion. Pass 0 for no timeout.
+ *
+ * @param TimeoutAction Specifies a timeout action. Caller my pass NULL. If a timeout is specified but a TimeoutAction is not,
+ * the default timeout action is kIOPMAssertionTimeoutActionTurnOff
+ *
+ * @param AssertionID (Output) On successful return, contains a unique reference to a PM assertion.
+ *
+ * @result kIOReturnSuccess, or another IOKit return code on error.
+ */
+IOReturn IOPMAssertionCreateWithDescription(
+ CFStringRef AssertionType,
+ CFStringRef Name,
+ CFStringRef Details,
+ CFStringRef HumanReadableReason,
+ CFStringRef LocalizationBundlePath,
+ CFTimeInterval Timeout,
+ CFStringRef TimeoutAction,
+ IOPMAssertionID *AssertionID)
+__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);
+
+
+
+/*!
+ * @function IOPMAssertionCreateWithProperties
+ *
+ * @abstract Creates an IOPMAssertion with more flexibility than @link IOPMAssertionCreateWithDescription @/link.
+ * @param AssertionType The CFString assertion type to request from the PM system.
+ * @param AssertionLevel Pass @link kIOPMAssertionLevelOn@/link or @link kIOPMAssertionLevelOff@/link.
+ * @param AssertionProperties Caller must describe the assertion to be created, and the caller itself.
+ * @param AssertionID (Output) On successful return, contains a unique reference to a PM assertion.
+ *
+ * @discussion
+ * Create a new PM assertion - the caller must specify the type of assertion, initial level, and its
+ * properties as @link IOPMAssertionDictionaryKeys@/link keys in the AssertionProperties dictionary.
+ * The following keys are recommend and/or required to be specified in the AssertionProperties
+ * dictionary argument.
+ *
+ *
REQUIRED: Define at least one assertion as a key, with its initial level as a value:
+ * @link kIOPMAssertionTypePreventSystemSleep@/link
+ * or @link kIOPMAssertionTypeNoIdleSleep@/link
+ * or @link kIOPMAssertionTypePreventSystemSleep@/link
+ *
+ *
REQUIRED: kIOPMAssertionNameKey Caller must describe the name for the activity that
+ * requires the change in behavior provided by the assertion.
+ *
+ *
OPTIONAL: kIOPMAssertionDetailsKey Caller may describe context-specific data about the
+ * assertion.
+ *
+ *
OPTIONAL: kIOPMAssertionHumanReadableReasonKey Caller may describe the reason for creating the assertion
+ * in a localizable CFString. This should be a human readable phrase that describes the actions the
+ * calling process is taking while the assertion is held, like "Downloading TV episodes", or "Compiling Projects"
+ *
+ *
OPTIONAL: kIOPMAssertionLocalizationBundlePathKey Caller may provide its bundle's path, where OS X
+ * can localize for GUI display the CFString specified by @link kIOPMAssertionHumanReadableReasonKey@/link.
+ *
+ *
OPTIONAL: kIOPMAssertionPlugInIDKey if the caller is a plugin with a different identity than the process
+ * it's loaded in.
+ *
+ *
OPTIONAL: kIOPMAssertionFrameworkIDKey if the caller is a framework acting on behalf of a process.
+ *
+ *