First version of streaming transfers.

This commit is contained in:
Sebastian Zagrodzki
2017-04-23 10:45:04 +02:00
parent d92ea14c33
commit b50bc8761f
8 changed files with 345 additions and 12 deletions

View File

@@ -33,7 +33,7 @@ type usbTransfer struct {
// done is blocking until the transfer is complete and data and transfer
// status are available.
done chan struct{}
// submitted is true if this transfer was passed to libusb through submit()
// submitted is true if submit() was called on this transfer.
submitted bool
}
@@ -110,6 +110,11 @@ func (t *usbTransfer) free() error {
return nil
}
// data returns the slice containing transfer buffer.
func (t *usbTransfer) data() []byte {
return t.buf
}
// newUSBTransfer allocates a new transfer structure for communication with a
// given device/endpoint, with buf as the underlying transfer buffer.
func newUSBTransfer(dev *libusbDevHandle, ei *EndpointInfo, buf []byte, timeout time.Duration) (*usbTransfer, error) {