Hi there,
I am working on a user space application which needs access to a USB device using IOKit API.
The code runs flawlessly since 10.6 through 10.10, but fails on 10.11.
I can search for my device, iterate through the endpoints, set the configuration but if I try to open the interface, I always get an
Exclusive Access error.
interfaceRequest.bInterfaceClass = kIOUSBFindInterfaceDontCare;
interfaceRequest.bInterfaceSubClass = kIOUSBFindInterfaceDontCare;
interfaceRequest.bInterfaceProtocol = kIOUSBFindInterfaceDontCare;
interfaceRequest.bAlternateSetting = kIOUSBFindInterfaceDontCare;
(*usbDevice)->CreateInterfaceIterator(usbDevice,
&interfaceRequest, &iterator);
while ((usbRef = IOIteratorNext(iterator))&&(foundFlag == false))
{
/
IOCreatePlugInInterfaceForService(usbRef,
kIOUSBInterfaceUserClientTypeID,
kIOCFPlugInInterfaceID, &plugin, &score);
IOObjectRelease(usbRef);
/
(*plugin)->QueryInterface(plugin,
CFUUIDGetUUIDBytes(kIOUSBInterfaceInterfaceID),
(LPVOID *)&tempInt);
(*plugin)->Release(plugin);
(*tempInt)->GetInterfaceNumber(tempInt,&if_Number);
(*tempInt)->GetInterfaceClass(tempInt,&if_Class);
(*tempInt)->GetInterfaceSubClass(tempInt,&if_SubClass);
printf ("Opening Interface #%d, class %d, subclass %d\n",if_Number,if_Class,if_SubClass);
kr = (*tempInt)->USBInterfaceOpen(tempInt);
if (kr != kIOReturnSuccess) {
printf ("DarwinUSBComm: Error while opening: (%08x)\n",kr);
return 1;
}See above code, it will always get to line 24. The error code is 0xe00002c5.
Also very strange (and maybe related) the device is using an Atmel based USB chip which identifies itself as PID 0x6124 and VID 0x3eb, device class 0x2, protocol 0x0, sub class 0x0.
Normally OS X will automatically attach the AppleUSBCDC.kext to it and create some serial ports for data transfer. With 10.11 the kext is not loaded. Manually loading the kext does not help, no ports are created.
Any hints what is wrong here?
Regards,
Alexander