In message <email@hidden>, Peter Seebach writ
es:
>But this is apparently snatching reports off a queue that was automatically
>filled by the OS. It looks as though the way to do this is to allocate a
>queue, attach a callback to it, and then tie this into an event loop...
More searching suggests that what I really want is
setInterruptReportHandlerCallback.
So I do that. And nothing ever gets called back.
The documentation for sIRHC says I need to call createAsyncPort and
createAsyncEventSource first. It doesn't say I need to DO anything with
them, and I can find no code examples.
My current code ("m" is a thing containing, most relevantly,
"IOHIDDeviceInterface122 **interface;")
result = (*(m->interface))->open(m->interface, 0);
if (result != kIOReturnSuccess) {
mt_close(m);
fprintf(stderr, "interface open failed\n");
return 0;
}
result = (*(m->interface))->createAsyncPort(m->interface, &port);
if (result != kIOReturnSuccess) {
mt_close(m);
fprintf(stderr, "interface createAsyncPort failed\n");
return 0;
}
result = (*(m->interface))->createAsyncEventSource(m->interface, &eventSource);
if (result != kIOReturnSuccess) {
mt_close(m);
fprintf(stderr, "interface createAsyncEventSource failed\n");
return 0;
}
result = (*(m->interface))->setInterruptReportHandlerCallback(
m->interface, m->buffer, 5, NULL, NULL,
NULL);
if (result != kIOReturnSuccess) {
fprintf(stderr, "set interrupt failed: %x\n", result);
mt_close(m);
return 0;
}
result = (*(m->interface))->startAllQueues(m->interface);
if (result != kIOReturnSuccess) {
fprintf(stderr, "start queues failed: %x\n", result);
mt_close(m);
return 0;
}
So far as I can tell, this should be working. What am I missing? Some sample
programs call "CFRunLoopAddSource", but since I'm not using a CFRunLoop for
anything else... Is it too much to hope there's some easy way to just have my
callback run in the background without much further intervention?
-s
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Usb mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/usb/email@hidden
This email sent to email@hidden