12 std::shared_ptr<handle_libusb>
handle)
13 : _device(device), _handle(handle)
25 int ep = endpoint->get_address();
26 auto sts = libusb_clear_halt(
_handle->get(), ep);
30 LOG_WARNING(
"reset_endpoint returned error, index: " << ep <<
", error: " << strerr <<
", number: " <<
int(errno));
42 LOG_WARNING(
"control_transfer returned error, index: " << index <<
", error: " << strerr <<
", number: " <<
int(errno));
51 int actual_length = 0;
54 sts = libusb_bulk_transfer(
_handle->get(), endpoint->get_address(),
buffer,
length, &actual_length, timeout_ms);
56 sts = libusb_interrupt_transfer(
_handle->get(), endpoint->get_address(),
buffer,
length, &actual_length, timeout_ms);
58 LOG_ERROR(
"Invalid transfer type " << endpoint->get_type() <<
" on endpoint " << endpoint->get_address());
65 LOG_WARNING(
"bulk_transfer returned error, endpoint: 0x" << std::hex <<
int(endpoint->get_address()) << std::dec
66 <<
", error: " << strerr <<
", err. num: " <<
int(errno));
69 transferred = actual_length;
75 auto rv = std::make_shared<usb_request_libusb>(
_handle->get(), endpoint);
82 auto nr =
reinterpret_cast<libusb_transfer*
>(request->get_native_request());
83 if(nr->dev_handle ==
nullptr)
87 auto sts = libusb_submit_transfer(nr);
90 req->set_active(
false);
92 LOG_WARNING(
"usb_request_queue returned error, endpoint: " << (
int)request->get_endpoint()->get_address() <<
" error: " << strerr <<
", number: " << (int)errno);
100 auto nr =
reinterpret_cast<libusb_transfer*
>(request->get_native_request());
101 auto sts = libusb_cancel_transfer(nr);
102 if (sts < 0 && sts != LIBUSB_ERROR_NOT_FOUND)
105 LOG_WARNING(
"usb_request_cancel returned error, endpoint: " << (
int)request->get_endpoint()->get_address() <<
" error: " << strerr <<
", number: " << (int)errno);
GLuint64 GLenum void * handle
GLsizei const GLchar *const * string
GLenum GLuint GLenum GLsizei length