4 #ifdef RS2_USE_ANDROID_BACKEND 31 rv.conn_spec = conn_spec;
39 std::shared_ptr<usb_interface_usbhost> curr_ctrl_intf;
44 usb_device_descriptor *device_descriptor = (usb_device_descriptor *) h;
45 usb_descriptor ud = {h->bLength, h->bDescriptorType, std::vector<uint8_t>(h->bLength)};
46 memcpy(ud.data.data(),
h, h->bLength);
55 usb_descriptor ud = {h->bLength, h->bDescriptorType, std::vector<uint8_t>(h->bLength)};
56 memcpy(ud.data.data(),
h, h->bLength);
59 auto iad = *(usb_interface_assoc_descriptor *) h;
60 auto info = generate_info(_handle, iad.bFirstInterface, conn_spec,
61 static_cast<usb_class>(iad.bFunctionClass));
62 _infos.push_back(
info);
65 auto id = *(::usb_interface_descriptor *) h;
66 auto intf = std::make_shared<usb_interface_usbhost>(
id,
it);
68 switch (
id.bInterfaceClass)
73 auto info = generate_info(_handle,
id.bInterfaceNumber, conn_spec,
74 static_cast<usb_class>(
id.bInterfaceClass));
75 _infos.push_back(
info);
81 curr_ctrl_intf = intf;
83 curr_ctrl_intf->add_associated_interface(intf);
90 }
while (h !=
nullptr);
96 for(
auto&&
e :
i->get_endpoints())
100 auto type =
e->get_type();
103 _dispatchers[
e->get_address()] = std::make_shared<dispatcher>(10);
104 auto d = _dispatchers.at(
e->get_address());
109 _dispatcher = std::make_shared<dispatcher>(10);
110 _dispatcher->start();
115 for(
auto&&
d : _dispatchers)
130 [interface_number](
const rs_usb_interface&
i) {
return interface_number ==
i->get_number(); });
141 auto intf = std::dynamic_pointer_cast<usb_interface_usbhost>(
i);
142 auto h = std::make_shared<handle_usbhost>(_handle, intf);
143 return std::make_shared<usb_messenger_usbhost>(shared_from_this(),
h);
153 auto nr =
reinterpret_cast<::
usb_request*
>(request->get_native_request());
154 auto req = std::dynamic_pointer_cast<usb_request_usbhost>(request);
155 req->set_active(
true);
159 req->set_active(
false);
161 LOG_WARNING(
"usb_request_queue returned error, endpoint: " << (
int)request->get_endpoint()->get_address() <<
" error: " << strerr <<
", number: " << (int)errno);
170 auto nr =
reinterpret_cast<::
usb_request*
>(request->get_native_request());
176 LOG_WARNING(
"usb_request_cancel returned error, endpoint: " << (
int)request->get_endpoint()->get_address() <<
", error: " << strerr <<
", number: " << (int)errno);
190 auto urb =
reinterpret_cast<usb_request_usbhost*
>(
r->client_data);
194 urb->set_active(
false);
196 auto response = urb->get_shared();
199 auto cb = response->get_callback();
200 auto d = _dispatchers.at(response->get_endpoint()->get_address());
202 { cb->callback(response); } );
GLuint const GLchar * name
const struct usb_device_descriptor * usb_device_get_device_descriptor(struct usb_device *device)
const char * usb_device_get_name(struct usb_device *device)
GLuint64 GLenum void * handle
GLsizei const GLchar *const * string
GLfloat GLfloat GLfloat GLfloat h
def info(name, value, persistent=False)
void usb_descriptor_iter_init(struct usb_device *device, struct usb_descriptor_iter *iter)
uint16_t usb_device_get_vendor_id(struct usb_device *device)
uint16_t usb_device_get_product_id(struct usb_device *device)
int usb_request_queue(struct usb_request *req)
int usb_request_cancel(struct usb_request *req)
struct usb_descriptor_header * usb_descriptor_iter_next(struct usb_descriptor_iter *iter)
#define USB_DT_INTERFACE_ASSOCIATION
struct usb_request * usb_request_wait(struct usb_device *dev, int timeoutMillis)