IOUSBHostPipe AsynIO transfer size

I am working on a DriverKit system extension that handles some kind of USB Ethernet adapter.

I'm trying to receive data from a Bulk endpoint. Each USB transfer should be up to 512kB, but the actual size of the transfer is not known in advance.

What I do is the following:

  • Allocate an IOBufferMemoryDescriptor with IOUSBHostInterface::CreateIOBuffer:

ret = ivars->interface->CreateIOBuffer(kIOMemoryDirectionIn, 524288, &b->buffer);

  • Create an OSAction to be used as transfer complete callback:

ret = CreateActionReadComplete(0, &b->action);

  • Start the I/O request:

ret = ivars->pipe->AsyncIO(b->buffer, 524288, b->action, 0);

At that point, I see that instead of starting a single 524288 bytes transfer, it starts 14 36864 bytes transfers and a 8192 bytes one. Which will absolutely not work with the USB device. Is there a transfer size limit I am not aware of?

IOUSBHostPipe AsynIO transfer size
 
 
Q