IOHIDEventSystem.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. /*
  2. IOHIDEventSystem.h ... I/O Kit HID Event System
  3. Copyright (c) 2010 KennyTM~ <kennytm@gmail.com>
  4. All rights reserved.
  5. Redistribution and use in source and binary forms, with or without modification,
  6. are permitted provided that the following conditions are met:
  7. * Redistributions of source code must retain the above copyright notice, this
  8. list of conditions and the following disclaimer.
  9. * Redistributions in binary form must reproduce the above copyright notice,
  10. this list of conditions and the following disclaimer in the documentation
  11. and/or other materials provided with the distribution.
  12. * Neither the name of the KennyTM~ nor the names of its contributors may be
  13. used to endorse or promote products derived from this software without
  14. specific prior written permission.
  15. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  16. ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  17. WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  18. DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
  19. ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  20. (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  21. LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
  22. ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  23. (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  24. SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  25. */
  26. // With reference to http://www.opensource.apple.com/source/IOHIDFamily/IOHIDFamily-258.1/IOHIDLib/IOHIDEventServiceClass.h
  27. #ifndef IOHID_EVENT_SYSTEM_H
  28. #define IOHID_EVENT_SYSTEM_H
  29. #include <CoreFoundation/CoreFoundation.h>
  30. #include "IOHIDNotification.h"
  31. #include "IOHIDService.h"
  32. #include "IOHIDEvent.h"
  33. #include "IOHIDEventQueue.h"
  34. #if __cplusplus
  35. extern "C" {
  36. #endif
  37. typedef struct ___IOHIDEventSystem
  38. #if 0
  39. {
  40. CFRuntimeBase _base; // 0, 4
  41. CFMutableSetRef services; // 8
  42. CFMutableSetRef x0c; // c
  43. CFMutableSetRef x10; // 10
  44. CFMutableSetRef matchNotifications; // 14
  45. IONotificationPortRef serviceMatchPort; // 18
  46. IONotificationPortRef x1c; // 1c
  47. void* x20; // 20
  48. IOHIDEventSystemCallback callback; // 24
  49. IOHIDSessionRef session; // 28
  50. pthread_mutex_t mutex; // 2c
  51. CFRunLoopSourceRef migMachSource; // 58
  52. CFMutableSetRef queues; // 5c
  53. }
  54. #endif
  55. * IOHIDEventSystemRef;
  56. typedef void(*IOHIDEventSystemCallback)(void* target, void* refcon, IOHIDServiceRef service, IOHIDEventRef event);
  57. CFTypeID IOHIDEventSystemGetTypeID(void);
  58. IOHIDEventSystemRef IOHIDEventSystemCreate(CFAllocatorRef allocator);
  59. CFArrayRef IOHIDEventSystemCopyMatchingServices(IOHIDEventSystemRef system, CFDictionaryRef propertyTable,
  60. IOHIDNotificationCallback matchCallback, void* matchTarget, void* matchRefcon, IOHIDNotificationRef* matchNotif);
  61. void IOHIDEventSystemRegisterQueue(IOHIDEventSystemRef system, IOHIDEventQueueRef queue);
  62. void IOHIDEventSystemUnregisterQueue(IOHIDEventSystemRef system, IOHIDEventQueueRef queue);
  63. IOHIDEventRef IOHIDEventSystemCopyEvent(IOHIDEventSystemRef system, IOHIDEventType type, IOHIDEventRef event, IOOptionBits options);
  64. CFTypeRef IOHIDEventSystemGetProperty(IOHIDEventSystemRef system, CFStringRef property);
  65. Boolean IOHIDEventSystemSetProperty(IOHIDEventSystemRef system, CFStringRef property, CFTypeRef value);
  66. Boolean IOHIDEventSystemOpen(IOHIDEventSystemRef system, IOHIDEventSystemCallback callback, void* target, void* refcon, void* unused);
  67. void IOHIDEventSystemClose(IOHIDEventSystemRef system, void* unused);
  68. #if 0
  69. dlfun("IOHIDEventSystemGetTypeID", "I");
  70. dlfun("IOHIDEventSystemCreate", "@@");
  71. dlfun("IOHIDEventSystemCopyMatchingServices", "@@^v^v^v^@");
  72. dlfun("IOHIDEventSystemRegisterQueue", "v@@");
  73. dlfun("IOHIDEventSystemUnregisterQueue", "v@@");
  74. dlfun("IOHIDEventSystemCopyEvent", "@@I@I");
  75. dlfun("IOHIDEventSystemGetProperty", "@@@");
  76. dlfun("IOHIDEventSystemSetProperty", "c@@@");
  77. dlfun("IOHIDEventSystemOpen", "c@^v^v^v^v");
  78. dlfun("IOHIDEventSystemClose", "v@^v");
  79. #endif
  80. #if __cplusplus
  81. }
  82. #endif
  83. #endif