tech-kern archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
asynchronous ugen(4) bulk transfers
There appears to be no reliable way to do asynchronous ugen(4) bulk
transfers without just deferring each one to a thread.
- There is no specific operation to submit a transfer without waiting
for it to complete:
. You can do read/write, which may wait for it to complete if
there's not enough read-ahead/write-back buffer.
. You can poll for whether there is enough, but that doesn't
actually submit the transfer.
- There is no way to reliably resize the read-ahead/write-back buffer
without losing data:
. You can do USB_SET_BULK_RA/WB_OPT do set the buffer size.
However, that doesn't take effect until you next enable RA/WB.
. Enabling RA/WB has no effect if RA/WB is already enabled.
. Disabling RA/WB and re-enabling it discards any queued data.
Am I missing something?
I think the same applies to transfers other than bulk transfers, but
I'm concerned mainly with bulk transfers at the moment, to get the
Android adb tool working via libusb1: libusb1 assumes that submitting
a transfer is an asynchronous operation and does it under a lock.
Specifically, adb asks libusb1 to submit a read in one thread, and
then a write to the same endpoint in another thread. The device won't
return data to the read until after the write has completed. However,
the write can't actually be submitted until the read has completed:
the NetBSD code to submit transfers in libusb1 also waits for
completion, and the lock inside libusb1 prevents the write from being
submitted until after the read has been submitted.
As far as I can tell the only way around this is for libusb1 to queue
those transfers to be issued in separate threads of its own.
Home |
Main Index |
Thread Index |
Old Index