Syncronous Interrupt Transfer
Hans Petter Selasky
hselasky at c2i.net
Wed Apr 7 14:45:22 UTC 2010
On Wednesday 07 April 2010 16:06:42 Chris Telting wrote:
> Just learning the USB API.
> Can someone point me to a driver to use as an example of a synchronous
> call? Do
> I need to use a mutex?
Currently only control endpoints have a synchronous API to do requests of any
size. You can pass NULL for mutex, which basically means no mutex will be
dropped during sleeping periods.
BULK/INTERRUPT/ISOCHRONOUS are all asynchronous. However, in user-space,
libusb provides synchronous functions to read and write data.
> I have a device that that does the equivalent of control transfers over
> an interrupt pipe.
> So I need to send data, get status, send more data, get status again,
> and then finally start
> retrieving data; all using interrupt transfers. Been going over the
> drivers in the kernel
> and they are all looking to be doing async or synchronous back through
> user mode.
Probably we could make some convenience wrappers to do synchronous transfers
in the kernel. Else you need to make your own condition variable and sleep on
that until the USB transfer completes or fails.
If you think that a synchronous API for USB in the kernel is generally useful,
send me a patch and I'll commit it. Most drivers only use synchronous control
More information about the freebsd-usb