13 _device(device), _usb_device_descriptor(desc), _info(info),
_context(context)
15 usb_descriptor ud = {desc.bLength, desc.bDescriptorType, std::vector<uint8_t>(desc.bLength)};
16 memcpy(ud.
data.data(), &desc, desc.bLength);
19 for (
uint8_t c = 0;
c < desc.bNumConfigurations; ++
c)
21 libusb_config_descriptor *
config{};
22 auto ret = libusb_get_config_descriptor(device,
c, &
config);
23 if (LIBUSB_SUCCESS != ret)
25 LOG_WARNING(
"failed to read USB config descriptor: error = " << std::dec << ret);
29 std::shared_ptr<usb_interface_libusb> curr_ctrl_intf;
32 auto inf =
config->interface[
i];
33 auto curr_inf = std::make_shared<usb_interface_libusb>(inf);
35 switch (inf.altsetting->bInterfaceClass)
40 curr_ctrl_intf = curr_inf;
42 curr_ctrl_intf->add_associated_interface(curr_inf);
48 for(
int j = 0;
j < inf.num_altsetting;
j++)
50 auto d = inf.altsetting[
j];
51 usb_descriptor ud = {
d.bLength,
d.bDescriptorType, std::vector<uint8_t>(
d.bLength)};
52 memcpy(ud.
data.data(), &
d,
d.bLength);
54 for(
int k = 0; k <
d.extra_length; )
57 auto dt =
d.extra[k+1];
59 memcpy(ud.
data.data(), &
d.extra[k], l);
66 libusb_free_config_descriptor(
config);
79 [interface_number](
const rs_usb_interface&
i) {
return interface_number ==
i->get_number(); });
95 catch(
const std::exception&
e)
106 return std::make_shared<usb_messenger_libusb>(shared_from_this(),
h);
GLfloat GLfloat GLfloat GLfloat h
def info(name, value, persistent=False)