Hi all,
I'm trying to make a little application, which partly needs to be able to 'monitor' the USB interfaces.
No communication or other, just only monitor if something is connected, and disconnected.
I ended up with this:
This is working, except for iDevices (iPhones etc.)
I have also tried other examples using filters based on vendor id etc. but still iPhones etc are not being detected.
Does anyone have an idea ?
I'm trying to make a little application, which partly needs to be able to 'monitor' the USB interfaces.
No communication or other, just only monitor if something is connected, and disconnected.
I ended up with this:
Code:
IOHIDManagerRef HIDManager = IOHIDManagerCreate(kCFAllocatorDefault, kIOHIDOptionsTypeSeizeDevice);
IOHIDManagerSetDeviceMatching(HIDManager, NULL);
IOHIDManagerRegisterDeviceMatchingCallback(HIDManager, &Handle_DeviceMatchingCallback, NULL);
IOHIDManagerRegisterDeviceRemovalCallback(HIDManager, &Handle_DeviceRemovalCallback, NULL);
IOHIDManagerScheduleWithRunLoop(HIDManager, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode);
IOReturn IOReturn = IOHIDManagerOpen(HIDManager, kIOHIDOptionsTypeNone);
if(IOReturn) puts("IOHIDManagerOpen failed.");
This is working, except for iDevices (iPhones etc.)
I have also tried other examples using filters based on vendor id etc. but still iPhones etc are not being detected.
Does anyone have an idea ?