I'm not sure if this is properly Cocoa or Carbon. It lives in IOUSBLib.h if 
there's a better place to ask this, let me know.

I'm trying to (re-)write a program that uses USB controlled scanners. I've got 
my USBIOInterfaceInterface set up, so I can send and receive messages over the 
pipes. I am successfully calling WritePipeTO and ReadPipeTO synchronously but I 
want to read from the scanner asynchronously.

I've tried using ReadPipeAsyncTO, but the callback never gets called until the 
call timesout. The reason Appears to be that I'm not registering the callback 
somewhere. If I add a CFRunLoopRun after the async read, then it appears to 
work, but only by having many nested calls to CFRunLoopRun, which can't be a 
good idea.

I've seen the functions:

    err = 
(*usbInterfaceInterface)->CreateInterfaceAsyncEventSource(usbInterfaceInterface,
 &cfSource);
    CFRunLoopAddSource(CFRunLoopGetCurrent(), cfSource, kCFRunLoopDefaultMode);
but I haven't figured out how to tell the Source what callback should be called 
when something happens on that interface. When I just create the source, and 
call the ReadPipeAsyncTO, the callback doesn't get called until timeout.

Is there same sample code somewhere so I can see how these functions are 
SUPPOSED to work together?


Brian Postow
Senior Software Engineer
Acordex Imaging Systems

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to