Hi Tomas,
>>What I haven't figured out is, how do you pass function pointers
>>in the driver out to an application?
>
>Mac OS 9 drivers are CFM Fragments. Apps use USBGetNextDeviceByClass
>(USB.h) to find the proper device and get USBDeviceRef and your code
>fragment connection id. They then use FindSymbol API
>(CodeFragments.h) to get TheUSBDriverDescription (you're required to
>export this symbol) and TheUSBClassDriverPluginDispatchTable (you're
>required to export this as well).
>
Thanks! I put my own dispatch table in the driver, added its name to
the USBClassDriver.exp file in the project, and USBGetNextDeviceByClass()
and FindSymbol() enabled me to call a driver function from an application.
There were a few glitches,
1) The examples in the DDK documentation incorrectly had only four
arguments supplied to USBGetNextDeviceByClass(), and
2) I had to use the wildcards kUSBAnyClass and kUSBAnySubClass
(a.k.a FFFF) to get my device to appear, the vendor-specific selectors
wouldn't work.
The extra argument in USBGetNextDeviceByClass() is a pointer to the
USBDeviceRef, which correctly gets filled in when my device gets plugged in.
This got me thinking, why can't I just pass this out and call
USBDeviceRequest() from the application? This would save a reboot
cycle every time the code gets changed. There's probably some trouble
I can get into, I'll find out soon enough, but I'd appreciate any advice.
rob
_______________________________________________
usb mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/usb
Do not post admin requests to the list. They will be ignored.