Lines Matching refs:transfer
118 libusb_transfer* transfer = nullptr; member
125 libusb_transfer* transfer; member
145 libusb_free_transfer(read_block->transfer); in Cleanup()
147 read_block->transfer = nullptr; in Cleanup()
155 CHECK(read_block->transfer); in MaybeCleanup()
165 static void LIBUSB_CALL header_read_cb(libusb_transfer* transfer) { in header_read_cb()
166 auto read_block = static_cast<ReadBlock*>(transfer->user_data); in header_read_cb()
175 if (transfer->status != LIBUSB_TRANSFER_COMPLETED) { in header_read_cb()
176 std::string msg = StringPrintf("usb read failed: status = %d", transfer->status); in header_read_cb()
185 if (transfer->actual_length != sizeof(amessage)) { in header_read_cb()
187 transfer->actual_length); in header_read_cb()
196 memcpy(&amsg, transfer->buffer, sizeof(amsg)); in header_read_cb()
215 static void LIBUSB_CALL payload_read_cb(libusb_transfer* transfer) { in payload_read_cb()
216 auto read_block = static_cast<ReadBlock*>(transfer->user_data); in payload_read_cb()
224 if (transfer->status != LIBUSB_TRANSFER_COMPLETED) { in payload_read_cb()
225 std::string msg = StringPrintf("usb read failed: status = %d", transfer->status); in payload_read_cb()
234 if (transfer->actual_length != transfer->length) { in payload_read_cb()
237 transfer->length, transfer->actual_length); in payload_read_cb()
252 static void LIBUSB_CALL write_cb(libusb_transfer* transfer) { in write_cb()
253 auto write_block = static_cast<WriteBlock*>(transfer->user_data); in write_cb()
256 bool succeeded = transfer->status == LIBUSB_TRANSFER_COMPLETED; in write_cb()
260 libusb_free_transfer(transfer); in write_cb()
280 read->transfer = libusb_alloc_transfer(0); in CreateRead()
281 if (!read->transfer) { in CreateRead()
284 libusb_fill_bulk_transfer(read->transfer, device_handle_.get(), read_endpoint_, nullptr, 0, in CreateRead()
290 read->transfer->buffer = reinterpret_cast<unsigned char*>(read->block.data()); in SubmitRead()
291 read->transfer->length = length; in SubmitRead()
293 int rc = libusb_submit_transfer(read->transfer); in SubmitRead()
306 write->transfer = libusb_alloc_transfer(0); in SubmitWrite()
307 if (!write->transfer) { in SubmitWrite()
311 libusb_fill_bulk_transfer(write->transfer, device_handle_.get(), write_endpoint_, in SubmitWrite()
314 int rc = libusb_submit_transfer(write->transfer); in SubmitWrite()
319 libusb_free_transfer(write->transfer); in SubmitWrite()
648 if (!read_block->transfer) { in CancelReadTransfer()
658 int rc = libusb_cancel_transfer(read_block->transfer); in CancelReadTransfer()
691 int rc = libusb_cancel_transfer(write_block->transfer); in CloseDevice()
697 libusb_free_transfer(write_block->transfer); in CloseDevice()