Initialise the link
| 26 | |
| 27 | // Initialise the link |
| 28 | bool Device_Initialise(DeviceLink *link,io_object_t device) |
| 29 | { |
| 30 | IOCFPlugInInterface **plugInInterface = NULL; |
| 31 | SInt32 score = 0; |
| 32 | IOReturn ret = IOCreatePlugInInterfaceForService(device, kIOHIDDeviceUserClientTypeID, kIOCFPlugInInterfaceID, &plugInInterface, &score); |
| 33 | |
| 34 | if (ret!=kIOReturnSuccess) return false; |
| 35 | ret=(*plugInInterface)->QueryInterface(plugInInterface, CFUUIDGetUUIDBytes(kIOHIDDeviceInterfaceID121), (LPVOID*)(&link->interface)); |
| 36 | (*plugInInterface)->Release(plugInInterface); |
| 37 | if (ret!=kIOReturnSuccess) return false; |
| 38 | (*link->interface)->open(link->interface, 0); |
| 39 | return true; |
| 40 | } |
| 41 | |
| 42 | // Finish the link |
| 43 | void Device_Finalise(DeviceLink *link) |
no test coverage detected