DriverKit IOUSBHostInterface iterator always empty

I'm trying to iterate through a USB device but the iterator is always empty or contains only the matched interface:

Single interface in Iterator
This happens when my driver matches against the interface. Because I need to use 2 interfaces (control and cdc), I try to open the IOUSBHostDevice (copied from the interface) and iterate through the rest, but I only get the interface my dext matched with.

Empty Iterator
I decided to match against USB communication devices, thinking things would be different. However, this time the interface iterator is completely empty (provider is IOUSBHostDevice).

Here's a snippet of my code before iterating with IOUSBHostDevice->CopyInterface():

// teardown the configured interfaces.
result = device->SetConfiguration(ivars->Config, true);
__Require_noErr_Action(result, _failure_Out,
ELOG("IOUSBHostDevice::SetConfiguration failed 0x%x", result));
// open usb device
result = device->Open(this, 0, 0);
__Require_noErr_Action(result, _failure_Out,
ELOG("Failed to open IOUSBHostDevice"));
// Get interface iterator
result = device->CreateInterfaceIterator(&iterRef);
__Require_noErr_Action(result, _failure_Out,
ELOG("IOUSBHostDevice::CreateInterfaceIterator failed failed: 0x%x", result));

This happens when my driver matches against the interface. Because I need to use 2 interfaces (control and cdc), I try to open the IOUSBHostDevice (copied from the interface) and iterate through the rest, but I only get the interface my dext matched with.

I believe you could make this work by matching against both interfaces (using two matching dictionaries) and including "IOUserServerOneProcess" so that the two interface services are run in the same process.

I decided to match against USB communication devices, thinking things would be different. However, this time the interface iterator is completely empty (provider is IOUSBHostDevice).

What CreateInterfaceIterator actually does is return the child interface objects (the same objects you matched against above), so if you haven't gotten far enough into the initialization process, you'll get "NULL" because they don't yet exist.

__
Kevin Elliott
DTS Engineer, CoreOS/Hardware

DriverKit IOUSBHostInterface iterator always empty
 
 
Q