Libpointing
An open-source cross-platform library to get raw events from pointing devices and master transfer functions.
osxHIDUtils.h
1 /* -*- mode: c++ -*-
2  *
3  * pointing/input/osx/osxHIDUtils.h --
4  *
5  * Initial software
6  * Authors: Nicolas Roussel
7  * Copyright © Inria
8  *
9  * http://libpointing.org/
10  *
11  * This software may be used and distributed according to the terms of
12  * the GNU General Public License version 2 or any later version.
13  *
14  */
15 
16 #ifndef osxHIDUtils_h
17 #define osxHIDUtils_h
18 
19 #include <pointing/utils/URI.h>
20 
21 #include <IOKit/hid/IOHIDDevice.h>
22 #include <IOKit/hid/IOHIDValue.h>
23 #include <IOKit/usb/IOUSBLib.h>
24 
25 #include <iostream>
26 #include <string>
27 
28 namespace pointing {
29 
30  int32_t hidDeviceGetIntProperty(IOHIDDeviceRef device, CFStringRef prop, int32_t defval=0) ;
31 
32  std::string hidDeviceGetStringProperty(IOHIDDeviceRef device, CFStringRef prop, std::string defval="") ;
33 
34  URI hidDeviceURI(IOHIDDeviceRef device) ;
35 
36  std::string hidDeviceName(IOHIDDeviceRef device);
37 
38  void hidDebugDevice(IOHIDDeviceRef device, std::ostream& out) ;
39 
40  void hidDebugValue(IOHIDValueRef hidvalue, std::ostream& out) ;
41 
42  io_service_t hidGetParentService(IOHIDDeviceRef device, io_name_t classname) ;
43  io_service_t hidGetParentService(io_service_t service, io_name_t classname) ;
44 
45  // Return -1 if resolution is unknown
46  SInt32 hidGetPointingResolution(IOHIDDeviceRef device) ;
47  SInt32 hidGetPointingResolution(io_service_t service) ;
48 
49  // Result is in seconds (-1 if interval is unknown)
50  double hidGetReportInterval(IOHIDDeviceRef device) ;
51 
52  IOUSBInterfaceInterface190 **getUSBInterface(io_service_t hiddriver, int usbclass, int usbsubclass, int endpoints) ;
53 
54  std::string hidDeviceFromVendorProductUsagePageUsage(int vendorID, int productID,
55  int primaryUsagePage, int primaryUsage) ;
56  std::string hidAnyPointingDevice(void) ;
57  std::string hidXYElements(void) ;
58 
59  uint64_t AbsoluteTimeInNanoseconds(uint64_t tAbs) ;
60 
61 }
62 
63 #endif
Definition: DummyPointingDevice.cpp:23