I'm using DriverKit in iPadOS.
I've got a call to read data synchronously, which is working fine.
So I'm trying to do the asynchronous one.
For this I'm calling IOConnectCallAsyncStructMethod
with
ret = IOConnectCallAsyncStructMethod(connection, MessageType_AsyncReadRequest, callback_port, asynRequestRef, kIOAsyncCalloutCount, nullptr, 0, output, &outputSizeT);
Where:
arraySize = 248
uint64_t output[arraySize] = {};
size_t outputSizeT = sizeof(uint64_t) * arraySize;
When I got the data from the USB device, I return it with AsyncCompletion
With:
uint64_t *read // This will contain the data from the device
const uint32_t size = 32;
uint64_t asyncData[size] = { };
memcpy(asyncData, read, (sizeof(uint64_t) * size));
AsyncCompletion(ivars->readSampleCallbackAction, kIOReturnSuccess, asyncData, size);
ivars->readSampleCallbackAction->release();
My problem is when the call of IOConnectCallAsyncStructMethod
returns. ret
would be 0 as successful but output
won't contain the data.
I know there is data in asyncData
because if I inspect the variable in debug mode I can see the data I expect.
Any ideas?
Thanks