IOHIDValues, Elements, and Transactions

db4
Joe Groff 2008-07-14 19:43:39 -07:00
parent f1b745d76e
commit 136a7a66c3
2 changed files with 164 additions and 20 deletions

View File

@ -1,4 +1,4 @@
USING: iokit alien.syntax alien.c-types kernel system ;
USING: iokit alien.syntax alien.c-types kernel system core-foundation ;
IN: iokit.hid
: kIOHIDDeviceKey "IOHIDDevice" ; inline
@ -68,14 +68,6 @@ IN: iokit.hid
: kIOHIDElementCalibrationDeadZoneMaxKey "CalibrationDeadZoneMax" ; inline
: kIOHIDElementCalibrationGranularityKey "CalibrationGranularity" ; inline
TYPEDEF: ptrdiff_t IOHIDElementCookie
TYPEDEF: int IOHIDElementType
TYPEDEF: int IOHIDElementCollectionType
TYPEDEF: int IOHIDReportType
TYPEDEF: uint IOHIDOptionsType
TYPEDEF: uint IOHIDQueueOptionsType
TYPEDEF: uint IOHIDElementFlags
: kIOHIDElementTypeInput_Misc 1 ; inline
: kIOHIDElementTypeInput_Button 2 ; inline
: kIOHIDElementTypeInput_Axis 3 ; inline
@ -112,3 +104,153 @@ TYPEDEF: uint IOHIDElementFlags
: kIOHIDElementFlagsNullStateMask HEX: 0040 ; inline
: kIOHIDElementFlagsVolativeMask HEX: 0080 ; inline
: kIOHIDElementFlagsBufferedByteMask HEX: 0100 ; inline
: kIOHIDValueScaleTypeCalibrated 0 ; inline
: kIOHIDValueScaleTypePhysical 1 ; inline
: kIOHIDTransactionDirectionTypeInput 0 ; inline
: kIOHIDTransactionDirectionTypeOutput 1 ; inline
: kIOHIDTransactionOptionDefaultOutputValue 1 ; inline
TYPEDEF: ptrdiff_t IOHIDElementCookie
TYPEDEF: int IOHIDElementType
TYPEDEF: int IOHIDElementCollectionType
TYPEDEF: int IOHIDReportType
TYPEDEF: uint IOHIDOptionsType
TYPEDEF: uint IOHIDQueueOptionsType
TYPEDEF: uint IOHIDElementFlags
TYPEDEF: void* IOHIDDeviceRef
TYPEDEF: void* IOHIDElementRef
TYPEDEF: void* IOHIDValueRef
TYPEDEF: void* IOHIDManagerRef
TYPEDEF: void* IOHIDTransactionRef
TYPEDEF: UInt32 IOHIDValueScaleType
TYPEDEF: UInt32 IOHIDTransactionDirectionType
! Callback signature: void IOHIDCallback(void* context, IOReturn result, void* sender);
TYPEDEF: void* IOHIDCallback
! Callback signature: void IOHIDReportCallback(void* context, IOReturn result, void* sender, IOHIDReportType type, UInt32 reportID, uchar * report, CFIndex reportLength);
TYPEDEF: void* IOHIDReportCallback
! Callback signature: void IOHIDValueCallback(void* context, IOReturn result, void* sender, IOHIDValueRef value);
TYPEDEF: void* IOHIDValueCallback
! Callback signature: void IOHIDValueMultipleCallback(void* context, IOReturn result, void* sender, CFDictionaryRef multiple);
TYPEDEF: void* IOHIDValueMultipleCallback
! Callback signature: void IOHIDDeviceCallback(void* context, IOReturn result, void* sender, IOHIDDeviceRef device);
TYPEDEF: void* IOHIDDeviceCallback
! IOHIDDevice
FUNCTION: CFTypeID IOHIDDeviceGetTypeID ( ) ;
FUNCTION: IOHIDDeviceRef IOHIDDeviceCreate ( CFAllocatorRef allocator, io_service_t service ) ;
FUNCTION: IOReturn IOHIDDeviceOpen ( IOHIDDeviceRef device, IOOptionBits options ) ;
FUNCTION: IOReturn IOHIDDeviceClose ( IOHIDDeviceRef device, IOOptionBits options ) ;
FUNCTION: Boolean IOHIDDeviceConformsTo ( IOHIDDeviceRef device, UInt32 usagePage, UInt32 usage ) ;
FUNCTION: CFTypeRef IOHIDDeviceGetProperty ( IOHIDDeviceRef device, CFStringRef key ) ;
FUNCTION: Boolean IOHIDDeviceSetProperty ( IOHIDDeviceRef device, CFStringRef key, CFTypeRef property ) ;
FUNCTION: CFArrayRef IOHIDDeviceCopyMatchingElements ( IOHIDDeviceRef device, CFDictionaryRef matching, IOOptionBits options ) ;
FUNCTION: void IOHIDDeviceScheduleWithRunLoop ( IOHIDDeviceRef device, CFRunLoopRef runLoop, CFStringRef runLoopMode ) ;
FUNCTION: void IOHIDDeviceUnscheduleFromRunLoop ( IOHIDDeviceRef device, CFRunLoopRef runLoop, CFStringRef runLoopMode ) ;
FUNCTION: void IOHIDDeviceRegisterRemovalCallback ( IOHIDDeviceRef device, IOHIDCallback callback, void* context ) ;
FUNCTION: void IOHIDDeviceRegisterInputValueCallback ( IOHIDDeviceRef device, IOHIDValueCallback callback, void* context ) ;
FUNCTION: void IOHIDDeviceRegisterInputReportCallback ( IOHIDDeviceRef device, uchar* report, CFIndex reportLength, IOHIDReportCallback callback, void* context ) ;
FUNCTION: void IOHIDDeviceSetInputValueMatching ( IOHIDDeviceRef device, CFDictionaryRef matching ) ;
FUNCTION: void IOHIDDeviceSetInputValueMatchingMultiple ( IOHIDDeviceRef device, CFArrayRef multiple ) ;
FUNCTION: IOReturn IOHIDDeviceSetValue ( IOHIDDeviceRef device, IOHIDElementRef element, IOHIDValueRef value ) ;
FUNCTION: IOReturn IOHIDDeviceSetValueMultiple ( IOHIDDeviceRef device, CFDictionaryRef multiple ) ;
FUNCTION: IOReturn IOHIDDeviceSetValueWithCallback ( IOHIDDeviceRef device, IOHIDElementRef element, IOHIDValueRef value, CFTimeInterval timeout, IOHIDValueCallback callback, void* context ) ;
FUNCTION: IOReturn IOHIDDeviceSetValueMultipleWithCallback ( IOHIDDeviceRef device, CFDictionaryRef multiple, CFTimeInterval timeout, IOHIDValueMultipleCallback callback, void* context ) ;
FUNCTION: IOReturn IOHIDDeviceGetValue ( IOHIDDeviceRef device, IOHIDElementRef element, IOHIDValueRef* pValue ) ;
FUNCTION: IOReturn IOHIDDeviceCopyValueMultiple ( IOHIDDeviceRef device, CFArrayRef elements, CFDictionaryRef* pMultiple ) ;
FUNCTION: IOReturn IOHIDDeviceGetValueWithCallback ( IOHIDDeviceRef device, IOHIDElementRef element, IOHIDValueRef* pValue, CFTimeInterval timeout, IOHIDValueCallback callback, void* context ) ;
FUNCTION: IOReturn IOHIDDeviceCopyValueMultipleWithCallback ( IOHIDDeviceRef device, CFArrayRef elements, CFDictionaryRef* pMultiple, CFTimeInterval timeout, IOHIDValueMultipleCallback callback, void* context ) ;
FUNCTION: IOReturn IOHIDDeviceSetReport ( IOHIDDeviceRef device, IOHIDReportType reportType, CFIndex reportID, uchar* report, CFIndex reportLength ) ;
FUNCTION: IOReturn IOHIDDeviceSetReportWithCallback ( IOHIDDeviceRef device, IOHIDReportType reportType, CFIndex reportID, uchar* report, CFIndex reportLength, CFTimeInterval timeout, IOHIDReportCallback callback, void* context ) ;
FUNCTION: IOReturn IOHIDDeviceGetReport ( IOHIDDeviceRef device, IOHIDReportType reportType, CFIndex reportID, uchar* report, CFIndex* pReportLength ) ;
FUNCTION: IOReturn IOHIDDeviceGetReportWithCallback ( IOHIDDeviceRef device, IOHIDReportType reportType, CFIndex reportID, uchar* report, CFIndex* pReportLength, CFTimeInterval timeout, IOHIDReportCallback callback, void* context ) ;
! IOHIDManager
FUNCTION: CFTypeID IOHIDManagerGetTypeID ( ) ;
FUNCTION: IOHIDManagerRef IOHIDManagerCreate ( CFAllocatorRef allocator, IOOptionBits options ) ;
FUNCTION: IOReturn IOHIDManagerOpen ( IOHIDManagerRef manager, IOOptionBits options ) ;
FUNCTION: IOReturn IOHIDManagerClose ( IOHIDManagerRef manager, IOOptionBits options ) ;
FUNCTION: CFTypeRef IOHIDManagerGetProperty ( IOHIDManagerRef manager, CFStringRef key ) ;
FUNCTION: Boolean IOHIDManagerSetProperty ( IOHIDManagerRef manager, CFStringRef key, CFTypeRef value ) ;
FUNCTION: void IOHIDManagerScheduleWithRunLoop ( IOHIDManagerRef manager, CFRunLoopRef runLoop, CFStringRef runLoopMode ) ;
FUNCTION: void IOHIDManagerUnscheduleFromRunLoop ( IOHIDManagerRef manager, CFRunLoopRef runLoop, CFStringRef runLoopMode ) ;
FUNCTION: void IOHIDManagerSetDeviceMatching ( IOHIDManagerRef manager, CFDictionaryRef matching ) ;
FUNCTION: void IOHIDManagerSetDeviceMatchingMultiple ( IOHIDManagerRef manager, CFArrayRef multiple ) ;
FUNCTION: CFSetRef IOHIDManagerCopyDevices ( IOHIDManagerRef manager ) ;
FUNCTION: void IOHIDManagerRegisterDeviceMatchingCallback ( IOHIDManagerRef manager, IOHIDDeviceCallback callback, void* context ) ;
FUNCTION: void IOHIDManagerRegisterDeviceRemovalCallback ( IOHIDManagerRef manager, IOHIDDeviceCallback callback, void* context ) ;
FUNCTION: void IOHIDManagerRegisterInputReportCallback ( IOHIDManagerRef manager, IOHIDReportCallback callback, void* context ) ;
FUNCTION: void IOHIDManagerRegisterInputValueCallback ( IOHIDManagerRef manager, IOHIDValueCallback callback, void* context ) ;
FUNCTION: void IOHIDManagerSetInputValueMatching ( IOHIDManagerRef manager, CFDictionaryRef matching ) ;
FUNCTION: void IOHIDManagerSetInputValueMatchingMultiple ( IOHIDManagerRef manager, CFArrayRef multiple ) ;
! IOHIDElement
FUNCTION: CFTypeID IOHIDElementGetTypeID ( ) ;
FUNCTION: IOHIDElementRef IOHIDElementCreateWithDictionary ( CFAllocatorRef allocator, CFDictionaryRef dictionary ) ;
FUNCTION: IOHIDDeviceRef IOHIDElementGetDevice ( IOHIDElementRef element ) ;
FUNCTION: IOHIDElementRef IOHIDElementGetParent ( IOHIDElementRef element ) ;
FUNCTION: CFArrayRef IOHIDElementGetChildren ( IOHIDElementRef element ) ;
FUNCTION: void IOHIDElementAttach ( IOHIDElementRef element, IOHIDElementRef toAttach ) ;
FUNCTION: void IOHIDElementDetach ( IOHIDElementRef element, IOHIDElementRef toDetach ) ;
FUNCTION: CFArrayRef IOHIDElementCopyAttached ( IOHIDElementRef element ) ;
FUNCTION: IOHIDElementCookie IOHIDElementGetCookie ( IOHIDElementRef element ) ;
FUNCTION: IOHIDElementType IOHIDElementGetType ( IOHIDElementRef element ) ;
FUNCTION: IOHIDElementCollectionType IOHIDElementGetCollectionType ( IOHIDElementRef element ) ;
FUNCTION: UInt32 IOHIDElementGetUsagePage ( IOHIDElementRef element ) ;
FUNCTION: UInt32 IOHIDElementGetUsage ( IOHIDElementRef element ) ;
FUNCTION: Boolean IOHIDElementIsVirtual ( IOHIDElementRef element ) ;
FUNCTION: Boolean IOHIDElementIsRelative ( IOHIDElementRef element ) ;
FUNCTION: Boolean IOHIDElementIsWrapping ( IOHIDElementRef element ) ;
FUNCTION: Boolean IOHIDElementIsArray ( IOHIDElementRef element ) ;
FUNCTION: Boolean IOHIDElementIsNonLinear ( IOHIDElementRef element ) ;
FUNCTION: Boolean IOHIDElementHasPreferredState ( IOHIDElementRef element ) ;
FUNCTION: Boolean IOHIDElementHasNullState ( IOHIDElementRef element ) ;
FUNCTION: CFStringRef IOHIDElementGetName ( IOHIDElementRef element ) ;
FUNCTION: UInt32 IOHIDElementGetReportID ( IOHIDElementRef element ) ;
FUNCTION: UInt32 IOHIDElementGetReportSize ( IOHIDElementRef element ) ;
FUNCTION: UInt32 IOHIDElementGetReportCount ( IOHIDElementRef element ) ;
FUNCTION: UInt32 IOHIDElementGetUnit ( IOHIDElementRef element ) ;
FUNCTION: UInt32 IOHIDElementGetUnitExponent ( IOHIDElementRef element ) ;
FUNCTION: CFIndex IOHIDElementGetLogicalMin ( IOHIDElementRef element ) ;
FUNCTION: CFIndex IOHIDElementGetLogicalMax ( IOHIDElementRef element ) ;
FUNCTION: CFIndex IOHIDElementGetPhysicalMin ( IOHIDElementRef element ) ;
FUNCTION: CFIndex IOHIDElementGetPhysicalMax ( IOHIDElementRef element ) ;
FUNCTION: CFTypeRef IOHIDElementGetProperty ( IOHIDElementRef element, CFStringRef key ) ;
FUNCTION: Boolean IOHIDElementSetProperty ( IOHIDElementRef element, CFStringRef key, CFTypeRef property ) ;
! IOHIDValue
FUNCTION: CFTypeID IOHIDValueGetTypeID ( ) ;
FUNCTION: IOHIDValueRef IOHIDValueCreateWithIntegerValue ( CFAllocatorRef allocator, IOHIDElementRef element, ulonglong timeStamp, CFIndex value ) ;
FUNCTION: IOHIDValueRef IOHIDValueCreateWithBytes ( CFAllocatorRef allocator, IOHIDElementRef element, ulonglong timeStamp, uchar* bytes, CFIndex length ) ;
FUNCTION: IOHIDValueRef IOHIDValueCreateWithBytesNoCopy ( CFAllocatorRef allocator, IOHIDElementRef element, ulonglong timeStamp, uchar* bytes, CFIndex length ) ;
FUNCTION: IOHIDElementRef IOHIDValueGetElement ( IOHIDValueRef value ) ;
FUNCTION: ulonglong IOHIDValueGetTimeStamp ( IOHIDValueRef value ) ;
FUNCTION: CFIndex IOHIDValueGetLength ( IOHIDValueRef value ) ;
FUNCTION: uchar* IOHIDValueGetBytePtr ( IOHIDValueRef value ) ;
FUNCTION: CFIndex IOHIDValueGetIntegerValue ( IOHIDValueRef value ) ;
FUNCTION: double IOHIDValueGetScaledValue ( IOHIDValueRef value, IOHIDValueScaleType type ) ;
! IOHIDTransaction
FUNCTION: CFTypeID IOHIDTransactionGetTypeID ( ) ;
FUNCTION: IOHIDTransactionRef IOHIDTransactionCreate ( CFAllocatorRef allocator, IOHIDDeviceRef device, IOHIDTransactionDirectionType direction, IOOptionBits options ) ;
FUNCTION: IOHIDDeviceRef IOHIDTransactionGetDevice ( IOHIDTransactionRef transaction ) ;
FUNCTION: IOHIDTransactionDirectionType IOHIDTransactionGetDirection ( IOHIDTransactionRef transaction ) ;
FUNCTION: void IOHIDTransactionSetDirection ( IOHIDTransactionRef transaction, IOHIDTransactionDirectionType direction ) ;
FUNCTION: void IOHIDTransactionAddElement ( IOHIDTransactionRef transaction, IOHIDElementRef element ) ;
FUNCTION: void IOHIDTransactionRemoveElement ( IOHIDTransactionRef transaction, IOHIDElementRef element ) ;
FUNCTION: Boolean IOHIDTransactionContainsElement ( IOHIDTransactionRef transaction, IOHIDElementRef element ) ;
FUNCTION: void IOHIDTransactionScheduleWithRunLoop ( IOHIDTransactionRef transaction, CFRunLoopRef runLoop, CFStringRef runLoopMode ) ;
FUNCTION: void IOHIDTransactionUnscheduleFromRunLoop ( IOHIDTransactionRef transaction, CFRunLoopRef runLoop, CFStringRef runLoopMode ) ;
FUNCTION: void IOHIDTransactionSetValue ( IOHIDTransactionRef transaction, IOHIDElementRef element, IOHIDValueRef value, IOOptionBits options ) ;
FUNCTION: IOHIDValueRef IOHIDTransactionGetValue ( IOHIDTransactionRef transaction, IOHIDElementRef element, IOOptionBits options ) ;
FUNCTION: IOReturn IOHIDTransactionCommit ( IOHIDTransactionRef transaction ) ;
FUNCTION: IOReturn IOHIDTransactionCommitWithCallback ( IOHIDTransactionRef transaction, CFTimeInterval timeout, IOHIDCallback callback, void* context ) ;
FUNCTION: void IOHIDTransactionClear ( IOHIDTransactionRef transaction ) ;

View File

@ -1,4 +1,4 @@
USING: alien.syntax alien.c-types cocoa core-foundation system
USING: alien.syntax alien.c-types core-foundation system
combinators kernel sequences debugger io accessors ;
IN: iokit
@ -103,34 +103,36 @@ TYPEDEF: int boolean_t
TYPEDEF: mach_port_t io_object_t
TYPEDEF: io_object_t io_iterator_t
TYPEDEF: io_object_t io_registry_entry_t
TYPEDEF: io_object_t io_service_t
TYPEDEF: char[128] io_name_t
TYPEDEF: char[512] io_string_t
TYPEDEF: kern_return_t IOReturn
TYPEDEF: uint IOOptionBits
: MACH_PORT_NULL 0 ; inline
: KERN_SUCCESS 0 ; inline
FUNCTION: kern_return_t IOMasterPort ( mach_port_t bootstrap, mach_port_t* master ) ;
FUNCTION: IOReturn IOMasterPort ( mach_port_t bootstrap, mach_port_t* master ) ;
FUNCTION: NSDictionary* IOServiceMatching ( char* name ) ;
FUNCTION: NSDictionary* IOServiceNameMatching ( char* name ) ;
FUNCTION: NSDictionary* IOBSDNameMatching ( char* name ) ;
FUNCTION: CFDictionaryRef IOServiceMatching ( char* name ) ;
FUNCTION: CFDictionaryRef IOServiceNameMatching ( char* name ) ;
FUNCTION: CFDictionaryRef IOBSDNameMatching ( char* name ) ;
FUNCTION: kern_return_t IOObjectRetain ( io_object_t o ) ;
FUNCTION: kern_return_t IOObjectRelease ( io_object_t o ) ;
FUNCTION: IOReturn IOObjectRetain ( io_object_t o ) ;
FUNCTION: IOReturn IOObjectRelease ( io_object_t o ) ;
FUNCTION: kern_return_t IOServiceGetMatchingServices ( mach_port_t master, NSDictionary* matchingDict, io_iterator_t* iterator ) ;
FUNCTION: IOReturn IOServiceGetMatchingServices ( mach_port_t master, CFDictionaryRef matchingDict, io_iterator_t* iterator ) ;
FUNCTION: io_object_t IOIteratorNext ( io_iterator_t i ) ;
FUNCTION: void IOIteratorReset ( io_iterator_t i ) ;
FUNCTION: boolean_t IOIteratorIsValid ( io_iterator_t i ) ;
FUNCTION: kern_return_t IORegistryEntryGetPath ( io_registry_entry_t entry, io_name_t plane, io_string_t path ) ;
FUNCTION: IOReturn IORegistryEntryGetPath ( io_registry_entry_t entry, io_name_t plane, io_string_t path ) ;
FUNCTION: kern_return_t IORegistryEntryCreateCFProperties ( io_registry_entry_t entry, NSMutableDictionary** properties, CFAllocatorRef allocator, IOOptionBits options ) ;
FUNCTION: IOReturn IORegistryEntryCreateCFProperties ( io_registry_entry_t entry, CFMutableDictionaryRef properties, CFAllocatorRef allocator, IOOptionBits options ) ;
FUNCTION: char* mach_error_string ( kern_return_t error ) ;
FUNCTION: char* mach_error_string ( IOReturn error ) ;
TUPLE: mach-error error-code ;
C: <mach-error> mach-error