Home | History | Annotate | Download | only in libusb

Lines Matching refs:transfer

36 static void LIBUSB_CALL sync_transfer_cb(struct libusb_transfer *transfer)
38 int *completed = transfer->user_data;
40 usbi_dbg("actual_length=%d", transfer->actual_length);
41 /* caller interprets result and frees transfer */
44 static void sync_transfer_wait_for_completion(struct libusb_transfer *transfer)
46 int r, *completed = transfer->user_data;
47 struct libusb_context *ctx = HANDLE_CTX(transfer->dev_handle);
54 usbi_err(ctx, "libusb_handle_events failed: %s, cancelling transfer and retrying",
56 libusb_cancel_transfer(transfer);
63 * Perform a USB control transfer.
65 * The direction of the transfer is inferred from the bmRequestType field of
84 * \returns LIBUSB_ERROR_TIMEOUT if the transfer timed out
94 struct libusb_transfer *transfer = libusb_alloc_transfer(0);
99 if (!transfer)
104 libusb_free_transfer(transfer);
113 libusb_fill_control_transfer(transfer, dev_handle, buffer,
115 transfer->flags = LIBUSB_TRANSFER_FREE_BUFFER;
116 r = libusb_submit_transfer(transfer);
118 libusb_free_transfer(transfer);
122 sync_transfer_wait_for_completion(transfer);
125 memcpy(data, libusb_control_transfer_get_data(transfer),
126 transfer->actual_length);
128 switch (transfer->status) {
130 r = transfer->actual_length;
150 "unrecognised status code %d", transfer->status);
154 libusb_free_transfer(transfer);
162 struct libusb_transfer *transfer = libusb_alloc_transfer(0);
166 if (!transfer)
169 libusb_fill_bulk_transfer(transfer, dev_handle, endpoint, buffer, length,
171 transfer->type = type;
173 r = libusb_submit_transfer(transfer);
175 libusb_free_transfer(transfer);
179 sync_transfer_wait_for_completion(transfer);
181 *transferred = transfer->actual_length;
182 switch (transfer->status) {
204 "unrecognised status code %d", transfer->status);
208 libusb_free_transfer(transfer);
213 * Perform a USB bulk transfer. The direction of the transfer is inferred from
225 * libusbx may have to split your transfer into a number of chunks to satisfy
244 * \returns LIBUSB_ERROR_TIMEOUT if the transfer timed out (and populates
261 * Perform a USB interrupt transfer. The direction of the transfer is inferred
273 * libusbx may have to split your transfer into a number of chunks to satisfy
294 * \returns LIBUSB_ERROR_TIMEOUT if the transfer timed out