1 /**
2  * \file CheckMacHIDAPI.cpp
3  * \brief C++ source file used by CMake module CheckMacHIDAPI.cmake
4  *
5  * \author
6  * Ryan Pavlik, 2009-2010
7  * <rpavlik@iastate.edu>
8  * http://academic.cleardefinition.com/
9  *
10  * \author
11  * Based on code extracted from VRPN 07.22 for use as a minimal test case
12  *
13  * Attempts to compile a difficult bit of code against the Mac
14  * HID API, as two different types have been required in the callback
15  * function (UInt32 and uint32_t) and testing is the best way to know
16  * which one is correct for a given system.
17  *
18  */
19 
20 
21 #if defined(__APPLE__)
22 
23 #include <stdio.h>
24 #include <IOKit/IOCFPlugIn.h>
25 #include <IOKit/hid/IOHIDLib.h>
26 #include <IOKit/hid/IOHIDKeys.h>
27 #include <CoreFoundation/CoreFoundation.h>
ReaderReportCallback(void * target,IOReturn result,void * refcon,void * sender,MACOSX_HID_UINT32T size)28 void ReaderReportCallback(
29 						  void *target, IOReturn result, void *refcon, void *sender, MACOSX_HID_UINT32T size
30 						  )
31 						  {}
32 #endif
33 
main(int argc,char * argv[])34 int main(int argc, char* argv[]) {
35 #if defined(__APPLE__)
36 	io_object_t _ioObject;
37 	IOHIDDeviceInterface122 **_interface;
38 	unsigned char _buffer[512];
39 	IOReturn result = (*_interface)->setInterruptReportHandlerCallback(_interface,
40 															  _buffer, 512,
41 															  ReaderReportCallback,
42 																	   NULL, 0);
43 #endif
44 	return 0;
45 }
46