I have a hid device , because its class is 0x03. I use HIDManager and IOServiceMatching(kIOHIDDeviceKey), both can't find device, whether the kernel don't have matching driver, and I must write a hid device driver?
Main code:
method 1:
IOHIDManagerRef mgr;
mgr = IOHIDManagerCreate(kCFAllocatorDefault, kIOHIDOptionsTypeNone);
IOHIDManagerSetDeviceDeviceMatching(mgr, NULL);
IOHIDManagerOpen(mgr, kIOHIDOptionsTypeNone);
CFSetRef device_set = IOHIDManagerCopyDevices(mgr);
CFIndex num_devices = CFSetGetCount(device_set);
....
method 2:
io_iterator_t hidObjectIterator;
CFMutableDictionaryRef hidMatchingDict= IOServiceMatching(kIOHIDDeviceKey);
//add my device pid and vid to hidMatchingDict
.....
IOServiceGetMatchingServices(,,hidObjectIterator);
io_object_t hidDevice;
while(hidDevice = IOIteratorNext(hidObjectIterator))
{...}
As a result, hidDevice = 0;
Main code:
method 1:
IOHIDManagerRef mgr;
mgr = IOHIDManagerCreate(kCFAllocatorDefault, kIOHIDOptionsTypeNone);
IOHIDManagerSetDeviceDeviceMatching(mgr, NULL);
IOHIDManagerOpen(mgr, kIOHIDOptionsTypeNone);
CFSetRef device_set = IOHIDManagerCopyDevices(mgr);
CFIndex num_devices = CFSetGetCount(device_set);
....
method 2:
io_iterator_t hidObjectIterator;
CFMutableDictionaryRef hidMatchingDict= IOServiceMatching(kIOHIDDeviceKey);
//add my device pid and vid to hidMatchingDict
.....
IOServiceGetMatchingServices(,,hidObjectIterator);
io_object_t hidDevice;
while(hidDevice = IOIteratorNext(hidObjectIterator))
{...}
As a result, hidDevice = 0;