Hi,
This is a bit of a shameless plug, but if you want an example of a
usb-ethernet driver that does sequences of asychronous I/O, check out the
setState() method in:
http://sourceforge.net/projects/pegasususbmacx/
Basically, I have some state variables and a gigantic switch()
statement that all callbacks make their way back to. If you don't mind
thinking in terms of a finite-state-machine, (I believe) its possible to
create maintainable code that performs sequences of asynchonous IO calls.
-Dan
On Fri, 25 Mar 2005, Steve Bennett wrote:
> Hi!
>
> I'm writing a kext to control a USB->Ethernet chip under Mac OS X.
> Structurally, it's similar to the USBCDCEthernetDriver example in that it's
> derived from IOEthernetController and has the USB device as it's provider.
>
> One of the things I ran into is that while it's possible to make lots of
> synchronous DeviceRequest() calls from within the start() method of my
> driver, I can't make them from within the enable() method, because the
> enable() method is synchronized to the workloop gate, and apparently
> synchronous DeviceRequest() calls result in a deadlock at that point.
>
> I've considered making all my DeviceRequest() calls asynchronous, but there
> are a *lot* of them (potentially over 20, if the device starts out in a
> suspended state...) which need to be made to setup and enable this device,
> and it's making for very messy and hard to maintain code, something I prefer
> to avoid whenever possible. I'd like to find some mechanism which would
> allow me to defer those device requests and make them all synchronously at
> some later point.
>
> As far as I can tell from my research, if I use runAction to defer the
> sequence, then it's still going to block on my DeviceRequest() calls, so
> that isn't a solution. Anyone know of a way to resolve this?
>
> -->Steve Bennett
>
> _______________________________________________
> 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
>
_______________________________________________
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